Skip to content

Commit

Permalink
chore: update clippy and tests workflow to run only once
Browse files Browse the repository at this point in the history
  • Loading branch information
leon3s committed May 3, 2024
1 parent 2912e17 commit 98cd789
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 40 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

name: Clippy

on: [push, pull_request]
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
clippy:
Expand All @@ -20,7 +29,7 @@ jobs:
path: ./target
key: ${{ hashFiles('./Cargo.lock') }}

# Cache Rust
# Cache Rust
- uses: actions/cache@v3
with:
path: ~/.cargo
Expand Down
85 changes: 47 additions & 38 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: Tests

on: [push, pull_request]
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

env:
CARGO_TERM_COLOR: always
Expand All @@ -12,40 +21,40 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
# Install rust
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: llvm-tools-preview
# Cache tests
- uses: actions/cache@v3
with:
path: ./target/llvm-cov-target
key: llvm-cov-key
# Cache rust
- uses: Swatinem/rust-cache@v2
# Install cargo make
- uses: davidB/rust-cargo-make@v1
# Install llvm-cov
- uses: taiki-e/install-action@cargo-llvm-cov
# Install nextest
- uses: taiki-e/install-action@nextest
# Prepare server
- name: Start server
run: |
cargo build --bin metrsd
cargo make run-daemon -- --hosts tcp://0.0.0.0:8080 &
sleep 10
# Prepare CI
- name: Run tests
run: cargo make covgen
# Upload it to codecov
- name: Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./lcov.info
flags: unittests # optional
verbose: true # optional (default = false)
- uses: actions/checkout@v3
# Install rust
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: llvm-tools-preview
# Cache tests
- uses: actions/cache@v3
with:
path: ./target/llvm-cov-target
key: llvm-cov-key
# Cache rust
- uses: Swatinem/rust-cache@v2
# Install cargo make
- uses: davidB/rust-cargo-make@v1
# Install llvm-cov
- uses: taiki-e/install-action@cargo-llvm-cov
# Install nextest
- uses: taiki-e/install-action@nextest
# Prepare server
- name: Start server
run: |
cargo build --bin metrsd
cargo make run-daemon -- --hosts tcp://0.0.0.0:8080 &
sleep 10
# Prepare CI
- name: Run tests
run: cargo make covgen
# Upload it to codecov
- name: Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./lcov.info
flags: unittests # optional
verbose: true # optional (default = false)

0 comments on commit 98cd789

Please sign in to comment.