Skip to content

Commit

Permalink
ci: refacto CI.yml to have a single matrix
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Peschke <[email protected]>
  • Loading branch information
lukapeschke committed Jan 26, 2024
1 parent 10bbdd7 commit 3bfc575
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 31 deletions.
44 changes: 14 additions & 30 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ on:

jobs:
linux:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
architecture: [x86-64, aarch64]
exclude:
- os: windows-latest
architecture: aarch64
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand All @@ -28,6 +33,13 @@ jobs:
- name: Set up rustfmt
run: rustup component add rustfmt

- name: Set Rust target for aarch64
if: matrix.architecture == 'aarch64'
id: target
run: |
TARGET=${{ matrix.os == 'macos-latest' && 'aarch64-apple-darwin' || 'aarch64-unknown-linux-gnu'}}
echo "target=$TARGET" >> $GITHUB_OUTPUT
# Maturin requires a venv to be activated, that's why we have to create one here
- name: Create virtualenv
run: |
Expand All @@ -43,32 +55,4 @@ jobs:
- name: Test
run: |
source .venv/bin/activate
make test-ci
macos:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: build (fast)
uses: messense/maturin-action@v1
with:
command: build
target: universal2-apple-darwin
args: "-o dist --interpreter python${{ matrix.python-version }}"

windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: build (fast)
uses: messense/maturin-action@v1
with:
command: build
target: x64
args: "-o dist --interpreter python${{ matrix.python-version }}"
TARGET="${{ steps.target.outputs.target }}" make test-ci
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ dev-setup: install-test-requirements install-doc-requirements
pre-commit install

dev-install:
maturin develop -E pandas,polars
if [ -z "${TARGET}" ]; then \
maturin develop -E pandas,polars; \
else \
maturin develop --target "${TARGET}" -E pandas,polars; \
fi

prod-install:
./prod_install.sh
Expand Down

0 comments on commit 3bfc575

Please sign in to comment.