Skip to content

Commit

Permalink
[Infra] Add Publish Step (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: Niklas Heim <[email protected]>
  • Loading branch information
2 people authored and madagra committed Oct 10, 2023
1 parent 1b4960f commit 7b15fb6
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build documentation
name: Build & deploy documentation

on:
push:
Expand All @@ -16,10 +16,11 @@ concurrency:
jobs:
test_qadence_ubuntu:
name: Test Qadence docs (ubuntu)
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4
- name: Checkout Qadence
uses: actions/checkout@v4

- name: Install JetBrains Mono font
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
7 changes: 5 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: linting and type check
name: Lint and type check

on:
push:
Expand All @@ -10,19 +10,22 @@ on:
jobs:
lint:

runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- name: Checkout Qadence
uses: actions/checkout@v4

- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install pre-commit
run: |
pip install pre-commit
pre-commit install
- name: Check files
run: |
pre-commit run --all-files
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Upload release to PyPI

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out Qadence
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Build and publish package
run: |
hatch build
hatch publish -u ${{ secrets.HATCH_PYPI_USER }} -a ${{ secrets.HATCH_PYPI_AUTH }}
- name: Confirm deployment
timeout-minutes: 5
run: |
VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')
echo "VERSION=$VERSION" >> $GITHUB_ENV
until pip download qadence==$version
do
echo "Failed to download from PyPI, will wait for upload and retry."
sleep 1
done
10 changes: 7 additions & 3 deletions .github/workflows/test_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,29 @@ on:
workflow_dispatch: {}

concurrency:
group: ${{ github.head_ref || github.run_id }}
group: all-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test_qadence_ubuntu:
name: Test Qadence (ubuntu)
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- name: Checkout Qadence
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: |
pip install hatch
- name: Run tests
run: |
hatch -v run test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Qadence example and notebook tests.
name: Run Qadence example tests

on:
push:
Expand All @@ -7,34 +7,31 @@ on:
pull_request:
branches:
- main
paths:
- examples
- notebooks
schedule:
# 03:00 every Saturday morning
- cron: '0 3 * * 6'
workflow_dispatch: {}

concurrency:
group: ${{ github.head_ref || github.run_id }}
group: examples-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test_qadence_ubuntu:
name: Test Qadence (ubuntu)
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install graphviz
run: sudo apt-get install -y graphviz

- name: Select Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Hatch
run: |
pip install hatch
- name: Run example tests
run: |
hatch -v run test-examples
- name: Run notebooks tests
run: |
hatch -v run test-notebooks
10 changes: 7 additions & 3 deletions .github/workflows/test_fast.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: fast tests
name: Fast tests

on:
push:
Expand All @@ -10,29 +10,33 @@ on:
workflow_dispatch: {}

concurrency:
group: ${{ github.head_ref || github.run_id }}
group: fast-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test_qadence_ubuntu:
name: Test Qadence (ubuntu)
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
steps:
- name: Checkout Qadence
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: |
pip install hatch
- name: Run fast tests
run: |
hatch -v run test -m "not slow"
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ authors = [
]
requires-python = ">=3.9,<3.11"
license = {text = "Apache 2.0"}
version = "0.9.1"
version = "0.9.2"
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
Expand Down

0 comments on commit 7b15fb6

Please sign in to comment.