84 lines
2.3 KiB
YAML
84 lines
2.3 KiB
YAML
name: build-libriichi
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- .github/workflows/libriichi.yml
|
|
- Cargo*
|
|
- libriichi/**
|
|
- exe-wrapper/**
|
|
pull_request:
|
|
paths:
|
|
- .github/workflows/libriichi.yml
|
|
- Cargo*
|
|
- libriichi/**
|
|
- exe-wrapper/**
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-python@v4
|
|
id: setup-python
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Run typos
|
|
uses: crate-ci/typos@v1.18.0
|
|
|
|
- name: Environment preparation
|
|
id: prep
|
|
run: |
|
|
set -x
|
|
|
|
rustup toolchain update --no-self-update stable
|
|
rustup default stable
|
|
rustup component add clippy rustfmt
|
|
rustup show
|
|
|
|
rustc --version | awk '{print $2}' | tee RUSTC_VER
|
|
echo "rustc_ver=$(cat RUSTC_VER)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache for Rust
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/bin
|
|
~/.cargo/registry/index
|
|
~/.cargo/registry/cache
|
|
~/.cargo/git/db
|
|
target
|
|
key: ${{ github.workflow }}|${{ runner.os }}|cargo|00|${{ steps.prep.outputs.rustc_ver }}|${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ github.workflow }}|${{ runner.os }}|cargo|00|${{ steps.prep.outputs.rustc_ver }}|
|
|
|
|
- name: Run rustfmt
|
|
run: cargo fmt --all --check
|
|
|
|
- name: Run clippy
|
|
run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings
|
|
|
|
- name: Run tests
|
|
run: |
|
|
cargo test --workspace --no-default-features --features flate2/zlib -- --nocapture
|
|
cargo test --workspace --no-default-features --features flate2/zlib,sp_reproduce_cpp_ver -- --nocapture
|
|
cargo test -p libriichi --no-default-features --benches
|
|
|
|
- name: Run build
|
|
run: |
|
|
cargo build -p libriichi --lib
|
|
cargo build -p libriichi --bins --no-default-features
|
|
cargo build -p exe-wrapper
|
|
|
|
- name: Check artifact
|
|
run: |
|
|
cd target/debug
|
|
ldd libriichi.so stat validate_logs exe-wrapper
|
|
python -c 'import libriichi'
|