[rewrite] Rust all the things #18
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: Rust-py | |
# on: | |
# push: | |
# branches: ["main"] | |
# pull_request: | |
# branches: ["main"] | |
# jobs: | |
# build: | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# matrix: | |
# os: [ubuntu-latest] | |
# rust: [stable] | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Install Rust | |
# uses: actions-rs/toolchain@v1 | |
# with: | |
# profile: minimal | |
# toolchain: ${{ matrix.rust }} | |
# override: true | |
# components: rustfmt, clippy # , cargo-llvm-cov | |
# - name: Cache dependencies | |
# uses: actions/cache@v3 | |
# with: | |
# path: | | |
# ~/.cargo/bin/ | |
# ~/.cargo/registry/index/ | |
# ~/.cargo/registry/cache/ | |
# ~/.cargo/git/db/ | |
# target/ | |
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
# - name: Set up Python | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: "3.11.10" | |
# - name: Install maturin | |
# run: | | |
# python3 -m pip install maturin | |
# - name: Build and install python module | |
# run: | | |
# cd datago | |
# maturin build -i python3.11 --release --target "x86_64-unknown-linux-gnu" | |
# cd target/wheels | |
# python3 -m pip install --user -v *.whl | |
# - name: Run the python unit tests | |
# env: | |
# DATAROOM_API_KEY: ${{ secrets.DATAROOM_API_KEY }} | |
# DATAROOM_TEST_SOURCE: ${{ secrets.DATAROOM_TEST_SOURCE }} | |
# DATAROOM_API_URL: ${{ secrets.DATAROOM_API_URL }} | |
# run: | | |
# ls | |
# # python3 -m pip install -r requirements-tests.txt | |
# # pytest -xv python/* | |
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
linux: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: ubuntu-latest | |
target: x86_64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install openssl | |
run: | | |
sudo apt-get update | |
sudo apt-get install pkg-config libssl-dev | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist --find-interpreter | |
sccache: 'true' | |
manylinux: auto | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-${{ matrix.platform.target }} | |
path: dist | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-sdist | |
path: dist | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} | |
needs: [linux, sdist] | |
permissions: | |
# Use to sign the release artifacts | |
id-token: write | |
# Used to upload release artifacts | |
contents: write | |
# Used to generate artifact attestation | |
attestations: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: 'wheels-*/*' | |
- name: Publish to PyPI | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
with: | |
command: upload | |
args: --non-interactive --skip-existing wheels-*/* |