ci: Fixed setup.cfg license_files key #392
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: Pipeline | |
on: | |
push: | |
branches: | |
- master | |
- hotfix/* | |
tags: | |
- v* | |
pull_request: | |
jobs: | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"] | |
config: [Release] | |
include: | |
- os: windows-latest | |
python-version: "3.12" | |
config: Debug | |
exclude: | |
- os: ubuntu-latest | |
python-version: "3.8" | |
- os: ubuntu-latest | |
python-version: "3.9" | |
- os: ubuntu-latest | |
python-version: "3.10" | |
- os: ubuntu-latest | |
python-version: "3.11" | |
- os: macos-latest | |
python-version: "3.8" | |
- os: macos-latest | |
python-version: "3.9" | |
- os: macos-latest | |
python-version: "3.10" | |
- os: macos-latest | |
python-version: "3.11" | |
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@v3 | |
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" | |
- name: Build package | |
if: ${{ matrix.config == 'Release' && (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu')) }} | |
run: | | |
pip install -U wheel setuptools | |
python setup.py ${{ startsWith(matrix.os, 'windows') && 'bdist_wheel' || 'sdist' }} | |
- name: Build manylinux binary wheel | |
if: ${{ matrix.config == 'Release' && startsWith(matrix.os, 'ubuntu') }} | |
uses: RalfG/python-wheels-manylinux-build@ff8504699f7a33a08d3ff85b3c6d4e8f0e70462b | |
with: | |
pre-build-command: "rm -rf build" | |
python-versions: "cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312" | |
- name: Upload package | |
if: ${{ matrix.config == 'Release' && (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu')) }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: package | |
path: | | |
dist/*.${{ startsWith(matrix.os, 'windows') && 'whl' || 'tar.gz' }} | |
dist/*-manylinux*.whl | |
if-no-files-found: error | |
retention-days: 7 | |
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 | |
release: | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
needs: | |
- tests | |
- asan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Downloads wheels | |
uses: actions/download-artifact@v3 | |
with: | |
name: package | |
path: package | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
- 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} |