2023-06-21 00:00:11 +00:00
|
|
|
name: Test & Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
# on:
|
|
|
|
# pull_request:
|
|
|
|
# branches:
|
|
|
|
# - master
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
linux:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
platform: [ 'x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu' ]
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-02-05 23:01:23 +00:00
|
|
|
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142
|
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
|
|
|
uploads.github.com:443
|
|
|
|
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
|
|
|
|
|
|
|
|
- uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089
|
2023-12-20 11:22:58 +00:00
|
|
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
architecture: x64
|
|
|
|
|
2023-12-09 22:25:05 +00:00
|
|
|
- uses: PyO3/maturin-action@a3013db91b2ef2e51420cfe99ee619c8e72a17e6
|
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-02-05 23:04:27 +00:00
|
|
|
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
name: wheels
|
|
|
|
path: dist
|
|
|
|
|
|
|
|
windows:
|
|
|
|
runs-on: windows-latest
|
|
|
|
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-02-05 23:01:23 +00:00
|
|
|
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
|
|
|
|
|
|
|
- uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089
|
2023-12-20 11:22:58 +00:00
|
|
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
2023-12-09 22:25:05 +00:00
|
|
|
- uses: PyO3/maturin-action@a3013db91b2ef2e51420cfe99ee619c8e72a17e6
|
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-02-05 23:04:27 +00:00
|
|
|
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
name: wheels
|
|
|
|
path: dist
|
|
|
|
|
|
|
|
macos:
|
|
|
|
runs-on: macos-latest
|
|
|
|
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-02-05 23:01:23 +00:00
|
|
|
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
|
|
|
|
|
|
|
- uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089
|
2023-12-20 11:22:58 +00:00
|
|
|
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
|
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 }}
|
2023-12-09 22:25:05 +00:00
|
|
|
uses: PyO3/maturin-action@a3013db91b2ef2e51420cfe99ee619c8e72a17e6
|
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-02-05 23:04:27 +00:00
|
|
|
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
name: wheels
|
|
|
|
path: dist
|
|
|
|
|
|
|
|
python-release-github:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [ macos, windows, linux ]
|
|
|
|
permissions:
|
|
|
|
contents: write # To add assets to a release.
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-02-05 23:01:23 +00:00
|
|
|
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # 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
|
|
|
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
|
|
with:
|
|
|
|
ref: ${{ github.head_ref }}
|
|
|
|
|
2023-12-20 11:24:09 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
2023-11-19 00:05:00 +00:00
|
|
|
toolchain: 1.73.0
|
2023-06-21 00:00:11 +00:00
|
|
|
|
|
|
|
- name: Set up Python 3.8
|
2023-12-20 11:22:58 +00:00
|
|
|
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
|
2024-01-15 22:20:44 +00:00
|
|
|
- uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
name: wheels
|
|
|
|
path: wheels
|
|
|
|
|
|
|
|
- name: Upload release binaries
|
|
|
|
uses: alexellis/upload-assets@259de5111cb56966d046ced998941e93f91d2c93
|
|
|
|
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-02-05 23:01:23 +00:00
|
|
|
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
|
|
|
|
|
2024-01-15 22:20:44 +00:00
|
|
|
- uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
name: wheels
|
|
|
|
path: wheels
|
|
|
|
|
|
|
|
- name: Publish package distributions to Test PyPI
|
2023-12-09 22:25:24 +00:00
|
|
|
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # v1.8.11
|
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()
|
2023-12-09 22:25:24 +00:00
|
|
|
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # v1.8.11
|
2023-06-21 00:00:11 +00:00
|
|
|
with:
|
|
|
|
packages-dir: wheels/
|
|
|
|
skip-existing: true
|