Skip to content

Commit e58d188

Browse files
committed
update ci
1 parent 783318f commit e58d188

File tree

10 files changed

+179
-4787
lines changed

10 files changed

+179
-4787
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,63 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1212
cancel-in-progress: true
1313

14-
# See: https://github.com/pdm-project/pdm/issues/1879
15-
env:
16-
PDM_DEPS: 'urllib3<2'
17-
1814
jobs:
1915
build:
2016
runs-on: ubuntu-latest
2117
strategy:
2218
matrix:
23-
python-version: ["3.9", "3.10", "3.11", "3.12"]
19+
python-version: ["3.10", "3.11", "3.12"]
2420

2521
steps:
2622
- uses: actions/checkout@v4
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v5
25+
with:
26+
# Install a specific version of uv.
27+
version: "0.5.1"
28+
enable-cache: true
29+
cache-dependency-glob: "uv.lock"
2730
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v5
31+
run: uv python install ${{ matrix.python-version }}
32+
- name: Install the project
33+
run: uv sync --all-extras --dev
34+
- name: Run tests
35+
# For example, using `pytest`
36+
run: uv run just coverage
37+
- name: Upload Coverage to Codecov
38+
uses: codecov/codecov-action@v5
2939
with:
30-
python-version: ${{ matrix.python-version }}
31-
- uses: pdm-project/setup-pdm@v4
32-
name: Setup PDM
40+
files: coverage.xml # optional
41+
fail_ci_if_error: true # optional (default = false)
42+
verbose: true # optional (default = false)
43+
token: ${{ secrets.CODECOV_TOKEN }} # required
44+
- name: Archive code coverage results
45+
if: matrix.python-version == '3.12'
46+
uses: actions/upload-artifact@v4
3347
with:
34-
python-version: ${{ matrix.python-version }} # Version range or exact version of a Python version to use, the same as actions/setup-python
35-
# well we use virtualenv here
36-
# prerelease: true # Allow prerelease versions to be installed
37-
# enable-pep582: true # Enable PEP 582 package loading globally
38-
- name: Install dependencies
39-
run: pdm install # Then you can use pdm in the following steps.
40-
- name: Test with pytest & generate coverage
41-
run: |
42-
pdm test
48+
name: code-coverage-report
49+
path: coverage.xml
50+
retention-days: 2
51+
post:
52+
runs-on: ubuntu-latest
53+
needs: build
54+
if: github.event.pull_request
55+
steps:
56+
- uses: actions/checkout@v4
57+
- name: download covearge
58+
uses: actions/download-artifact@v4
59+
with:
60+
name: code-coverage-report
61+
- name: check coverage
62+
run: |
63+
if [ -f coverage.xml ]; then
64+
echo "Coverage file exists"
65+
else
66+
echo "Coverage file does not exist"
67+
exit 1
68+
fi
69+
- name: post covearge
70+
uses: orgoro/coverage@v3.2
71+
with:
72+
coverageFile: coverage.xml
73+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/cov.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/deploy_dev.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ concurrency:
88
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
99
cancel-in-progress: true
1010

11-
# See: https://github.com/pdm-project/pdm/issues/1879
12-
env:
13-
PDM_DEPS: 'urllib3<2'
14-
1511
jobs:
1612
documentation:
1713
name: Deploy dev documentation
@@ -20,16 +16,15 @@ jobs:
2016
- uses: actions/checkout@v4
2117
with:
2218
fetch-depth: 0
23-
- name: Set up Python 3.12
24-
uses: actions/setup-python@v5
25-
with:
26-
python-version: 3.12
27-
- uses: pdm-project/setup-pdm@v4
28-
name: Setup PDM
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
2921
with:
30-
python-version: 3.12
31-
- name: Install dependencies
32-
run: pdm install -G doc
22+
# Install a specific version of uv.
23+
version: "0.5.1"
24+
enable-cache: true
25+
cache-dependency-glob: "uv.lock"
26+
- name: Install Documentation dependencies
27+
run: uv sync --group doc
3328
- name: Set up build cache
3429
uses: actions/cache@v4
3530
id: cache
@@ -50,4 +45,4 @@ jobs:
5045
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
5146
run: |
5247
git fetch origin gh-pages --depth=1
53-
pdm run mike deploy -p dev
48+
uv run mike deploy -p dev

.github/workflows/deploy_latest.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@ jobs:
2727
- uses: actions/checkout@v4
2828
with:
2929
fetch-depth: 0
30-
- name: Set up Python 3.12
31-
uses: actions/setup-python@v5
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v5
3232
with:
33-
python-version: 3.12
34-
- uses: pdm-project/setup-pdm@v4
35-
name: Setup PDM
36-
with:
37-
python-version: 3.12
38-
- name: Install dependencies
39-
run: pdm install -G doc
33+
# Install a specific version of uv.
34+
version: "0.5.1"
35+
enable-cache: true
36+
cache-dependency-glob: "uv.lock"
37+
- name: Install Documentation dependencies
38+
run: uv sync --group doc
4039
- name: Set up build cache
4140
uses: actions/cache@v4
4241
id: cache
@@ -63,4 +62,4 @@ jobs:
6362
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
6463
run: |
6564
git fetch origin gh-pages --depth=1
66-
pdm run mike deploy --update-alias --push ${TAG_VERSION} latest
65+
uv run mike deploy --update-alias --push ${TAG_VERSION} latest

