Update stderrlog, tempfile dependencies #106
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: Tests | |
env: | |
RUST_BACKTRACE: 1 | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
SQLITE_BIN: /home/runner/.sqlite3/sqlite3 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- '**' | |
paths: | |
- 'core/src/**' | |
- 'core/tests/**' | |
- 'core/Cargo.toml' | |
- 'Cargo.lock' | |
jobs: | |
test: | |
name: Test on ${{ matrix.build }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build: [linux-amd64, ] | |
include: | |
- build: linux-amd64 | |
os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
steps: | |
- uses: actions/checkout@v2 | |
- id: cache-sqlite3-bin | |
name: Cache sqlite3 binary | |
uses: actions/cache@v3 | |
with: | |
path: /home/runner/.sqlite3 | |
key: toolchain-sqlite3 | |
- if: ${{ steps.cache-sqlite3-bin.outputs.cache-hit != 'true' }} | |
name: Download sqlite3 binary | |
run: | | |
set -ex | |
sudo apt-get install -y --quiet wget unzip | |
mkdir -p /home/runner/.sqlite3 | |
cd /home/runner/.sqlite3 | |
wget "https://sqlite.org/2023/sqlite-tools-linux-x86-3420000.zip" | |
unzip sqlite-tools-linux-x86-3420000.zip | |
mv sqlite-tools-linux-x86-3420000/* . | |
rm -rf sqlite-tools-linux-x86-3420000* | |
echo "SQLITE_BIN=$(pwd)/sqlite3" >> $GITHUB_ENV | |
- id: cache-rustup | |
name: Cache Rust toolchain | |
uses: actions/cache@v3 | |
with: | |
path: ~/.rustup | |
key: toolchain-${{ matrix.os }}-${{ matrix.rust }} | |
- if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }} | |
name: Install Rust ${{ matrix.rust }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.rust }} | |
components: clippy, rustfmt | |
target: ${{ matrix.target }} | |
override: true | |
- name: Configure cargo data directory | |
# After this point, all cargo registry and crate data is stored in | |
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files | |
# that are needed during the build process. Additionally, this works | |
# around a bug in the 'cache' action that causes directories outside of | |
# the workspace dir to be saved/restored incorrectly. | |
run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV | |
- id: cache-cargo | |
name: Cache cargo configuration and installations | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CARGO_HOME }} | |
key: cargo-${{ matrix.os }}-${{ matrix.rust }} | |
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target | |
name: Setup Rust target | |
run: | | |
mkdir -p "${{ env.CARGO_HOME }}" | |
cat << EOF > "${{ env.CARGO_HOME }}"/config.toml | |
[build] | |
target = "${{ matrix.target }}" | |
EOF | |
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target | |
name: Add lint dependencies | |
run: | | |
cargo install --target "${{ matrix.target }}" cargo-sort | |
- name: cargo-check | |
run: | | |
cargo check --all-features --all --tests --examples --benches --bins | |
- name: cargo test | |
if: success() || failure() # always run even if other steps fail, except when cancelled <https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f> | |
run: | | |
cargo test --all --no-fail-fast --all-features | |
- name: cargo-sort | |
if: success() || failure() | |
run: | | |
cargo sort --check | |
- name: rustfmt | |
if: success() || failure() | |
run: | | |
cargo fmt --check --all | |
- name: clippy | |
if: success() || failure() | |
run: | | |
cargo clippy --no-deps --all-features --all --tests --examples --benches --bins | |
- name: rustdoc | |
if: success() || failure() | |
run: | | |
make rustdoc |