Merge remote-tracking branch 'upstream/master' #40
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: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
# Label of the container job | |
container-job: | |
# Containers must run in Linux based operating systems | |
runs-on: ubuntu-latest | |
# Service containers to run with `container-job` | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_USER: pointercrate | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
# Downloads a copy of the code in your repository before running CI tests | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: llvm-tools-preview | |
- name: Install sqlx-cli | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: sqlx-cli | |
- name: Load pointercrate schema | |
uses: actions-rs/cargo@v1 | |
with: | |
command: sqlx | |
args: migrate run | |
env: | |
DATABASE_URL: postgresql://pointercrate:postgres@localhost/postgres | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
env: | |
DATABASE_URL: postgresql://pointercrate:postgres@localhost/postgres | |
RUST_BACKTRACE: 1 | |
RUSTFLAGS: -Cinstrument-coverage | |
LIST_SIZE: 75 | |
EXNTEDED_LIST_SIZE: 150 | |
- name: Install grcov | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: grcov | |
- name: Generate coverage report | |
run: grcov . -s . --binary-path ./target/debug/ -t lcov --ignore-not-existing -o ./target/debug/coverage.lcov --ignore "pointercrate-test/*" --ignore "pointercrate-example/*" --keep-only "pointercrate-*" | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: ./target/debug/coverage.lcov |