Skip to content

Commit bdd84cb

Browse files
authored
ci: update publish workflow (#1847)
Update CI workflows and related scripts. Closes: #1846
1 parent 36cbf33 commit bdd84cb

9 files changed

Lines changed: 303 additions & 211 deletions

File tree

.github/workflows/benchmark_base.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@ on:
44
release:
55
types: [published]
66
workflow_dispatch:
7-
description: "Manually update benchmarks"
87

98
jobs:
109
benchmark_base_branch:
1110
name: Continuous Benchmarking with Bencher
1211
runs-on: ubuntu-22.04
1312
steps:
14-
- uses: actions/checkout@v4
15-
- name: Set up Python 3.9
16-
uses: actions/setup-python@v2
13+
- uses: actions/checkout@v6
14+
- name: Set up Python 3.10
15+
uses: actions/setup-python@v6
1716
with:
18-
python-version: '3.9'
17+
python-version: '3.10'
1918
- uses: actions/cache@v4
2019
with:
2120
path: .venv

.github/workflows/benchmark_pr.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
pull-requests: write
1111
runs-on: ubuntu-22.04
1212
steps:
13-
- uses: actions/checkout@v4
14-
- name: Set up Python 3.9
15-
uses: actions/setup-python@v2
13+
- uses: actions/checkout@v6
14+
- name: Set up Python 3.10
15+
uses: actions/setup-python@v6
1616
with:
17-
python-version: '3.9'
17+
python-version: '3.10'
1818
- uses: actions/cache@v4
1919
with:
2020
path: .venv
@@ -27,8 +27,10 @@ jobs:
2727
--project pyquil \
2828
--token '${{ secrets.BENCHER_API_TOKEN }}' \
2929
--branch '${{ github.head_ref }}' \
30-
--branch-start-point '${{ github.base_ref }}' \
31-
--branch-start-point-hash '${{ github.event.pull_request.base.sha }}' \
30+
--start-point '${{ github.base_ref }}' \
31+
--start-point-hash '${{ github.event.pull_request.base.sha }}' \
32+
--start-point-clone-thresholds \
33+
--start-point-reset \
3234
--testbed ci-runner-linux \
3335
--err \
3436
--github-actions '${{ secrets.GITHUB_TOKEN }}' \

.github/workflows/publish.yml

Lines changed: 55 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,67 +4,71 @@ on:
44
release:
55
types: [published]
66
workflow_dispatch:
7-
description: "Manually publish release"
87

98
jobs:
109
build-publish:
1110
name: Build and Publish
1211
runs-on: ubuntu-latest
12+
environment: pypi
13+
permissions:
14+
id-token: write
15+
contents: read
1316
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-python@v3
16-
- uses: snok/install-poetry@v1
17-
with:
18-
virtualenvs-in-project: true
19-
- name: "Build"
20-
run: |
21-
poetry build --no-interaction
22-
- id: publish
23-
name: "Publish"
24-
run: |
25-
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
26-
poetry publish
27-
export PYQUIL_TAG_VERSION=$(poetry version --short)
28-
export PYQUIL_TAG_LATEST=$([[ "$PYQUIL_TAG_VERSION" =~ ^[0-9]+[.][0-9]+[.][0-9]+$ ]] && echo latest || echo)
29-
export PYQUIL_TAG_RC=$([[ "$PYQUIL_TAG_VERSION" =~ ^[0-9]+[.][0-9]+[.][0-9]+-rc[.][0-9]+$ ]] && echo rc || echo)
30-
echo "PYQUIL_TAG_VERSION=$PYQUIL_TAG_VERSION" >> "$GITHUB_OUTPUT"
31-
echo "PYQUIL_TAG_LATEST=$PYQUIL_TAG_LATEST" >> "$GITHUB_OUTPUT"
32-
echo "PYQUIL_TAG_RC=$PYQUIL_TAG_RC" >> "$GITHUB_OUTPUT"
17+
- uses: actions/checkout@v6
18+
- uses: actions/setup-python@v6
19+
with:
20+
python-version: '3.12'
21+
- uses: snok/install-poetry@v1
22+
with:
23+
virtualenvs-in-project: true
24+
- name: "Build"
25+
run: |
26+
poetry build --no-interaction
27+
- name: Publish to PyPI
28+
uses: pypa/gh-action-pypi-publish@release/v1
29+
- id: version
30+
name: "Get version info"
31+
run: |
32+
export PYQUIL_TAG_VERSION=$(poetry version --short)
33+
export PYQUIL_TAG_LATEST=$([[ "$PYQUIL_TAG_VERSION" =~ ^[0-9]+[.][0-9]+[.][0-9]+$ ]] && echo latest || echo)
34+
export PYQUIL_TAG_RC=$([[ "$PYQUIL_TAG_VERSION" =~ ^[0-9]+[.][0-9]+[.][0-9]+-rc[.][0-9]+$ ]] && echo rc || echo)
35+
echo "PYQUIL_TAG_VERSION=$PYQUIL_TAG_VERSION" >> "$GITHUB_OUTPUT"
36+
echo "PYQUIL_TAG_LATEST=$PYQUIL_TAG_LATEST" >> "$GITHUB_OUTPUT"
37+
echo "PYQUIL_TAG_RC=$PYQUIL_TAG_RC" >> "$GITHUB_OUTPUT"
3338
outputs:
34-
PYQUIL_TAG_VERSION: ${{ steps.publish.outputs.PYQUIL_TAG_VERSION }}
35-
PYQUIL_TAG_LATEST: ${{ steps.publish.outputs.PYQUIL_TAG_LATEST }}
36-
PYQUIL_TAG_RC: ${{ steps.publish.outputs.PYQUIL_TAG_RC }}
39+
PYQUIL_TAG_VERSION: ${{ steps.version.outputs.PYQUIL_TAG_VERSION }}
40+
PYQUIL_TAG_LATEST: ${{ steps.version.outputs.PYQUIL_TAG_LATEST }}
41+
PYQUIL_TAG_RC: ${{ steps.version.outputs.PYQUIL_TAG_RC }}
3742

3843
build-publish-grpc-web:
3944
name: Build and Publish (pyquil-grpc-web)
4045
runs-on: ubuntu-latest
46+
environment: pypi
4147
permissions:
4248
id-token: write
4349
contents: read
4450
steps:
45-
- uses: actions/checkout@v3
46-
- uses: actions/setup-python@v3
47-
- uses: snok/install-poetry@v1
48-
with:
49-
virtualenvs-in-project: true
50-
- name: Patch package metadata for grpc-web
51-
run: |
52-
pip install toml
53-
python scripts/ci_publish_grpc_web.py
54-
- name: Poetry Build
55-
run: |
56-
poetry build --no-interaction
57-
- name: Upload wheels as artifacts
58-
uses: actions/upload-artifact@v2
59-
with:
60-
name: wheels
61-
path: dist
62-
- name: Mint token
63-
id: mint
64-
uses: tschm/token-mint-action@v1.0.3
65-
- name: Publish the package with poetry
66-
run: |
67-
poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}'
51+
- uses: actions/checkout@v6
52+
- uses: actions/setup-python@v6
53+
with:
54+
python-version: '3.12'
55+
- uses: snok/install-poetry@v1
56+
with:
57+
virtualenvs-in-project: true
58+
- name: Patch package metadata for grpc-web
59+
run: |
60+
pip install toml
61+
python scripts/ci_publish_grpc_web.py
62+
- name: Poetry Build
63+
run: |
64+
poetry build --no-interaction
65+
- name: Upload wheels as artifacts
66+
uses: actions/upload-artifact@v6
67+
with:
68+
name: wheels
69+
path: dist
70+
- name: Publish to PyPI
71+
uses: pypa/gh-action-pypi-publish@release/v1
6872