.github/workflows/doc.yml

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Documentation(preview)
1+
name: Documentation (preview)
22
on:
33
pull_request:
44
types:
@@ -10,33 +10,21 @@ concurrency:
1010
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1111
cancel-in-progress: true
1212

13-
# See: https://github.com/pdm-project/pdm/issues/1879
14-
env:
15-
PDM_DEPS: 'urllib3<2'
16-
1713
jobs:
1814
documentation:
1915
name: Deploy preview documentation
2016
runs-on: ubuntu-latest
2117
steps:
22-
- name: Wait for dev documentation to deploy
23-
uses: lewagon/wait-on-check-action@v1.3.4
24-
with:
25-
ref: main
26-
check-name: 'Deploy dev documentation'
27-
repo-token: ${{ secrets.GITHUB_TOKEN }}
28-
wait-interval: 10
2918
- uses: actions/checkout@v4
30-
- name: Set up Python 3.12
31-
uses: actions/setup-python@v5
32-
with:
33-
python-version: 3.12
34-
- uses: pdm-project/setup-pdm@v4
35-
name: Setup PDM
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
3621
with:
37-
python-version: 3.12
38-
- name: Install dependencies
39-
run: pdm install -G doc
22+
# Install a specific version of uv.
23+
version: "0.5.1"
24+
enable-cache: true
25+
cache-dependency-glob: "uv.lock"
26+
- name: Install Documentation dependencies
27+
run: uv sync --group doc
4028
- name: Set up build cache
4129
uses: actions/cache@v4
4230
id: cache
@@ -48,9 +36,8 @@ jobs:
4836
- name: Depoly documentation
4937
env:
5038
GH_TOKEN: ${{ secrets.GH_TOKEN }}
51-
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
5239
run: |
53-
pdm run doc_build
40+
uv run mkdocs build
5441
- name: Deploy preview
5542
uses: rossjrw/pr-preview-action@v1
5643
with:

.github/workflows/pdm.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build distribution 📦
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v4
14+
with:
15+
# Install a specific version of uv.
16+
version: "0.5.5"
17+
enable-cache: true
18+
cache-dependency-glob: "uv.lock"
19+
- name: Install the project
20+
run: uv sync --all-extras --dev
21+
- name: Build distribution 📦
22+
run: uv build
23+
- name: Store the distribution packages
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: python-package-distributions
27+
path: dist/
28+
29+
publish-to-pypi:
30+
name: >-
31+
Publish Python 🐍 distribution 📦 to PyPI
32+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
33+
needs:
34+
- build
35+
runs-on: ubuntu-latest
36+
environment:
37+
name: pypi
38+
url: https://pypi.org/p/bloqade-analog # Replace <package-name> with your PyPI project name
39+
permissions:
40+
id-token: write # IMPORTANT: mandatory for trusted publishing
41+
42+
steps:
43+
- name: Download all the dists
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: python-package-distributions
47+
path: dist/
48+
- name: Publish distribution 📦 to PyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
51+
github-release:
52+
name: >-
53+
Sign the Python 🐍 distribution 📦 with Sigstore
54+
and upload them to GitHub Release
55+
needs:
56+
- publish-to-pypi
57+
runs-on: ubuntu-latest
58+
59+
permissions:
60+
contents: write # IMPORTANT: mandatory for making GitHub Releases
61+
id-token: write # IMPORTANT: mandatory for sigstore
62+
63+
steps:
64+
- name: Download all the dists
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: python-package-distributions
68+
path: dist/
69+
- name: Sign the dists with Sigstore
70+
uses: sigstore/gh-action-sigstore-python@v3.0.0
71+
with:
72+
inputs: >-
73+
./dist/*.tar.gz
74+
./dist/*.whl
75+
- name: Create GitHub Release
76+
env:
77+
GITHUB_TOKEN: ${{ github.token }}
78+
run: >-
79+
gh release create
80+
'${{ github.ref_name }}'
81+
--repo '${{ github.repository }}'
82+
--notes ""
83+
- name: Upload artifact signatures to GitHub Release
84+
env:
85+
GITHUB_TOKEN: ${{ github.token }}
86+
# Upload to GitHub Release using the `gh` CLI.
87+
# `dist/` contains the built packages, and the
88+
# sigstore-produced signatures and certificates.
89+
run: >-
90+
gh release upload
91+
'${{ github.ref_name }}' dist/**
92+
--repo '${{ github.repository }}'

0 commit comments

Comments
 (0)