Skip to content

Commit

Permalink
refactor(ci): simplify some checks, test each feature
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Aug 13, 2024
1 parent 77381c3 commit a645a7c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 82 deletions.
39 changes: 15 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,18 @@ concurrency:
cancel-in-progress: true

jobs:
lint-test:
lint-test-all-features:
name: Lint and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: Install Pixi
run: |
curl -fsSL https://pixi.sh/install.sh | bash
Expand All @@ -36,28 +33,20 @@ jobs:
# TODO: infer from toml file/lockfile
echo "GEOS_VERSION=3.12.1" >> "$GITHUB_ENV"
echo "PKG_CONFIG_PATH=$(pwd)/build/.pixi/envs/default/lib/pkgconfig" >> "$GITHUB_ENV"
- name: Install build requirements
run: |
cd build
pixi install
- name: Fmt
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy --all-features --tests -- -D warnings
- name: Check
run: cargo check --all-features --features gdal/bindgen
- name: Test
run: cargo test --all-features

- name: Cargo fmt
run: cargo fmt --all -- --check

- name: "clippy --all"
run: cargo clippy --all --all-features --tests -- -D warnings

- name: "cargo check"
# No idea why the gdal/bindgen feature declared in dev dependencies
# isn't getting picked up.
run: cargo check --all --all-features --features gdal/bindgen

- name: "cargo test"
run: |
cargo test --all
cargo test --all --all-features
build:
test-features:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -82,8 +71,9 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Test
run: cargo check ${{ matrix.args }}
build-with-external-dependencies:
run: cargo test --lib ${{ matrix.args }}

test-with-external-dependencies:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -113,7 +103,8 @@ jobs:
cd build
pixi install
- name: Test
run: cargo build ${{ matrix.args }}
run: cargo test --lib ${{ matrix.args }}

build-benchmarks:
runs-on: ubuntu-latest
steps:
Expand Down
48 changes: 17 additions & 31 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,33 @@ jobs:
defaults:
run:
working-directory: python/core

steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: Cargo fmt
run: cargo fmt --all -- --check

# # Note not sure why this is needed
# - name: Install protobuf
# run: |
# sudo apt-get install libprotobuf-dev protobuf-compiler

# Don't use --all-features as we don't have GDAL 3.6 available in CI
- name: "clippy --all"
run: cargo clippy --all --tests -- -D warnings

- name: "cargo check"
run: cargo check --all

- name: "cargo test"
- name: Install Pixi
run: |
cargo test --all
curl -fsSL https://pixi.sh/install.sh | bash
echo "$HOME/.pixi/bin" >> $GITHUB_PATH
echo "GDAL_HOME=$(pwd)/build/.pixi/envs/default" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$(pwd)/build/.pixi/envs/default/lib" >> "$GITHUB_ENV"
echo "GEOS_LIB_DIR=$(pwd)/build/.pixi/envs/default/lib" >> "$GITHUB_ENV"
# TODO: infer from toml file/lockfile
echo "GEOS_VERSION=3.12.1" >> "$GITHUB_ENV"
echo "PKG_CONFIG_PATH=$(pwd)/build/.pixi/envs/default/lib/pkgconfig" >> "$GITHUB_ENV"
- name: Fmt
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy --tests -- -D warnings
- name: Check
run: cargo check
- name: Test
run: cargo test

# lint-python:
# name: Lint Python code
Expand Down Expand Up @@ -75,49 +71,39 @@ jobs:
defaults:
run:
working-directory: python/core

steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Check Poetry lockfile up to date
run: |
poetry check --lock
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: python/core/.venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install root project
run: poetry install --no-interaction

- name: Run python tests
run: |
poetry run maturin develop
Expand Down
35 changes: 8 additions & 27 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,62 +17,43 @@ jobs:
defaults:
run:
working-directory: js

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: Cargo fmt
run: cargo fmt --all -- --check

- name: "clippy --all"
run: cargo clippy --all --all-features --tests -- -D warnings

- name: "cargo check"
run: |
cargo check --all
cargo check --all --all-features
- name: "cargo test"
run: |
cargo test --all
cargo test --all --all-features
- name: Fmt
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy --all-features --tests -- -D warnings
- name: Check
run: cargo check --all-features
- name: Test
run: cargo test --all-features

node-test:
name: Node Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: js

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- uses: Swatinem/rust-cache@v2

- uses: actions/setup-node@v2
with:
node-version: "20"

- name: Build bundle
run: yarn build:test

- name: Install dev dependencies
run: yarn install

- name: Run Node tests
run: yarn test

0 comments on commit a645a7c

Please sign in to comment.