Fixing CI and Add DB Migrations #8
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
# Based on https://github.com/actions-rs/meta/blob/master/recipes/msrv.md | ||
on: [push, pull_request] | ||
name: MSRV | ||
jobs: | ||
# Label of the container job | ||
container-job: | ||
# Containers must run in Linux based operating systems | ||
runs-on: ubuntu-latest | ||
# Docker Hub image that `container-job` executes in | ||
container: node:10.18-jessie | ||
# 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_PASSWORD: passowrd | ||
POSTGRES_USERNAME: postgres | ||
POSTGRES_DB: newsletter | ||
# Set health checks to wait until postgres has started | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
# Maps tcp port 5432 on service container to the host | ||
- 5432:5432 | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
- 1.76.0 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
- name: Run cargo check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
test: | ||
name: Test Suite | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
- 1.76.0 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
- name: Run cargo-tarpaulin | ||
uses: actions-rs/tarpaulin@v0.1 | ||
with: | ||
version: "0.15.0" | ||
args: "-- --test-threads 1" | ||
- name: Upload to codecov.io | ||
uses: codecov/codecov-action@v1.0.2 | ||
with: | ||
token: ${{secrets.CODECOV_TOKEN}} | ||
- name: Archive code coverage results | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: code-coverage-report | ||
path: cobertura.xml | ||
fmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
- 1.76.0 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
- name: Install rustfmt | ||
run: rustup component add rustfmt | ||
- name: Run cargo fmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
clippy: | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
- 1.76.0 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
- name: Install clippy | ||
run: rustup component add clippy | ||
- name: Run cargo clippy | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -- -D warnings |