Merge pull request #310 from vuittont60/main #647
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 | |
on: [push, pull_request] | |
jobs: | |
xtask-test-matrix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: hecrj/setup-rust-action@v1 | |
- name: Generate matrix | |
id: xtask | |
run: | | |
cargo xtask test-matrix >> "$GITHUB_OUTPUT" | |
outputs: | |
matrix: ${{ steps.xtask.outputs.test-matrix }} | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 45 | |
needs: xtask-test-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
options: ${{ fromJson(needs.xtask-test-matrix.outputs.matrix) }} | |
# Service containers to run with `runner-job` | |
services: | |
# Label used to access the service container | |
redis: | |
# Docker Hub image | |
image: redis | |
# Set health checks to wait until redis has started | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps port 6379 on service container to the host | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
- | |
name: Free disk space | |
run: | | |
sudo docker rmi $(docker image ls -aq) || true | |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc || true | |
- name: Install Rust | |
uses: hecrj/setup-rust-action@v1 | |
with: | |
rust-version: ${{ matrix.options.toolchain }} | |
components: clippy,rust-docs,rustfmt | |
- name: Run clippy | |
continue-on-error: true | |
run: | | |
cargo clippy --all-targets ${{ matrix.options.cargo_args }} -- -D warnings | |
env: | |
RUST_TOOLCHAIN: ${{ matrix.options.toolchain }} | |
- name: Run unit tests | |
run: | | |
cargo test --all-targets ${{ matrix.options.cargo_args }} -- --nocapture | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY_SECRET }} | |
S3_BUCKET: ${{ secrets.S3_BUCKET }} | |
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }} | |
RUST_TOOLCHAIN: ${{ matrix.options.toolchain }} | |
RUST_BACKTRACE: 1 | |
check-wasm: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: hecrj/setup-rust-action@v1 | |
- name: Install wasm32-unknown-unknown | |
run: | | |
rustup target add wasm32-unknown-unknown | |
- name: Run clippy | |
run: | | |
cargo clippy --target wasm32-unknown-unknown --package bonsaidb-client -- -D warnings |