Skip to content

Commit 51ac2c2

Browse files
committed
CI: separate actions for publishing and testing the wheels
1 parent 33fdb61 commit 51ac2c2

File tree

3 files changed

+61
-58
lines changed

3 files changed

+61
-58
lines changed

.github/actions/install_requirements/action.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish to PyPI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
upload:
7+
runs-on: ubuntu-latest
8+
environment: release
9+
strategy:
10+
matrix:
11+
python-version: ["3.12"]
12+
13+
steps:
14+
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
# Need this to get version number from last tag
19+
fetch-depth: 0
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v6
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Build sdist and wheel
27+
run: >
28+
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) &&
29+
pipx run build
30+
31+
- name: Check for packaging errors
32+
run: pipx run twine check --strict dist/*
33+
34+
- name: Install produced wheel
35+
run: pip install dist/*.whl
36+
37+
- name: Test module is importable using the installed wheel - 1
38+
run: python -c "import save_and_restore_api"
39+
40+
- name: Test module is importable using the installed wheel - 2
41+
run: python -c "from save_and_restore_api import SaveRestoreAPI"
42+
43+
- name: Test module is importable using the installed wheel - 3
44+
run: python -c "from save_and_restore_api.aio import SaveRestoreAPI"
45+
46+
- name: Test if save-and-restore tools can be started
47+
run: save-and-restore -h

.github/workflows/publish-pypi.yml

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
name: Publish to PyPI
22

3-
on: [push, pull_request]
4-
5-
#on:
6-
# release:
7-
# types: [created]
8-
# branches:
9-
# - main
3+
on:
4+
release:
5+
types: [created]
6+
branches:
7+
- main
108

119
jobs:
1210
upload:
@@ -24,6 +22,11 @@ jobs:
2422
# Need this to get version number from last tag
2523
fetch-depth: 0
2624

25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v6
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
2730
- name: Build sdist and wheel
2831
run: >
2932
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) &&
@@ -35,20 +38,7 @@ jobs:
3538
- name: Install produced wheel
3639
run: pip install dist/*.whl
3740

38-
- name: Test module is importable using the installed wheel - 1
39-
run: python -c "import save_and_restore_api"
40-
41-
- name: Test module is importable using the installed wheel - 2
42-
run: python -c "from save_and_restore_api import SaveRestoreAPI"
43-
44-
- name: Test module is importable using the installed wheel - 3
45-
run: python -c "from save_and_restore_api.aio import SaveRestoreAPI"
46-
47-
- name: Test if save-and-restore tools can be started
48-
run: save-and-restore -h
49-
50-
51-
#- name: Publish to PyPI using trusted publishing
52-
# uses: pypa/gh-action-pypi-publish@release/v1
53-
# with:
54-
# attestations: false
41+
- name: Publish to PyPI using trusted publishing
42+
uses: pypa/gh-action-pypi-publish@release/v1
43+
with:
44+
attestations: false

0 commit comments

Comments
 (0)