name: Build
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
name: Test Suite
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.95"
components: rustfmt, clippy
- name: Install system deps (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libnetcdf-dev pkg-config
- name: Install system deps (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install netcdf
- name: Install system deps (Windows)
if: matrix.os == 'windows-latest'
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: ci
python-version: "3.11"
channels: conda-forge
channel-priority: strict
- name: Conda NetCDF + env (Windows)
if: matrix.os == 'windows-latest'
shell: bash -el {0}
run: source .github/scripts/ci-deps-windows-conda.sh
- name: Install OpenSSL (Windows)
if: runner.os == 'Windows'
run: choco install openssl -y
shell: pwsh
- name: Set OPENSSL_* (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: ./.github/scripts/ci-deps-windows-openssl.ps1
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test --verbose
msrv:
name: MSRV Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (MSRV)
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.95
- name: Install NetCDF (Ubuntu)
run: |
sudo apt-get update
sudo apt-get install -y libnetcdf-dev pkg-config
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.lock') }}
- name: Check MSRV
run: cargo check --all-targets
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.95"
- name: Install system deps (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libnetcdf-dev pkg-config
- name: Install system deps (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install netcdf
- name: Install system deps (Windows)
if: matrix.os == 'windows-latest'
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: ci
python-version: "3.11"
channels: conda-forge
channel-priority: strict
- name: Conda NetCDF + env (Windows)
if: matrix.os == 'windows-latest'
shell: bash -el {0}
run: source .github/scripts/ci-deps-windows-conda.sh
- name: Install OpenSSL (Windows)
if: runner.os == 'Windows'
run: choco install openssl -y
shell: pwsh
- name: Set OPENSSL_* (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: ./.github/scripts/ci-deps-windows-openssl.ps1
- name: Build
run: cargo build --release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ublx-${{ matrix.os }}
path: target/release/ublx*