planetwars.dev/.github/workflows/rust-tests.yml

55 lines
1.3 KiB
YAML
Raw Normal View History

2022-10-06 13:31:21 +00:00
name: Run rust tests
on: [push]
jobs:
test-rust:
runs-on: ubuntu-latest
2022-10-06 14:34:18 +00:00
services:
postgres:
image: postgres
env:
POSTGRES_DB: "planetwars-test"
POSTGRES_USER: "planetwars"
POSTGRES_PASSWORD: "planetwars"
ports:
- 5432:5432
2022-10-06 13:31:21 +00:00
steps:
- uses: actions/checkout@v2
- name: Update local toolchain
run: |
rustup update
rustup component add clippy
rustup install nightly
- name: Toolchain info
run: |
cargo --version --verbose
rustc --version
cargo clippy --version
2022-10-06 14:34:18 +00:00
2022-10-06 13:42:46 +00:00
- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
2022-10-06 14:34:18 +00:00
- name: Setup tests
run: |
docker pull python:3.10-slim-buster
2022-10-12 20:52:15 +00:00
cargo install diesel_cli --version ^2.0 || true
2022-10-06 14:34:18 +00:00
cd planetwars-server
diesel migration run --locked-schema
env:
DATABASE_URL: postgresql://planetwars:planetwars@localhost/planetwars-test
2022-10-06 13:31:21 +00:00
- name: Test
run: |
cargo check
2022-10-06 13:42:46 +00:00
cargo test