Skip to content

Migrate CI to build wheels via cibuildwheel + update of dependencies #449

Migrate CI to build wheels via cibuildwheel + update of dependencies

Migrate CI to build wheels via cibuildwheel + update of dependencies #449

Workflow file for this run

name: Pipeline
on:
push:
branches:
- master
- hotfix/*
tags:
- v*
pull_request:
workflow_dispatch:
inputs:
force_release:
description: "Force run also release step"
default: false
type: boolean
jobs:
tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"]
config: [Release]
include:
- os: windows-latest
python-version: "3.13"
config: Debug
exclude:
- os: ubuntu-latest
python-version: "3.9"
- os: ubuntu-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.11"
- os: ubuntu-latest
python-version: "3.12"
- os: macos-latest
python-version: "3.9"
- os: macos-latest
python-version: "3.10"
- os: macos-latest
python-version: "3.11"
- os: macos-latest
python-version: "3.12"
runs-on: ${{ matrix.os }}
steps:
- name: Setup Git
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build
env:
YARAMOD_BUILD_CONFIGURATION: ${{ matrix.config }}
YARAMOD_BUILD_WITH_UNIT_TESTS: 1
run: |
python -m pip install .
- name: Upload build directory
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}-py${{ matrix.python-version }}-${{ matrix.config }}
path: build/
- name: C++ Tests
run: |
${{ startsWith(matrix.os, 'windows') && format('build\tests\cpp\{0}\yaramod_tests.exe', matrix.config) || 'build/tests/cpp/yaramod_tests' }}
- name: Python Tests
run: |
python -m pip install pytest mypy==0.991
pytest -v tests/python
- name: Documentation
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
cd docs/rtd
pip install -r requirements.txt
make clean && make html SPHINXOPTS="-W --keep-going -n"
asan:
runs-on: ubuntu-latest
steps:
- name: Setup Git
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout sources
uses: actions/checkout@v4
- name: Build
run: |
mkdir -p build
cd build
cmake -DYARAMOD_TESTS=ON -DYARAMOD_ASAN=ON ..
cmake --build . -- -j
# Disable ASLR for this, see https://stackoverflow.com/questions/77894856/possible-bug-in-gcc-sanitizers
- name: Tests
run: |
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
./build/tests/cpp/yaramod_tests
build_sdist:
needs:
- tests
- asan
runs-on: ubuntu-latest
steps:
- name: Setup Git
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Build sdist
run: |
pip install -U setuptools
python setup.py sdist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: python-sdist
path: |
./dist/*.tar.gz
if-no-files-found: error
retention-days: 7
build_wheel:
needs:
- tests
- asan
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
platform: linux
arch: manylinux_x86_64
- runs-on: windows-latest
platform: windows
arch: win_amd64
- runs-on: macos-latest
platform: macos
arch: macosx_arm64
runs-on: ${{ matrix.runs-on }}
steps:
- name: Setup Git
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==3.1.4
- name: Build wheels
env:
CIBW_PLATFORM: ${{ matrix.platform }}
CIBW_BUILD: "cp3*-${{ matrix.arch }}"
CIBW_SKIP: "cp3?t-* cp3??t-* cp38*"
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: python-wheel-${{ matrix.platform }}-${{ matrix.arch }}-${{ strategy.job-index }}
path: |
./wheelhouse/*.whl
if-no-files-found: error
retention-days: 7
release:
if: ${{ startsWith(github.ref, 'refs/tags/v') || inputs.force_release }}
needs:
- build_sdist
- build_wheel
runs-on: ubuntu-latest
steps:
- name: Downloads wheels
uses: actions/download-artifact@v4
with:
pattern: python-*
path: package
merge-multiple: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install twine
run: |
python -m pip install -U twine packaging setuptools
- name: Upload to PyPI
run: |
twine upload --skip-existing -u __token__ -p ${{ secrets.pypi_token }} ./package/*.{whl,tar.gz}