ci: define build jobs for multiple platforms #1
Workflow file for this run
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
# Run this workflow to test Python code changes. | |
name: 🎨 poe (push) | |
on: | |
push: | |
branches: [main, ci/refactor] | |
tags: [v*] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/poetry | |
with: | |
command: lint | |
groups: main,build,test,lint | |
test: | |
strategy: | |
matrix: | |
py: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/cargo | |
with: | |
command: install dicom-storescp | |
- uses: ./.github/actions/poetry | |
with: | |
command: test --error-for-skips | |
groups: main,build,test | |
python-version: ${{ matrix.py }} | |
check: | |
outputs: | |
release: ${{ steps.check.outputs.release }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/poetry | |
with: | |
artifacts: "" | |
command: check-for-prerelease | |
- id: check | |
run: printf 'release=%s\n' "$(cat check-for-prerelease.out)" | |
release: | |
if: needs.check.outputs.release == 'true' | |
needs: | |
- lint | |
- test | |
- check | |
outputs: | |
new: ${{ steps.semantic-release.outputs.released }} | |
version: ${{ steps.semantic-release.outputs.version }} | |
permissions: | |
id-token: write | |
contents: write | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- id: semantic-release | |
uses: python-semantic-release/[email protected] | |
with: | |
commit: false | |
github_token: ${{ github.token }} | |
prerelease: true | |
root_options: --strict -vv | |
docs: | |
if: needs.check.outputs.release != 'true' | |
needs: | |
- lint | |
- test | |
- check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: lint-docs-py3.12 | |
path: docs | |
- uses: actions/download-artifact@v4 | |
with: | |
name: test-docs-py3.12 | |
path: docs | |
- uses: ./.github/actions/poetry | |
with: | |
artifacts: "" | |
command: setup-versioning | |
- uses: ./.github/actions/poetry | |
with: | |
artifacts: "" | |
command: docs | |
- name: Fix permissions | |
run: | | |
chmod -c -R +rX "docs/" | while read -r line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: github-pages | |
path: docs | |
deploy: | |
if: needs.check.outputs.release != 'true' | |
environment: | |
name: GitHub Pages | |
url: ${{ steps.deploy.outputs.page_url }} | |
needs: | |
- check | |
- docs | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- id: deploy | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: github-pages | |
build: | |
name: Build wheels-${{ matrix.wheels }}-${{ matrix.target }} on ${{ matrix.runner }} | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
matrix: | |
runner: [ubuntu-latest] | |
manylinux: [auto, musllinux_1_2] | |
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] | |
exclude: | |
- { manylinux: musllinux_1_2, target: s390x } | |
- { manylinux: musllinux_1_2, target: ppc64le } | |
# prettier-ignore | |
include: | |
- { manylinux: auto, wheels: linux } | |
- { manylinux: musllinux_1_2, wheels: musllinux } | |
- { runner: macos-12, target: x86_64, wheels: macos } | |
- { runner: macos-14, target: aarch64, wheels: macos } | |
- { runner: windows-latest, target: x86, wheels: windows } | |
- { runner: windows-latest, target: x64, wheels: windows } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: actions/setup-python@v5 | |
with: | |
architecture: ${{ matrix.runner == 'windows-latest' && matrix.target || null }} | |
python-version: 3.x | |
- uses: ./.github/actions/poetry | |
with: { artifacts: "", command: setup-versioning, groups: build } | |
- uses: ./.github/actions/poetry | |
with: { artifacts: "", command: dynamic-versioning, groups: build } | |
- uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
sccache: "true" | |
manylinux: ${{ matrix.manylinux}} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.wheels }}-${{ matrix.target }} | |
path: dist | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-sdist | |
path: dist | |
test-pypi: | |
environment: | |
name: test.pypi.org | |
url: https://test.pypi.org/p/config-ninja | |
if: needs.check.outputs.release != 'true' && github.ref_type == 'tag' | |
needs: | |
- check | |
- lint | |
- test | |
- build | |
- sdist | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
pypi: | |
environment: | |
name: pypi.org | |
url: https://pypi.org/p/config-ninja | |
if: github.ref_type == 'tag' | |
needs: | |
- test-pypi | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
- uses: pypa/gh-action-pypi-publish@release/v1 |