Skip to content

Commit 8094c34

Browse files
committed
fix: test and publish workflows
1 parent 16573ba commit 8094c34

5 files changed

Lines changed: 57 additions & 27 deletions

File tree

.github/workflows/publish.yml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
1-
name: Upload Python Package
1+
name: Publish to PyPI
22

33
on:
44
release:
55
types: [published]
66

77
jobs:
8+
test:
9+
uses: sscovil/python-dev-cli/.github/workflows/test.yml@main
810
publish:
11+
if: github.repository == 'sscovil/python-dev-cli'
12+
needs: [test]
913
runs-on: ubuntu-latest
10-
environment: production
14+
environment:
15+
name: pypi
16+
url: https://pypi.org/p/sscovil/python-dev-cli
17+
permissions:
18+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
1119
steps:
1220
- uses: actions/checkout@v3
13-
- name: Set up Python
14-
uses: actions/setup-python@v4
15-
with:
16-
python-version: '3.x'
17-
- name: Install dependencies
18-
run: |
19-
python -m pip install --upgrade pip
20-
python -m pip install ".[dev]"
21-
- name: Run tests
22-
run: |
23-
dev lint
24-
dev test
25-
- name: Build package
26-
run: python -m build --sdist --wheel
2721
- name: Publish package
2822
uses: pypa/gh-action-pypi-publish@release/v1
29-
with:
30-
user: __token__
31-
password: ${{ secrets.PYPI_DEPLOYMENT_TOKEN }}

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build & Test
2+
3+
on:
4+
push:
5+
workflow_dispatch: # Allows manually triggering this workflow from the Actions tab
6+
workflow_call: # Allows other workflows to trigger this workflow
7+
8+
jobs:
9+
test:
10+
if: github.repository == 'sscovil/python-dev-cli'
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ ubuntu-latest, macos-latest, windows-latest ]
15+
python-version: ["3.11", "3.12", "3.13"]
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
python -m pip install ".[dev]"
26+
- name: Run tests
27+
run: |
28+
dev lint
29+
dev test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,6 @@ cython_debug/
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160
#.idea/
161+
162+
# setuptools_scm
163+
_version.py

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to
66
[Semantic Versioning](http://semver.org/).
77

8+
## [1.0.4] - 2023-09-25
9+
10+
### Added
11+
12+
- Separate tests into a different GitHub Actions workflow, for running tests on pull requests
13+
14+
### Changed
15+
16+
- Modify `publish` GitHub Actions workflow to only run on release, using PyPI trusted publishing
17+
- Modify `test` GitHub Actions workflow to test multiple operating systems and Python versions
18+
19+
### Fixed
20+
21+
- Add `_version.py` to `.gitignore` ensure `setuptools_scm` updates that file correctly
22+
823
## [1.0.3] - 2023-09-24
924

1025
### Fixed

src/python_dev_cli/_version.py

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

0 commit comments

Comments
 (0)