Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage config #40

Merged
merged 14 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 10 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,15 @@ on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
build:
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: --verbose --all --release --all-features
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

- name: Run Test
uses: actions-rs/cargo@v1
with:
command: test
args: --release --all-features
jobs:
test:
uses: ./.github/workflows/test.yml
secrets: inherit
47 changes: 3 additions & 44 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,8 @@ on:
- created

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
test:
uses: ./.github/workflows/test.yml

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 }}
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Test

on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: true

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: Install Tarpaulin
run: cargo install cargo-tarpaulin

- 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 }}
file: ./coverage/cobertura.xml
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
Loading