Fix ci_bw env vars and packages #580
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v** | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build_wheel_linux: | |
| name: Build wheel on linux ${{ matrix.arch }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| #- arch: aarch64 # This is too slow on github CI | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ${{ runner.temp }}/cargo_build | |
| ${{ runner.temp }}/cargo_home | |
| key: linux-wheel-cache-rust-build-cargo-v1-${{ matrix.arch}} | |
| - uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.10" | |
| - name: wheels Linux ${{ matrix.arch }} | |
| uses: pypa/cibuildwheel@v2.22.0 | |
| env: | |
| CARGO_TARGET_DIR: "/host${{ runner.temp }}/cargo_build" | |
| CARGO_HOME: "/host${{ runner.temp }}/cargo_home" | |
| CIBW_PLATFORM: "linux" | |
| CIBW_ENVIRONMENT_LINUX: "SCALIB_NTL=1 RUST_BACKTRACE=1 SCALIB_X86_64_V3=1" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-wheel_linux-${{ matrix.arch }} | |
| path: ./wheelhouse/*.whl | |
| checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.13" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.5.13" | |
| - name: Install Tox | |
| run: uv tool install tox --with tox-uv | |
| - name: Formatting | |
| run: make codestyle | |
| - name: Docs | |
| run: make docs-ci | |
| test: | |
| name: Run tests (on linux). | |
| needs: [build_wheel_linux] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.10", "3.13"] | |
| env: | |
| VIRTUAL_ENV: "./.venv" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: dist-wheel_linux-* | |
| merge-multiple: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.5.13" | |
| - name: Create venv | |
| run: uv venv $VIRTUAL_ENV | |
| - name: Install venv | |
| run: | | |
| cp tests/requirements.txt reqs.txt | |
| echo dist/scalib*manylinux*.whl >> reqs.txt | |
| uv pip install -r reqs.txt | |
| - name: Run tests | |
| run: SCALIB_TEST_NTL=1 $VIRTUAL_ENV/bin/pytest | |
| test_mindeps: | |
| name: Run tests (on linux) - minimum dependency versions. | |
| needs: [build_wheel_linux] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.10"] | |
| env: | |
| VIRTUAL_ENV: "./.venv" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: dist-wheel_linux-* | |
| merge-multiple: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.5.13" | |
| - name: Create venv | |
| run: uv venv $VIRTUAL_ENV | |
| - name: Install venv | |
| run: | | |
| cp tests/requirements.txt reqs.txt | |
| echo dist/scalib*manylinux*.whl >> reqs.txt | |
| uv pip install --resolution lowest-direct -r reqs.txt | |
| - name: Run tests | |
| run: SCALIB_TEST_NTL=1 $VIRTUAL_ENV/bin/pytest | |
| # Separate job because debug build. | |
| rust_tests: | |
| name: Run rust tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ${{ runner.temp }}/cargo_build | |
| ${{ runner.temp }}/cargo_home | |
| key: linux-wheel-cache-rust-build-cargo-v1-${{ matrix.arch}} | |
| # Even though we don't explicitly run python, we install it to be | |
| # sure that PyO3 can build properly (if needed). | |
| - uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.13" | |
| - name: Run tests | |
| run: cargo test --workspace --manifest-path src/scalib_ext/Cargo.toml | |
| env: | |
| CARGO_TARGET_DIR: "${{ runner.temp }}/cargo_build" | |
| CARGO_HOME: "${{ runner.temp }}/cargo_home" | |
| RUST_BACKTRACE: "1" | |
| build_wheel_windows: | |
| name: Build wheel on Windows | |
| runs-on: windows-2025 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ${{ runner.temp }}/cargo_build | |
| ${{ runner.temp }}/cargo_home | |
| key: windows-wheel-cache-rust-build-cargo-v1-${{ matrix.arch}} | |
| - uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.10" | |
| - name: wheels Windows ${{ matrix.arch}} | |
| uses: pypa/cibuildwheel@v2.22.0 | |
| env: | |
| CARGO_TARGET_DIR: "${{ runner.temp }}\\cargo_build" | |
| CARGO_HOME: "${{ runner.temp }}\\cargo_home" | |
| CIBW_PLATFORM: "windows" | |
| CIBW_TEST_COMMAND: pytest {project}/tests | |
| CIBW_TEST_REQUIRES: "-r tests/requirements.txt" | |
| CIBW_ENVIRONMENT: "RUST_BACKTRACE=1 SCALIB_X86_64_V3=1" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-wheel_windows-${{ matrix.arch }} | |
| path: ./wheelhouse/*.whl | |
| build_wheel_macos: | |
| name: Build wheels on Mac Os (${{ matrix.vers }}) | |
| # macos-13 is on x86_64 and macos-14 is on arm64 | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - vers: arm64 | |
| os: macos-14 | |
| - vers: x86_64 | |
| os: macos-13 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ${{ runner.temp }}/cargo_build | |
| ${{ runner.temp }}/cargo_home | |
| key: macos-wheel-cache-rust-build-cargo-v1-${{ matrix.arch}} | |
| - uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.10" | |
| - name: wheels Mac Os ${{ matrix.vers }} | |
| uses: pypa/cibuildwheel@v2.22.0 | |
| env: | |
| CARGO_TARGET_DIR: "${{ runner.temp }}\\cargo_build" | |
| CARGO_HOME: "${{ runner.temp }}\\cargo_home" | |
| CIBW_PLATFORM: "macos" | |
| CIBW_TEST_COMMAND: pytest {project}/tests | |
| CIBW_TEST_REQUIRES: "-r tests/requirements.txt" | |
| CIBW_ARCHS_MACOS: "${{ matrix.vers}}" | |
| CIBW_ENVIRONMENT_MACOS: "SCALIB_X86_64_V3=0 MACOSX_DEPLOYMENT_TARGET=10.12" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-wheel_macos-${{ matrix.vers }} | |
| path: ./wheelhouse/*.whl | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Build sdist | |
| run: | | |
| python -m pip install build | |
| python -m build --sdist . | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-src | |
| path: dist/*.tar.gz | |
| check_dist: | |
| needs: | |
| [build_wheel_linux, build_wheel_windows, build_wheel_macos, build_sdist] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: dist-* | |
| merge-multiple: true | |
| - name: Install twine | |
| run: | | |
| pip install -U packaging # Workaround for broken twine dependency | |
| pip install twine | |
| - name: Check dist | |
| run: twine check dist/* | |
| release: | |
| needs: [check_dist, test, test_mindeps, checks] | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/scalib | |
| permissions: | |
| contents: write # IMPORTANT: mandatory for making GitHub Releases | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: dist-* | |
| merge-multiple: true | |
| - name: Copy release artifacts | |
| run: >- | |
| cp -r dist dist_github | |
| - name: Sign the dists with Sigstore | |
| uses: sigstore/gh-action-sigstore-python@v3.0.0 | |
| with: | |
| inputs: >- | |
| ./dist_github/*.tar.gz | |
| ./dist_github/*.whl | |
| - name: Create GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: >- | |
| gh release create | |
| "$GITHUB_REF_NAME" | |
| --repo "$GITHUB_REPOSITORY" | |
| --notes "View the CHANGELOG.rst for full changes." | |
| - name: Upload artifact signatures to GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| # Upload to GitHub Release using the `gh` CLI. | |
| # `dist/` contains the built packages, and the | |
| # sigstore-produced signatures and certificates. | |
| run: >- | |
| gh release upload | |
| "$GITHUB_REF_NAME" dist_github/** | |
| --repo "$GITHUB_REPOSITORY" | |
| - name: "PyPI release" | |
| uses: pypa/gh-action-pypi-publish@release/v1 |