Skip to content

Commit 9456a6b

Browse files
authored
Merge pull request #617 from EnergySystemsModellingLab/tidy-ci-workflow
Tidy CI workflow
2 parents 2cb36c2 + 08e97ec commit 9456a6b

3 files changed

Lines changed: 56 additions & 59 deletions

File tree

.github/actions/codecov/action.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Code coverage
2+
description: Generate code coverage and upload to codecov
3+
inputs:
4+
token:
5+
description: Codecov token
6+
required: true
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Install cargo-llvm-cov
12+
shell: bash
13+
run: cargo install cargo-llvm-cov
14+
15+
- name: Generate code coverage
16+
shell: bash
17+
run: cargo llvm-cov --codecov --output-path codecov.json
18+
19+
- name: Upload to codecov.io
20+
uses: codecov/codecov-action@v5
21+
with:
22+
token: ${{ inputs.token }}
23+
fail_ci_if_error: true

.github/workflows/cargo-build-and-test.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/workflows/cargo-test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Cargo Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
build_and_test:
13+
name: Run tests
14+
runs-on: ${{ matrix.os }}
15+
timeout-minutes: 15
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, windows-latest, macos-latest]
20+
include:
21+
- os: ubuntu-latest
22+
coverage: true
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions-rust-lang/setup-rust-toolchain@v1
26+
with:
27+
toolchain: stable
28+
- run: cargo test --verbose
29+
30+
- if: ${{ matrix.coverage }}
31+
uses: ./.github/actions/codecov
32+
with:
33+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)