2023-06-21 00:00:11 +00:00
|
|
|
name: Test & Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
|
2024-05-05 14:02:27 +00:00
|
|
|
# pull_request:
|
|
|
|
# branches:
|
|
|
|
# - master
|
2023-06-21 00:00:11 +00:00
|
|
|
|
2024-05-05 08:38:50 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2023-06-21 00:00:11 +00:00
|
|
|
jobs:
|
|
|
|
linux:
|
|
|
|
runs-on: ubuntu-latest
|
2024-05-05 08:38:50 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # ability to mint the OIDC token permission is necessary to persist the attestation
|
|
|
|
contents: read
|
|
|
|
attestations: write # persist the attestation
|
2023-06-21 00:00:11 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
platform: [ 'x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu' ]
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-06-10 22:51:08 +00:00
|
|
|
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
egress-policy: block
|
|
|
|
allowed-endpoints: >
|
|
|
|
api.github.com:443
|
2023-11-20 22:55:15 +00:00
|
|
|
cdn.quay.io:443
|
|
|
|
cdn01.quay.io:443
|
|
|
|
cdn02.quay.io:443
|
2023-06-21 00:00:11 +00:00
|
|
|
cdn03.quay.io:443
|
|
|
|
crates.io:443
|
2023-11-20 22:55:15 +00:00
|
|
|
files.pythonhosted.org:443
|
|
|
|
ghcr.io:443
|
2023-06-21 00:00:11 +00:00
|
|
|
github.com:443
|
2023-11-20 22:55:15 +00:00
|
|
|
index.crates.io:443
|
2023-06-21 00:00:11 +00:00
|
|
|
objects.githubusercontent.com:443
|
2023-11-20 22:55:15 +00:00
|
|
|
pkg-containers.githubusercontent.com:443
|
|
|
|
pypi.org:443
|
2023-06-21 00:00:11 +00:00
|
|
|
quay.io:443
|
|
|
|
sh.rustup.rs:443
|
|
|
|
static.crates.io:443
|
|
|
|
static.rust-lang.org:443
|
2024-05-05 08:38:50 +00:00
|
|
|
uploads.github.com:443
|
2023-06-21 00:00:11 +00:00
|
|
|
|
2024-06-17 22:56:59 +00:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
2024-04-01 23:04:13 +00:00
|
|
|
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
architecture: x64
|
|
|
|
|
2024-07-01 22:59:55 +00:00
|
|
|
- uses: PyO3/maturin-action@2c5c1560848aaa364c3545136054932db5fa27b7
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
manylinux: auto
|
|
|
|
target: ${{ matrix.platform }}
|
|
|
|
command: build
|
2023-11-20 22:55:15 +00:00
|
|
|
args: --release --sdist -o dist -i 3.8 3.9 3.10 3.11 3.12
|
2023-06-21 00:00:11 +00:00
|
|
|
|
|
|
|
- name: Upload wheels
|
2024-04-22 23:35:55 +00:00
|
|
|
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
2024-05-05 14:02:27 +00:00
|
|
|
name: wheels-linux-${{ matrix.platform }}
|
2023-06-21 00:00:11 +00:00
|
|
|
path: dist
|
|
|
|
|
|
|
|
windows:
|
|
|
|
runs-on: windows-latest
|
2024-05-05 08:38:50 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # ability to mint the OIDC token permission is necessary to persist the attestation
|
|
|
|
contents: read
|
|
|
|
attestations: write # persist the attestation
|
2023-06-21 00:00:11 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target: [x64]
|
2023-11-01 05:58:18 +00:00
|
|
|
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
2023-06-21 00:00:11 +00:00
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-06-10 22:51:08 +00:00
|
|
|
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
2024-05-05 08:38:50 +00:00
|
|
|
egress-policy: audit
|
2023-06-21 00:00:11 +00:00
|
|
|
|
2024-06-17 22:56:59 +00:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
2024-04-01 23:04:13 +00:00
|
|
|
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
2024-07-01 22:59:55 +00:00
|
|
|
- uses: PyO3/maturin-action@2c5c1560848aaa364c3545136054932db5fa27b7
|
2023-06-21 00:00:11 +00:00
|
|
|
env:
|
|
|
|
PYO3_PYTHON: python${{ matrix.python-version }}
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release -o dist
|
|
|
|
|
|
|
|
- name: Upload wheels
|
2024-04-22 23:35:55 +00:00
|
|
|
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
2024-05-05 14:02:27 +00:00
|
|
|
name: wheels-windows-${{ matrix.python-version }}-${{ matrix.target }}
|
2023-06-21 00:00:11 +00:00
|
|
|
path: dist
|
|
|
|
|
|
|
|
macos:
|
|
|
|
runs-on: macos-latest
|
2024-05-05 08:38:50 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # ability to mint the OIDC token permission is necessary to persist the attestation
|
|
|
|
contents: read
|
|
|
|
attestations: write # persist the attestation
|
2023-06-21 00:00:11 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-11-01 05:58:18 +00:00
|
|
|
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
2023-11-20 22:55:15 +00:00
|
|
|
target: ['universal2', 'x86_64-apple-darwin']
|
2023-06-21 00:00:11 +00:00
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-06-10 22:51:08 +00:00
|
|
|
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
|
|
|
|
2024-06-17 22:56:59 +00:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
2024-04-01 23:04:13 +00:00
|
|
|
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
2023-11-20 22:55:15 +00:00
|
|
|
- name: Build wheels - ${{ matrix.target }}
|
2024-07-01 22:59:55 +00:00
|
|
|
uses: PyO3/maturin-action@2c5c1560848aaa364c3545136054932db5fa27b7
|
2023-06-21 00:00:11 +00:00
|
|
|
env:
|
|
|
|
PYO3_PYTHON: python${{ matrix.python-version }}
|
|
|
|
with:
|
2023-11-20 22:55:15 +00:00
|
|
|
target: ${{ matrix.target }}
|
2023-06-21 00:00:11 +00:00
|
|
|
command: build
|
|
|
|
args: --release -o dist
|
|
|
|
|
|
|
|
- name: Upload wheels
|
2024-04-22 23:35:55 +00:00
|
|
|
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
2024-05-05 14:02:27 +00:00
|
|
|
name: wheels-macos-${{ matrix.python-version }}-${{ matrix.target }}
|
2023-06-21 00:00:11 +00:00
|
|
|
path: dist
|
|
|
|
|
|
|
|
python-release-github:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [ macos, windows, linux ]
|
|
|
|
permissions:
|
|
|
|
contents: write # To add assets to a release.
|
2024-05-05 14:02:27 +00:00
|
|
|
checks: write
|
|
|
|
packages: write
|
2023-06-21 00:00:11 +00:00
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-06-10 22:51:08 +00:00
|
|
|
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.1.0
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
disable-sudo: true
|
|
|
|
egress-policy: block
|
|
|
|
allowed-endpoints: >
|
|
|
|
api.github.com:443
|
|
|
|
github.com:443
|
|
|
|
uploads.github.com:443
|
2023-11-20 22:55:15 +00:00
|
|
|
static.rust-lang.org:443
|
2023-06-21 00:00:11 +00:00
|
|
|
|
2024-06-17 22:56:59 +00:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.head_ref }}
|
|
|
|
|
2024-06-17 22:58:34 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
2024-05-05 08:38:50 +00:00
|
|
|
toolchain: "1.73.0"
|
2023-06-21 00:00:11 +00:00
|
|
|
|
|
|
|
- name: Set up Python 3.8
|
2024-04-01 23:04:13 +00:00
|
|
|
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
|
2024-04-30 03:31:22 +00:00
|
|
|
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
path: wheels
|
2024-05-05 08:38:50 +00:00
|
|
|
pattern: wheels-*
|
|
|
|
merge-multiple: true
|
2023-06-21 00:00:11 +00:00
|
|
|
|
|
|
|
- name: Upload release binaries
|
2024-05-05 14:02:27 +00:00
|
|
|
uses: alexellis/upload-assets@13926a61cdb2cb35f5fdef1c06b8b591523236d3 # 0.4.1
|
2023-06-21 00:00:11 +00:00
|
|
|
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
|
2024-06-10 22:51:08 +00:00
|
|
|
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
2024-05-05 08:38:50 +00:00
|
|
|
egress-policy: audit
|
2023-06-21 00:00:11 +00:00
|
|
|
|
2024-04-30 03:31:22 +00:00
|
|
|
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
path: wheels
|
2024-05-05 08:38:50 +00:00
|
|
|
pattern: wheels-*
|
|
|
|
merge-multiple: true
|
2023-06-21 00:00:11 +00:00
|
|
|
|
|
|
|
- name: Publish package distributions to Test PyPI
|
2024-06-17 22:57:26 +00:00
|
|
|
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
repository-url: https://test.pypi.org/legacy/
|
|
|
|
packages-dir: wheels/
|
|
|
|
skip-existing: true
|
|
|
|
|
|
|
|
- name: Publish package distributions to PyPI
|
|
|
|
if: always()
|
2024-06-17 22:57:26 +00:00
|
|
|
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
packages-dir: wheels/
|
|
|
|
skip-existing: true
|