Use env instead of variables #3
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
name: Build and publish wheels and create a release on tag creation | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
source-distribution: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- run: python setup.py sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: source-distribution | |
path: ${{ github.workspace }}/dist/*.tar.gz | |
if-no-files-found: error | |
overwrite: true | |
compression-level: 0 | |
linux: | |
name: linux-${{ matrix.arch }}-${{ matrix.abi }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x86_64] | |
abi: [cp310-cp310, cp312-cp312, cp37-cp37m, cp39-cp39, pp37-pypy37_pp73, pp39-pypy39_pp73, cp311-cp311, cp36-cp36m, cp38-cp38, pp310-pypy310_pp73, pp38-pypy38_pp73] | |
env: | |
PLAT: manylinux2014_${{ matrix.arch }} | |
TAG: latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: addnab/docker-run-action@v3 | |
with: | |
image: quay.io/pypa/${{ env.PLAT }}:${{ env.TAG }} | |
options: -v ${{ github.workspace }}:/artifacts -v ${{ github.workspace }}:/work -e DRO_PIP=/opt/python/${{ matrix.abi }}/bin/pip -e DRO_SINGLE=1 -e PLAT=${{ env.PLAT }} | |
run: /work/build-manylinux.sh | |
- name: List Artifacts | |
run: ls -la --color=always ${{ github.workspace }}/*.${{ env.PLAT }}.whl | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: linux-${{ matrix.arch }}-${{ matrix.abi }}-wheel | |
path: ${{ github.workspace }}/*.${{ env.PLAT }}.whl | |
if-no-files-found: error | |
overwrite: true | |
compression-level: 0 | |
windows: | |
name: ${{ matrix.os }}-${{ matrix.arch }}-python${{ matrix.pyver }} | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows] | |
arch: [x64] | |
pyver: ['3.12', '3.11', '3.10', '3.9', '3.8', '3.7', '3.6'] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- run: pip install build | |
- run: python -m build --wheel | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-${{ matrix.arch }}-python${{ matrix.pyver }}-wheel | |
path: ${{ github.workspace }}/dist/*.whl | |
if-no-files-found: error | |
overwrite: true | |
compression-level: 0 | |
test-packages-windows: | |
runs-on: windows-latest | |
needs: [windows] | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x64] | |
pyver: ['3.12', '3.11', '3.10', '3.9', '3.8', '3.7', '3.6'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
name: windows-${{ matrix.arch }}-python${{ matrix.pyver }}-wheel | |
- run: pip install *.whl | |
- run: python test.py | |
test-packages-linux: | |
runs-on: ubuntu-latest | |
needs: [linux] | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x86_64] | |
pyver: ['3.12', '3.11', '3.10', '3.9', '3.8', '3.7'] | |
env: | |
abi: ${{ matrix.pyver == '3.12' && 'cp312-cp312' || matrix.pyver == '3.11' && 'cp311-cp311' || matrix.pyver == '3.10' && 'cp310-cp310' || matrix.pyver == '3.9' && 'cp39-cp39' || matrix.pyver == '3.8' && 'cp38-cp38' || matrix.pyver == '3.7' && 'cp37-cp37m' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
name: linux-${{ matrix.arch }}-${{ env.abi }}-wheel | |
- run: pip install *.whl | |
- run: python test.py | |
publish-to-test-pypi: | |
runs-on: ubuntu-latest | |
needs: [test-packages-windows, test-packages-linux, source-distribution] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- run: pip install twine | |
- name: List all Artifacts | |
run: ls -la --color=always | |
- name: Upload to test.pypi.org | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} | |
run: python -m twine upload --repository-url https://test.pypi.org/legacy/ * | |
create-release: | |
runs-on: ubuntu-latest | |
needs: [publish-to-test-pypi] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: artifacts | |
- name: List all Artifacts | |
run: ls -la --color=always artifacts | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: 'artifacts/*' | |
body: | | |
TEST RUN | |
Automatically generated by Github Actions Run ${{ github.run_id }} | |
generateReleaseNotes: true | |
makeLatest: false | |
draft: true |