2021-07-11 10:17:02 +00:00
|
|
|
name: Test and Build Rust
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
schedule:
|
|
|
|
# Check if it works with current dependencies (weekly on Wednesday 2:32 UTC)
|
|
|
|
- cron: '32 2 * * 3'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
services:
|
|
|
|
# Label used to access the service container
|
|
|
|
postgres:
|
|
|
|
# Docker Hub image
|
|
|
|
image: postgres
|
|
|
|
# Provide the password for postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
# Set health checks to wait until postgres has started
|
|
|
|
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
|
|
|
|
steps:
|
2022-03-15 08:18:19 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-07-11 10:17:02 +00:00
|
|
|
|
|
|
|
- name: Setup Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
components: clippy
|
|
|
|
override: true
|
|
|
|
profile: minimal
|
2022-06-04 19:35:10 +00:00
|
|
|
toolchain: stable
|
2021-07-11 10:17:02 +00:00
|
|
|
|
|
|
|
- name: Run clippy
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: clippy
|
|
|
|
args: --verbose --all-targets --all-features -- -D warnings
|
|
|
|
|
|
|
|
- name: Install diesel-cli
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: install
|
|
|
|
args: diesel_cli --no-default-features --features "postgres"
|
|
|
|
|
|
|
|
- name: Setup db
|
|
|
|
run: diesel setup
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --verbose --all-features
|
|
|
|
|
2021-07-11 10:18:53 +00:00
|
|
|
- name: Run dirty tests
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --verbose --all-features -- --ignored
|
2021-07-11 10:17:02 +00:00
|
|
|
|
|
|
|
release:
|
|
|
|
name: Release x86_64-unknown-linux-gnu
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: test
|
|
|
|
|
|
|
|
steps:
|
2022-03-15 08:18:19 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-07-11 10:17:02 +00:00
|
|
|
|
|
|
|
- name: Setup Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
override: true
|
|
|
|
profile: minimal
|
|
|
|
target: x86_64-unknown-linux-gnu
|
2022-07-01 06:03:27 +00:00
|
|
|
toolchain: stable
|
2021-07-11 10:17:02 +00:00
|
|
|
|
|
|
|
- name: Build release
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release --verbose --all-features --target x86_64-unknown-linux-gnu
|