Skip to content

Commit

Permalink
ci: update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kod-kristoff committed Feb 3, 2024
1 parent 7368c8b commit 872571f
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 57 deletions.
124 changes: 91 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,100 @@
on:
push:
pull_request:
merge_group:

name: CI

permissions:
contents: read
jobs:

on: [pull_request, push]
coverage:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: |
cd auctioning_platform
cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-ubuntu
path: codecov.json

jobs:
build:
name: ${{ matrix.task.name }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust: [stable]
task:
- name: Check format
run: cargo fmt -- --check
allow_failure: false
- name: Clippy
run: cargo clippy
allow_failure: true
- name: Test
run: cargo test --all
allow_failure: false
upload-coverage:
name: Upload test coverage to CodeCov
needs: [coverage]
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- uses: actions/checkout@v2
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4

- name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
- name: download coverage files
uses: actions/download-artifact@v4
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
components: rustfmt, clippy
pattern: coverage-*

- name: ${{ matrix.task.name }}
run:|
- name: display files
run: |
ls -aR
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
# directory: ./coverage
# env_vars: OS,PYTHON
fail_ci_if_error: false
files: ./coverage-ubuntu/codecov.json
# flags: unittests
# name: codecov-umbrella
verbose: true
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- run: |
cd auctioning_platform
cargo fmt --check --all
lint:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: clippy
- run: |
cd auctioning_platform
${{ matrix.task.run }}
continue-on-error: ${{ matrix.task.allow_failure }}
cargo clippy -- -D warnings
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
check:
if: always()
needs: [lint, coverage, fmt]
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
allowed-failures: lint
24 changes: 0 additions & 24 deletions .github/workflows/coverage.yml

This file was deleted.

0 comments on commit 872571f

Please sign in to comment.