Skip to content

Replace lz4 and lzo with in-tree Rust #344

Replace lz4 and lzo with in-tree Rust

Replace lz4 and lzo with in-tree Rust #344

Workflow file for this run

name: Dissect CI
on:
push:
branches:
- main
tags:
- '*'
pull_request:
workflow_dispatch:
jobs:
ci:
uses: fox-it/dissect-workflow-templates/.github/workflows/dissect-ci-template.yml@main
secrets: inherit
with:
run-benchmarks: true
build-native:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- if: ${{ matrix.os == 'windows-11-arm' }}
run: git lfs install
- name: Create LFS file list
run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id
- name: Cache LFS
uses: actions/cache@v4
with:
path: .git/lfs
key: lfs-${{ hashFiles('.lfs-assets-id') }}-v1
- name: Pull LFS
run: git lfs pull
- if: runner.os == 'Linux' && runner.arch == 'X64'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- if: ${{ matrix.os != 'windows-11-arm' }}
run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
- if: ${{ matrix.os == 'windows-11-arm' }}
run: |
Invoke-WebRequest -Uri "https://win.rustup.rs/aarch64" -OutFile "$env:TEMP\rustup-init.exe"
& "$env:TEMP\rustup-init.exe" -y
"$env:USERPROFILE\.cargo\bin" | Out-File -Append -Encoding ascii $env:GITHUB_PATH
"CARGO_HOME=$env:USERPROFILE\.cargo" | Out-File -Append -Encoding ascii $env:GITHUB_ENV
shell: pwsh
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: python -m pip install cibuildwheel==2.23.2
- run: python -m cibuildwheel --output-dir dist
env:
CIBW_ARCHS_LINUX: ${{ runner.arch == 'X64' && 'auto ppc64le s390x' || 'auto armv7l' }}
CIBW_ARCHS_WINDOWS: ${{ runner.arch == 'X64' && 'AMD64 x86' || 'ARM64' }}
CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y
CIBW_BEFORE_ALL_WINDOWS: ${{ runner.arch == 'X64' && 'rustup target add i686-pc-windows-msvc' || '' }}
# Manually install setuptools-rust to enable building native wheels
CIBW_BEFORE_BUILD: >
python -m pip install -U setuptools>=77.0.0 setuptools_scm[toml]>=6.4.0 setuptools-rust
CIBW_BUILD_FRONTEND: "build; args: --no-isolation"
CIBW_CONFIG_SETTINGS: "--build-option=--py-limited-api=cp39"
CIBW_ENABLE: pypy
CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH"'
CIBW_ENVIRONMENT_MACOS: 'MACOSX_DEPLOYMENT_TARGET=10.12'
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
CIBW_SKIP: '*-musllinux_i686'
# Run tests
CIBW_TEST_REQUIRES: tox
CIBW_TEST_COMMAND: tox -e native -c {package}/tox.ini --installpkg {wheel}
- run: pip install abi3audit && abi3audit --strict --report dist/*-abi3-*.whl
- uses: actions/upload-artifact@v4
with:
name: packages-native-${{ matrix.os }}
path: dist/*
retention-days: 1
publish:
if: ${{ github.ref_name == 'main' || github.ref_type == 'tag' }}
needs: [ci]
runs-on: ubuntu-latest
environment: dissect_publish
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: packages-*
path: dist/
# According to the documentation, it automatically looks inside the `dist/` folder for packages.
- name: Publish package distributions to Pypi
uses: pypa/gh-action-pypi-publish@release/v1
trigger-tests:
needs: [publish]
uses: fox-it/dissect-workflow-templates/.github/workflows/dissect-ci-demand-test-template.yml@main
secrets: inherit
with:
on-demand-test: 'dissect.target'