6973
docker-publish:
7074
name: Docker Publish
@@ -78,7 +82,7 @@ jobs:
7882
# Determine the tags to publish based on the release tag
7983
- name: Docker Metadata
8084
id: meta
81-
uses: docker/metadata-action@v4
85+
uses: docker/metadata-action@v5
8286
with:
8387
images: |
8488
${{ vars.DOCKER_IMAGE_NAME }}
@@ -88,9 +92,9 @@ jobs:
8892
type=raw,value=${{ env.PYQUIL_TAG_RC }},enable=${{ env.PYQUIL_TAG_RC != '' }}
8993
# Checkout is needed to use the path context: .
9094
- name: Checkout
91-
uses: actions/checkout@v3
95+
uses: actions/checkout@v6
9296
- name: Build and Test
93-
uses: docker/build-push-action@v4
97+
uses: docker/build-push-action@v6
9498
with:
9599
context: .
96100
load: true
@@ -102,12 +106,12 @@ jobs:
102106
docker run --rm "${{ vars.DOCKER_IMAGE_NAME }}:test" python -c "from pyquil import get_qc"
103107
# Build and publish the image
104108
- name: Login to Docker Hub
105-
uses: docker/login-action@v2
109+
uses: docker/login-action@v3
106110
with:
107111
username: ${{ secrets.DOCKERHUB_USERNAME }}
108112
password: ${{ secrets.DOCKERHUB_PASSWORD }}
109113
- name: Build and Push
110-
uses: docker/build-push-action@v4
114+
uses: docker/build-push-action@v6
111115
with:
112116
context: .
113117
push: true

.github/workflows/release-dry-run.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
type:
99
description: Runs knope with the --dry-run flag to see what the next release would look like.
1010
required: true
11+
type: "choice"
1112
default: prerelease
1213
options:
1314
- prerelease

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
type:
1010
description: Bump versions and trigger a new release.
1111
required: true
12+
type: "choice"
1213
default: prerelease
1314
options:
1415
- prerelease
@@ -20,7 +21,7 @@ jobs:
2021
env:
2122
GITHUB_TOKEN: ${{ secrets.PAT }}
2223
steps:
23-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v6
2425
with:
2526
fetch-depth: 0
2627
token: ${{ secrets.PAT }}

