Maturin build fail in master. (#27) #4
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: package and publish to pypi | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
github-release: | |
name: Create Github release page | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Set release version | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Create Github release page | |
# Create the release page first | |
run: gh release create ${{ env.RELEASE_VERSION }} --draft --notes "Auto created by tagPublish workflow." | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
wheel: | |
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} | |
runs-on: ${{ matrix.platform.os }} | |
permissions: | |
id-token: write | |
contents: write | |
strategy: | |
matrix: | |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] | |
platform: [ | |
{ os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }, | |
{ os: "macOS-latest", python-architecture: "x64", rust-target: "x86_64-apple-darwin" }, | |
{ os: "windows-latest", python-architecture: "x64", rust-target: "x86_64-pc-windows-msvc" }, | |
{ os: "ubuntu-20.04", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }, | |
] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set release version | |
# Set release version env in all three os, the commented command only works in linux and mac. | |
run: python3 -c "import os; tag = os.environ['GITHUB_REF'].split('/')[-1]; f = open(os.environ['GITHUB_ENV'], 'a'); f.write('RELEASE_VERSION='+tag); f.close();" | |
# run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.platform.python-architecture }} | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.platform.rust-target }} | |
override: true | |
components: rustfmt, clippy | |
- run: rustup set default-host ${{ matrix.platform.rust-target }} | |
- name: install maturin | |
run: pip install 'maturin>=0.14,<0.15' | |
- name: build wheel | |
if: ${{ matrix.platform.os != 'ubuntu-20.04'}} | |
id: build_wheel | |
run: python -u .github/workflows/build_wheel.py "--compatibility=manylinux_2_35" | |
- name: build wheel 1 | |
if: ${{ matrix.platform.os == 'ubuntu-20.04'}} | |
id: build_wheel1 | |
run: python -u .github/workflows/build_wheel.py "--compatibility=manylinux_2_31" | |
- name: build source | |
id: build_source | |
run: python -u .github/workflows/build_source.py | |
- name: mint API token | |
id: mint-token | |
shell: bash | |
# Reference link : https://docs.pypi.org/trusted-publishers/using-a-publisher/ | |
run: | | |
# retrieve the ambient OIDC token | |
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ | |
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi") | |
oidc_token=$(jq '.value' <<< "${resp}") | |
# exchange the OIDC token for an API token | |
resp=$(curl -X POST https://pypi.org/_/oidc/github/mint-token -d "{\"token\": ${oidc_token}}") | |
api_token=$(jq -r '.token' <<< "${resp}") | |
# mask the newly minted API token, so that we don't accidentally leak it | |
echo "::add-mask::${api_token}" | |
# see the next step in the workflow for an example of using this step output | |
echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}" | |
- name: Publish to pypi | |
env: | |
# the username and the repository needs to be changed before release. | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ steps.mint-token.outputs.api-token }} | |
TWINE_REPOSITORY: pypi | |
run: | | |
pip install -U twine | |
python -m twine upload --skip-existing target/wheels/* | |
- name: Upload to Github releases | |
working-directory: ./target | |
# Use bash, even on Windows to make find available | |
shell: bash | |
# A release need to be created before upload | |
run: gh release upload ${{ env.RELEASE_VERSION }} "$(find ./wheels -name *.whl)" --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |