From b3d90337804631712f6896e6c7cd22544a535362 Mon Sep 17 00:00:00 2001 From: Joseph Guhlin Date: Wed, 8 Jan 2025 09:04:50 +1300 Subject: [PATCH] more CI fixes --- .../build-test-rust-minimappers2.yaml | 84 +++++++++++++------ .github/workflows/create-python-release.yaml | 25 +++++- 2 files changed, 80 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-test-rust-minimappers2.yaml b/.github/workflows/build-test-rust-minimappers2.yaml index 9024688..248edde 100644 --- a/.github/workflows/build-test-rust-minimappers2.yaml +++ b/.github/workflows/build-test-rust-minimappers2.yaml @@ -4,41 +4,73 @@ on: pull_request: branches: [ "main" ] paths: - - 'minimappers2/src/' - - 'minimappers2/Cargo.toml' + - minimappers2/src/ + - minimappers2/Cargo.toml + - minimappers2/** + - .github/workflows/build-test-rust-minimappers2.yaml + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: + RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down + RUST_BACKTRACE: 1 + PYTHONUTF8: 1 CARGO_TERM_COLOR: always +defaults: + run: + working-directory: minimappers2 + shell: bash + jobs: - test: - runs-on: ubuntu-latest + test-python: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: ['3.9', '3.12', '3.13'] + include: + - os: windows-latest + python-version: '3.13' steps: - uses: actions/checkout@v4 with: submodules: 'recursive' - - run: cd minimappers2 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Create virtual environment + env: + BIN: ${{ matrix.os == 'windows-latest' && 'Scripts' || 'bin' }} + run: | + python -m venv .venv + echo "$GITHUB_WORKSPACE/minimappers2/.venv/$BIN" >> $GITHUB_PATH + echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/minimappers2/.venv" >> $GITHUB_ENV + + - name: Set up Rust + run: rustup show + + - name: Cache Rust + uses: Swatinem/rust-cache@v2 + with: + workspaces: minimappers2 + save-if: ${{ github.ref_name == 'main' }} + + - name: Install Python dependencies + run: | + pip install uv + uv pip install maturin + + - name: Install minimappers2 + run: maturin develop + - name: Build run: cargo build --verbose + - name: Run tests - run: cargo test --verbose - - build-manylinux-x64_64: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - - name: Test build - uses: messense/maturin-action@v1 - env: - RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma - with: - rust-toolchain: nightly-2025-01-08 - maturin-version: '1.8.0' - command: build - args: -m minimappers2/Cargo.toml \ No newline at end of file + run: cargo test --verbose \ No newline at end of file diff --git a/.github/workflows/create-python-release.yaml b/.github/workflows/create-python-release.yaml index d429940..ef358f6 100644 --- a/.github/workflows/create-python-release.yaml +++ b/.github/workflows/create-python-release.yaml @@ -3,14 +3,33 @@ name: Create Python release on: - push: - tags: - - py-* + workflow_dispatch: + inputs: + # Latest commit to include with the release. If omitted, use the latest commit on the main branch. + sha: + description: Commit SHA + type: string + # Create the sdist and build the wheels, but do not publish to PyPI / GitHub. + dry-run: + description: Dry run + type: boolean + default: false + +env: + PYTHON_VERSION: '3.9' + PYTHON_VERSION_WIN_ARM64: '3.11' # ARM64 Windows doesn't have older versions + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + RUSTUP_MAX_RETRIES: 10 defaults: run: shell: bash +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: manylinux-x64_64: runs-on: ubuntu-latest