Skip to content

Commit

Permalink
Add code coverage tools and related gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisllontop committed Jun 8, 2024
1 parent 7addbb5 commit 5bc2ec5
Show file tree
Hide file tree
Showing 6 changed files with 1,068 additions and 110 deletions.
50 changes: 1 addition & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,52 +15,4 @@ concurrency:

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Start Services
run: |
docker-compose up -d
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt, clippy

- uses: swatinem/[email protected]

- name: Rust fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features

- name: Build release
uses: actions-rs/cargo@v1
with:
command: build
args: --all --release --all-features

- name: Run Test
uses: actions-rs/cargo@v1
with:
command: test
args: --release --all-features --coverage

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
uses: ./.github/workflows/workflow-common.yml@main
45 changes: 2 additions & 43 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,7 @@ on:

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Start services
run: |
docker-compose up -d
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy

- uses: swatinem/[email protected]

- name: Run fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features

- name: Run Tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all

- name: Build Release
uses: actions-rs/cargo@v1
with:
command: build
args: --release
uses: ./.github/workflows/test.yml@main

publish_to_cargo:
needs: build_and_test
Expand All @@ -69,4 +28,4 @@ jobs:
with:
command: publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and Test

on:
workflow_call:

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Start Services
run: |
docker-compose up -d
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt, clippy

- uses: swatinem/[email protected]

- name: Rust fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features

- name: Run tests with coverage
run: cargo tarpaulin --out Xml --output-dir coverage

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
# IDES
.vscode
.idea
.fleet
.fleet
/build_rs_cov.profraw
coverage/
Loading

0 comments on commit 5bc2ec5

Please sign in to comment.