Fix dockerfile (#340) #5
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: | |
branches: | |
- main | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
# - beta | |
# - nightly | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- name: Cache Docker layers | |
id: image-cache | |
uses: actions/cache@v1 | |
with: | |
path: ~/image-cache | |
key: image-cache-${{ runner.os }} | |
- if: steps.image-cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p ~/image-cache | |
docker pull postgres:11-alpine | |
docker save -o ~/image-cache/postgres.tar alpine | |
- if: steps.image-cache.outputs.cache-hit == 'true' | |
run: docker load -i ~/image-cache/postgres.tar | |
- uses: taiki-e/install-action@nextest | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- run: cargo build --verbose | |
- run: cargo nextest run --profile ci --workspace | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: target/nextest/ci/junit.xml | |
coverage: | |
name: Unit tests coverage | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
# - beta | |
# - nightly | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: Generate code coverage | |
run: cargo llvm-cov --all-features --workspace --lib --lcov --output-path lcov.info -- --test-threads=1 | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: lcov.info | |
fail_ci_if_error: true |