alpkit: Add tests for from/to JSON serialization #46
This file contains 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: | |
- push | |
- pull_request | |
jobs: | |
lint: | |
name: Run linters | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- name: Set up caching | |
uses: Swatinem/rust-cache@v2 | |
- name: Run clippy linter | |
run: cargo clippy | |
- name: Run rustfmt check | |
run: cargo fmt -- --check | |
test-targets: | |
name: Test on ${{ matrix.target }} with Rust ${{ matrix.rust || 'stable' }} | |
strategy: | |
matrix: | |
include: | |
- { target: x86_64-unknown-linux-musl } | |
- { target: x86_64-unknown-linux-musl, rust: nightly } | |
- { target: x86_64-unknown-linux-musl, rust: '1.64' } # MSRV | |
- { target: x86_64-unknown-linux-gnu } | |
- { target: x86_64-apple-darwin, os: macos-latest } | |
- { target: aarch64-unknown-linux-musl } | |
- { target: aarch64-unknown-linux-gnu } | |
- { target: armv7-unknown-linux-musleabihf } | |
- { target: powerpc64le-unknown-linux-gnu } | |
- { target: riscv64gc-unknown-linux-gnu } | |
runs-on: ${{ matrix.os || 'ubuntu-latest' }} | |
env: | |
CARGO: ${{ startsWith(matrix.target, 'x86_64') && 'cargo' || 'cross' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust ${{ matrix.rust || 'stable' }} for ${{ matrix.target }} | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust || 'stable' }} | |
targets: ${{ matrix.target }} | |
- name: Set up caching | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.target }}-${{ matrix.rust || 'stable' }} | |
- name: Install cross tool | |
if: ${{ !startsWith(matrix.target, 'x86_64') }} | |
run: cargo install cross | |
- name: Build | |
run: $CARGO build --target ${{ matrix.target }} | |
- name: Run tests | |
run: $CARGO test --target ${{ matrix.target }} --verbose | |
test-x86_64-alpine-musl: | |
name: Test on x86_64-alpine-linux-musl (dynamically linked) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Alpine Linux | |
uses: jirutka/setup-alpine@v1 | |
with: | |
packages: build-base cargo zlib-ng-dev | |
- name: Build | |
run: cargo build --no-default-features --features flate2-zlib-ng,shell-timeout | |
shell: alpine.sh {0} | |
- name: Run tests | |
run: cargo test --no-default-features --features flate2-zlib-ng,shell-timeout --verbose | |
shell: alpine.sh {0} | |
test-features: | |
name: Test with --features ${{ matrix.features }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
features: | |
- shell-timeout | |
- flate2-zlib --no-default-features | |
- flate2-zlib-ng --no-default-features | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Set up caching | |
uses: Swatinem/rust-cache@v2 | |
- run: cargo build --features ${{ matrix.features }} | |
- run: cargo test --features ${{ matrix.features }} --verbose |