Test & Release #11
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: Test & Release | |
on: | |
release: | |
types: [published] | |
# pull_request: | |
# branches: | |
# - master | |
permissions: | |
contents: read | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # ability to mint the OIDC token permission is necessary to persist the attestation | |
contents: read | |
attestations: write # persist the attestation | |
strategy: | |
matrix: | |
platform: [ 'x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu' ] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f | |
with: | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
cdn.quay.io:443 | |
cdn01.quay.io:443 | |
cdn02.quay.io:443 | |
cdn03.quay.io:443 | |
crates.io:443 | |
files.pythonhosted.org:443 | |
ghcr.io:443 | |
github.com:443 | |
index.crates.io:443 | |
objects.githubusercontent.com:443 | |
pkg-containers.githubusercontent.com:443 | |
pypi.org:443 | |
quay.io:443 | |
sh.rustup.rs:443 | |
static.crates.io:443 | |
static.rust-lang.org:443 | |
uploads.github.com:443 | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b | |
with: | |
python-version: 3.9 | |
architecture: x64 | |
- uses: PyO3/maturin-action@ea5bac0f1ccd0ab11c805e2b804bfcb65dac2eab | |
with: | |
manylinux: auto | |
target: ${{ matrix.platform }} | |
command: build | |
args: --release --sdist -o dist -i 3.9 3.10 3.11 3.12 3.13 | |
- name: Upload wheels | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3 | |
with: | |
name: wheels-linux-${{ matrix.platform }} | |
path: dist | |
windows: | |
runs-on: windows-latest | |
permissions: | |
id-token: write # ability to mint the OIDC token permission is necessary to persist the attestation | |
contents: read | |
attestations: write # persist the attestation | |
strategy: | |
matrix: | |
target: [x64] | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: PyO3/maturin-action@ea5bac0f1ccd0ab11c805e2b804bfcb65dac2eab | |
env: | |
PYO3_PYTHON: python${{ matrix.python-version }} | |
with: | |
command: build | |
args: --release -o dist | |
- name: Upload wheels | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3 | |
with: | |
name: wheels-windows-${{ matrix.python-version }}-${{ matrix.target }} | |
path: dist | |
macos: | |
runs-on: macos-latest | |
permissions: | |
id-token: write # ability to mint the OIDC token permission is necessary to persist the attestation | |
contents: read | |
attestations: write # persist the attestation | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
target: ['universal2', 'x86_64-apple-darwin'] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f | |
with: | |
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build wheels - ${{ matrix.target }} | |
uses: PyO3/maturin-action@ea5bac0f1ccd0ab11c805e2b804bfcb65dac2eab | |
env: | |
PYO3_PYTHON: python${{ matrix.python-version }} | |
with: | |
target: ${{ matrix.target }} | |
command: build | |
args: --release -o dist | |
- name: Upload wheels | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3 | |
with: | |
name: wheels-macos-${{ matrix.python-version }}-${{ matrix.target }} | |
path: dist | |
python-release-github: | |
runs-on: ubuntu-latest | |
needs: [ macos, windows, linux ] | |
permissions: | |
contents: write # To add assets to a release. | |
checks: write | |
packages: write | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.1.0 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
github.com:443 | |
uploads.github.com:443 | |
static.rust-lang.org:443 | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: dtolnay/rust-toolchain@315e265cd78dad1e1dcf3a5074f6d6c47029d5aa | |
with: | |
toolchain: "stable" | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: 3.9 | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
path: wheels | |
pattern: wheels-* | |
merge-multiple: true | |
- name: Upload release binaries | |
uses: alexellis/upload-assets@13926a61cdb2cb35f5fdef1c06b8b591523236d3 # 0.4.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
asset_paths: '["./wheels/tantivy-*"]' | |
release-pypy: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [ macos, windows, linux ] | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f | |
with: | |
egress-policy: audit | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
path: wheels | |
pattern: wheels-* | |
merge-multiple: true | |
- name: Publish package distributions to Test PyPI | |
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
packages-dir: wheels/ | |
skip-existing: true | |
- name: Publish package distributions to PyPI | |
if: always() | |
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2 | |
with: | |
packages-dir: wheels/ | |
skip-existing: true |