Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
Update CI pipeline workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianEffe authored Jul 24, 2023
1 parent bfd1a2b commit 323e654
Showing 1 changed file with 94 additions and 5 deletions.
99 changes: 94 additions & 5 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,54 @@
name: Rust
name: Integration Tests

on:
pull_request:
branches: [ "master", "develop" ]
branches:
[ "master" ]

env:
CARGO_TERM_COLOR: always
SQLX_VERSION: 0.7.1
SQLX_FEATURES: "rustls,postgres"

jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Check out repository code
uses: actions/checkout@v3

- name: Install the Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Rust Cache Action
uses: Swatinem/rust-cache@v2
with:
key: sqlx-${{ env.SQLX_VERSION }}

- name: Install sqlx-cli
run:
cargo install sqlx-cli
--version=${{ env.SQLX_VERSION }}
--features ${{ env.SQLX_FEATURES }}
--no-default-features
--locked

- name: Install postgresql-client
run: sudo apt-get update && sudo apt-get install postgresql-client -y

- name: Migrate database
run: SKIP_DOCKER=true ./scripts/init_db.sh

- name: Run tests
run: cargo test

Expand All @@ -32,11 +66,66 @@ jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
key: sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli
run:
cargo install sqlx-cli
--version=${{ env.SQLX_VERSION }}
--features ${{ env.SQLX_FEATURES }}
--no-default-features
--locked
- name: Install postgresql-client
run: sudo apt-get update && sudo apt-get install postgresql-client -y
- name: Migrate database
run: SKIP_DOCKER=true ./scripts/init_db.sh
- name: Linting
run: cargo clippy -- -D warnings

coverage:
name: Code coverage
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Install postgresql-client
run: sudo apt-get update && sudo apt-get install postgresql-client -y
- uses: Swatinem/rust-cache@v2
with:
key: sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli
run:
cargo install sqlx-cli
--version=${{ env.SQLX_VERSION }}
--features ${{ env.SQLX_FEATURES }}
--no-default-features
--locked
- name: Migrate database
run: SKIP_DOCKER=true ./scripts/init_db.sh
- name: Generate code coverage
run: cargo install cargo-tarpaulin && cargo tarpaulin --verbose --workspace

0 comments on commit 323e654

Please sign in to comment.