Skip to content

Commit 642b742

Browse files
committed
New Workflows (#46)
* updating release action * new ci and linting * do not upgrade during sync
1 parent a07accc commit 642b742

File tree

3 files changed

+54
-57
lines changed

3 files changed

+54
-57
lines changed

.github/workflows/ci.yml

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

14-
1514
jobs:
1615
build:
1716
runs-on: ubuntu-latest
@@ -26,50 +25,49 @@ jobs:
2625
with:
2726
# Install a specific version of uv.
2827
version: "0.5.1"
29-
# TODO: enable cache when kirin open-source
30-
# enable-cache: true
31-
# cache-dependency-glob: "uv.lock"
28+
enable-cache: true
29+
cache-dependency-glob: "uv.lock"
3230
- name: Set up Python ${{ matrix.python-version }}
3331
run: uv python install ${{ matrix.python-version }}
3432
- name: Install the project
35-
run: uv sync --all-extras --dev --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/kirin/simple/" --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/quera-pypi-algo/simple/"
33+
run: uv sync --all-extras --dev
3634
- name: Run tests
3735
# For example, using `pytest`
3836
run: uv run just coverage
39-
# - name: Upload Coverage to Codecov
40-
# uses: codecov/codecov-action@v4
41-
# with:
42-
# files: coverage.xml # optional
43-
# fail_ci_if_error: true # optional (default = false)
44-
# verbose: true # optional (default = false)
45-
# token: ${{ secrets.CODECOV_TOKEN }} # required
46-
# - name: Archive code coverage results
47-
# if: matrix.python-version == '3.12'
48-
# uses: actions/upload-artifact@v4
49-
# with:
50-
# name: code-coverage-report
51-
# path: coverage.xml
52-
# retention-days: 2
53-
# post:
54-
# runs-on: ubuntu-latest
55-
# needs: build
56-
# if: github.event.pull_request
57-
# steps:
58-
# - uses: actions/checkout@v4
59-
# - name: download covearge
60-
# uses: actions/download-artifact@v4
61-
# with:
62-
# name: code-coverage-report
63-
# - name: check coverage
64-
# run: |
65-
# if [ -f coverage.xml ]; then
66-
# echo "Coverage file exists"
67-
# else
68-
# echo "Coverage file does not exist"
69-
# exit 1
70-
# fi
71-
# - name: post covearge
72-
# uses: orgoro/[email protected]
73-
# with:
74-
# coverageFile: coverage.xml
75-
# token: ${{ secrets.GITHUB_TOKEN }}
37+
- name: Upload Coverage to Codecov
38+
uses: codecov/codecov-action@v5
39+
with:
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
47+
with:
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 coverage
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 coverage
70+
uses: orgoro/[email protected]
71+
with:
72+
coverageFile: coverage.xml
73+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
enable-cache: true
3939
cache-dependency-glob: "uv.lock"
4040
- name: Install the project
41-
run: uv sync --all-extras --dev --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/kirin/simple/" --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/quera-pypi-algo/simple/"
41+
run: uv sync --all-extras --dev
4242
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
4343
- uses: jakebailey/pyright-action@v2
4444
with:

.github/workflows/release_v2.yml renamed to .github/workflows/release.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Python 🐍 distribution 📦 to JFrog and TestJFrog
1+
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
22

33
on: push
44

@@ -15,7 +15,7 @@ jobs:
1515
# Install a specific version of uv.
1616
version: "0.5.5"
1717
- name: Install the project
18-
run: uv sync --all-extras --dev --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/kirin/simple/" --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/quera-pypi-algo/simple/"
18+
run: uv sync --all-extras
1919
- name: Build distribution 📦
2020
run: uv build
2121
- name: Store the distribution packages
@@ -24,35 +24,34 @@ jobs:
2424
name: python-package-distributions
2525
path: dist/
2626

27-
publish-to-jfrog:
27+
publish-to-pypi:
2828
name: >-
29-
Publish Python 🐍 distribution 📦 to Jfrog
30-
if: startsWith(github.ref, 'refs/tags/') # only publish on tag pushes
29+
Publish Python 🐍 distribution 📦 to PyPI
30+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
3131
needs:
3232
- build
3333
runs-on: ubuntu-latest
34+
environment:
35+
name: pypi
36+
url: https://pypi.org/p/bloqade-shuttle # Replace <package-name> with your PyPI project name
37+
permissions:
38+
id-token: write # IMPORTANT: mandatory for trusted publishing
3439

3540
steps:
3641
- name: Download all the dists
3742
uses: actions/download-artifact@v4
3843
with:
3944
name: python-package-distributions
4045
path: dist/
41-
- name: Install uv
42-
uses: astral-sh/setup-uv@v6
43-
with:
44-
# Install a specific version of uv.
45-
version: "0.5.5"
46-
- name: Publish distribution 📦 to JFrog
47-
run: uv publish --publish-url ${{secrets.QUERA_ALGO_PYPI_REPOSITORY_URL}} --username ${{secrets.JFROG_KIRIN_USERNAME}} --password ${{secrets.JFROG_KIRIN_PASSWORD}}
48-
46+
- name: Publish distribution 📦 to PyPI
47+
uses: pypa/gh-action-pypi-publish@release/v1
4948

5049
github-release:
5150
name: >-
5251
Sign the Python 🐍 distribution 📦 with Sigstore
5352
and upload them to GitHub Release
5453
needs:
55-
- publish-to-jfrog
54+
- publish-to-pypi
5655
runs-on: ubuntu-latest
5756

5857
permissions:

0 commit comments

Comments
 (0)