.github/workflows/test.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
name: Build and test documentation
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
16-
- name: Set up Python 3.9
17-
uses: actions/setup-python@v4
15+
- uses: actions/checkout@v6
16+
- name: Set up Python 3.10
17+
uses: actions/setup-python@v6
1818
with:
19-
python-version: '3.9'
19+
python-version: '3.10'
2020
- uses: actions/cache@v4
2121
with:
2222
path: .venv
@@ -32,11 +32,11 @@ jobs:
3232
name: Check formatting
3333
runs-on: ubuntu-latest
3434
steps:
35-
- uses: actions/checkout@v2
36-
- name: Set up Python 3.9
37-
uses: actions/setup-python@v4
35+
- uses: actions/checkout@v6
36+
- name: Set up Python 3.10
37+
uses: actions/setup-python@v6
3838
with:
39-
python-version: '3.9'
39+
python-version: '3.10'
4040
- uses: actions/cache@v4
4141
with:
4242
path: .venv
@@ -51,11 +51,11 @@ jobs:
5151
name: Check style
5252
runs-on: ubuntu-latest
5353
steps:
54-
- uses: actions/checkout@v2
55-
- name: Set up Python 3.9
56-
uses: actions/setup-python@v4
54+
- uses: actions/checkout@v6
55+
- name: Set up Python 3.10
56+
uses: actions/setup-python@v6
5757
with:
58-
python-version: '3.9'
58+
python-version: '3.10'
5959
- uses: actions/cache@v4
6060
with:
6161
path: .venv
@@ -70,11 +70,11 @@ jobs:
7070
name: Check types
7171
runs-on: ubuntu-latest
7272
steps:
73-
- uses: actions/checkout@v2
74-
- name: Set up Python 3.9
75-
uses: actions/setup-python@v4
73+
- uses: actions/checkout@v6
74+
- name: Set up Python 3.10
75+
uses: actions/setup-python@v6
7676
with:
77-
python-version: '3.9'
77+
python-version: '3.10'
7878
- uses: actions/cache@v4
7979
with:
8080
path: .venv
@@ -90,7 +90,7 @@ jobs:
9090
name: Check dependencies for vulnerabilities
9191
runs-on: ubuntu-latest
9292
steps:
93-
- uses: actions/checkout@v2
93+
- uses: actions/checkout@v6
9494
- name: Set up Go
9595
uses: actions/setup-go@v5
9696
- name: Install OSV scanner
@@ -105,11 +105,11 @@ jobs:
105105
runs-on: ubuntu-latest
106106
strategy:
107107
matrix:
108-
python-version: ["3.9", "3.10", "3.11", "3.12"]
108+
python-version: ["3.10", "3.11", "3.12", "3.13"]
109109
steps:
110-
- uses: actions/checkout@v2
110+
- uses: actions/checkout@v6
111111
- name: Set up Python ${{ matrix.python-version }}
112-
uses: actions/setup-python@v2
112+
uses: actions/setup-python@v6
113113
with:
114114
python-version: ${{ matrix.python-version }}
115115
- uses: actions/cache@v4
@@ -133,11 +133,11 @@ jobs:
133133
pull-requests: write # allows coverage bot to comment
134134
strategy:
135135
matrix:
136-
python-version: ["3.9", "3.10", "3.11", "3.12"]
136+
python-version: ["3.10", "3.11", "3.12", "3.13"]
137137
steps:
138-
- uses: actions/checkout@v2
138+
- uses: actions/checkout@v6
139139
- name: Set up Python ${{ matrix.python-version }}
140-
uses: actions/setup-python@v2
140+
uses: actions/setup-python@v6
141141
with:
142142
python-version: ${{ matrix.python-version }}
143143
- uses: actions/cache@v4
@@ -165,9 +165,9 @@ jobs:
165165
name: Check docker image
166166
runs-on: ubuntu-latest
167167
steps:
168-
- uses: actions/checkout@v2
168+
- uses: actions/checkout@v6
169169
- name: Set up Python 3.10
170-
uses: actions/setup-python@v2
170+
uses: actions/setup-python@v6
171171
with:
172172
python-version: '3.10'
173173
- uses: actions/cache@v4
@@ -195,11 +195,11 @@ jobs:
195195
runs-on: ubuntu-latest
196196
strategy:
197197
matrix:
198-
python-version: ["3.9", "3.10", "3.11", "3.12"]
198+
python-version: ["3.10", "3.11", "3.12", "3.13"]
199199
steps:
200-
- uses: actions/checkout@v2
200+
- uses: actions/checkout@v6
201201
- name: Set up Python ${{ matrix.python-version }}
202-
uses: actions/setup-python@v2
202+
uses: actions/setup-python@v6
203203
with:
204204
python-version: ${{ matrix.python-version }}
205205
- uses: actions/cache@v4

0 commit comments

Comments
 (0)