Skip to content

Commit c9a4d13

Browse files
committed
Improve CI
* Create package only once * Split deploy in two steps * Uploaded packages also to GitHub releases
1 parent 5818160 commit c9a4d13

File tree

2 files changed

+44
-15
lines changed

2 files changed

+44
-15
lines changed

.github/workflows/deploy.yml

+16-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ on:
1010

1111
jobs:
1212

13-
deploy:
13+
package:
1414
runs-on: ubuntu-latest
15-
environment: deploy
16-
permissions:
17-
id-token: write # For PyPI trusted publishers.
18-
contents: write # For tag and release notes.
1915
env:
2016
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}
2117

@@ -25,6 +21,17 @@ jobs:
2521
- name: Build and Check Package
2622
uses: hynek/[email protected]
2723

24+
deploy:
25+
needs: package
26+
runs-on: ubuntu-latest
27+
environment: deploy
28+
permissions:
29+
id-token: write # For PyPI trusted publishers.
30+
contents: write # For tag and release notes.
31+
32+
steps:
33+
- uses: actions/checkout@v3
34+
2835
- name: Download Package
2936
uses: actions/download-artifact@v3
3037
with:
@@ -36,7 +43,9 @@ jobs:
3643

3744
- name: Push tag
3845
run: |
39-
git tag v${{ github.event.inputs.version }} ${{ github.sha }}
46+
git config user.name "pytest bot"
47+
git config user.email "[email protected]"
48+
git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }}
4049
git push origin v${{ github.event.inputs.version }}
4150
4251
- name: Set up Python
@@ -54,3 +63,4 @@ jobs:
5463
uses: softprops/action-gh-release@v1
5564
with:
5665
body_path: scripts/latest-release-notes.md
66+
files: dist/*

.github/workflows/test.yml

+28-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
name: test
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "test-me-*"
8+
9+
pull_request:
10+
411

512
concurrency:
613
group: ${{ github.workflow }}-${{ github.ref }}
714
cancel-in-progress: true
815

916
jobs:
1017

18+
package:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Build and Check Package
23+
uses: hynek/[email protected]
24+
1125
test:
1226

27+
needs: [package]
28+
1329
runs-on: ${{ matrix.os }}
1430

1531
strategy:
@@ -31,21 +47,24 @@ jobs:
3147

3248
steps:
3349
- uses: actions/checkout@v3
50+
51+
- name: Download Package
52+
uses: actions/download-artifact@v3
53+
with:
54+
name: Packages
55+
path: dist
56+
3457
- name: Set up Python
3558
uses: actions/setup-python@v4
3659
with:
3760
python-version: ${{ matrix.python }}
61+
3862
- name: Install tox
3963
run: |
4064
python -m pip install --upgrade pip
4165
pip install tox
66+
4267
- name: Test
68+
shell: bash
4369
run: |
44-
tox -e ${{ matrix.tox_env }}
45-
46-
check-package:
47-
runs-on: ubuntu-latest
48-
steps:
49-
- uses: actions/checkout@v3
50-
- name: Build and Check Package
51-
uses: hynek/[email protected]
70+
tox run -e ${{ matrix.tox_env }} --installpkg `find dist/*.tar.gz`

0 commit comments

Comments
 (0)