-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new JSON output: supported Python versions (#102)
* Adds output that reflects a package's supported Python interpreters * Fixes whitespace issues * Adds an .editorconfig * Polish * Avoid Node warning * Use descriptive names * Make explicit matrix is json too Maybe we get real dicts in GHA one day... * Switch to tox & explicit list * Switch to structlog as test object We already use it in CI and we have control over it * Whitespace * Add changelog * Rename keys To be explicit where the data is coming from and to leave the door open for other sources. * Add docs --------- Co-authored-by: Frank Sachsenheim <[email protected]>
- Loading branch information
1 parent
c16461c
commit 4303b19
Showing
4 changed files
with
144 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
name: Use JSON output to build job matrix | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
FORCE_COLOR: "1" # Make tools pretty. | ||
|
||
jobs: | ||
build-package: | ||
name: Build & verify package | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: hynek/structlog | ||
path: structlog | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: action | ||
- uses: ./action | ||
id: baipp | ||
with: | ||
path: structlog | ||
|
||
outputs: | ||
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }} | ||
# If your matrix consists only of Python versions, you can use the | ||
# following, too: | ||
# python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_job_matrix_value }} | ||
|
||
test-package: | ||
needs: build-package | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# Create matrix from the 'python-versions' output from the build-package | ||
# job. | ||
python-version: ${{ fromJson(needs.build-package.outputs.python-versions) }} | ||
|
||
# If you set 'python-versions' to | ||
# 'supported_python_classifiers_json_job_matrix_value' | ||
# above, you would set the matrix like this instead: | ||
# matrix: ${{ fromJson(needs.build-package.outputs.python-versions) }} | ||
|
||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Download built packages from the build-package job. | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Packages | ||
path: dist | ||
|
||
- name: Prepare tests & config | ||
run: | | ||
# We use tox together with the fast tox-uv plugin. | ||
python -Im pip install tox-uv | ||
# Unpack SDist for tests & config files. | ||
tar xf dist/*.tar.gz --strip-components=1 | ||
# Ensure tests run against wheel. | ||
rm -rf src | ||
- run: python -Im tox run --installpkg dist/*.whl -f py$(echo ${{ matrix.python-version }} | tr -d .) | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters