Skip to content

Commit

Permalink
chore: Update the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero committed Dec 26, 2024
1 parent 43c9cd1 commit e09a224
Showing 1 changed file with 14 additions and 206 deletions.
220 changes: 14 additions & 206 deletions .github/workflows/wot-discovery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v4

- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
Expand All @@ -46,7 +45,7 @@ jobs:
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
Expand All @@ -65,45 +64,6 @@ jobs:
clippy_flags: --all-targets -- -D warnings
reporter: github-pr-review

static-code-analysis:

env:
RCA_LINK: https://github.com/mozilla/rust-code-analysis/releases/download
RCA_VERSION: v0.0.25

strategy:
matrix:
conf:
- ubuntu
include:
- conf: ubuntu
platform: ubuntu-latest
dir: $PWD

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3

- name: Install rust-code-analysis on Ubuntu
if: matrix.conf == 'ubuntu'
run: |
mkdir -p $HOME/.local/bin
curl -L "$RCA_LINK/$RCA_VERSION/rust-code-analysis-linux-cli-x86_64.tar.gz" |
tar xz -C $HOME/.local/bin
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run rust-code-analysis
run: |
mkdir $HOME/rca-json
rust-code-analysis-cli --metrics -O json --pr -o "$HOME/rca-json" -p ${{ matrix.dir }}
- name: Upload rust-code-analysis json
uses: actions/upload-artifact@v3
with:
name: rca-json-${{ matrix.conf }}
path: ~/rca-json

################################## BUILD AND DOCS LAYER ########################

build:
Expand All @@ -117,7 +77,7 @@ jobs:
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
Expand All @@ -138,7 +98,7 @@ jobs:
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
Expand All @@ -157,7 +117,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
Expand All @@ -167,7 +127,7 @@ jobs:
- name: Install grcov
env:
GRCOV_LINK: https://github.com/mozilla/grcov/releases/download
GRCOV_VERSION: v0.8.13
GRCOV_VERSION: v0.8.20
run: |
curl -L "$GRCOV_LINK/$GRCOV_VERSION/grcov-x86_64-unknown-linux-musl.tar.bz2" |
tar xj -C $HOME/.cargo/bin
Expand Down Expand Up @@ -198,79 +158,16 @@ jobs:
with:
files: lcov.info

weighted-code-coverage-ubuntu:

needs: [build, docs]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Install grcov
env:
GRCOV_LINK: https://github.com/mozilla/grcov/releases/download
GRCOV_VERSION: v0.8.13
GRCOV_BINARY: grcov-x86_64-unknown-linux-musl.tar.bz2
run: |
curl -L "$GRCOV_LINK/$GRCOV_VERSION/$GRCOV_BINARY" |
tar xj -C $HOME/.cargo/bin
- name: Install weighted-code-coverage
env:
WCC_LINK: https://github.com/SoftengPoliTo/weighted-code-coverage/releases/download
WCC_VERSION: v0.2.0
WCC_BINARY: weighted-code-coverage-0.2.0-x86_64-unknown-linux-gnu.tar.gz
run: |
curl -L "$WCC_LINK/$WCC_VERSION/$WCC_BINARY" |
tar xz -C $HOME/.cargo/bin
- name: Install llvm-tools-preview
run: |
rustup component add llvm-tools-preview
# Not necessary on a newly created image, but strictly advised
- name: Run cargo clean
run: |
cargo clean
- name: Run tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "wot-td-%p-%m.profraw"
run: |
cargo test --verbose
- name: Run grcov
run: |
grcov . --binary-path ./target/debug/ -t coveralls -s . --token YOUR_COVERALLS_TOKEN > coveralls.json
- name: Run weighted-code-coverage
run: |
mkdir $HOME/wcc-output
weighted-code-coverage -p src/ -j coveralls.json -c cyclomatic --json $HOME/wcc-output/out.json
- name: Upload weighted-code-coverage data
uses: actions/upload-artifact@v3
with:
name: weighted-code-coverage-ubuntu
path: ~/wcc-output/out.json

################################## DEPENDENCY LAYER ###########################

audit-ubuntu:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Check dependencies changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
Expand All @@ -285,52 +182,29 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

deny-ubuntu:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v4
- name: Check dependencies changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
cargo:
- 'Cargo.toml'
- 'Cargo.lock'
- name: Install Rust stable
if: steps.changes.outputs.cargo == 'true'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Install cargo-deny
if: steps.changes.outputs.cargo == 'true'
env:
DENY_LINK: https://github.com/EmbarkStudios/cargo-deny/releases/download
DENY_VERSION: 0.13.7
run: |
curl -L "$DENY_LINK/$DENY_VERSION/cargo-deny-$DENY_VERSION-x86_64-unknown-linux-musl.tar.gz" |
tar xz -C $HOME/.cargo/bin --strip-components 1
- name: Run cargo-deny
if: steps.changes.outputs.cargo == 'true'
run: |
cargo deny init
cargo deny check bans
# cargo deny check licenses
- uses: EmbarkStudios/cargo-deny-action@v2

udeps-ubuntu:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Check dependencies changes
uses: dorny/paths-filter@v2
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
Expand All @@ -348,7 +222,7 @@ jobs:
if: steps.changes.outputs.cargo == 'true'
env:
UDEPS_LINK: https://github.com/est31/cargo-udeps/releases/download
UDEPS_VERSION: v0.1.35
UDEPS_VERSION: v0.1.53
run: |
curl -L "$UDEPS_LINK/$UDEPS_VERSION/cargo-udeps-$UDEPS_VERSION-x86_64-unknown-linux-gnu.tar.gz" |
tar xz -C $HOME/.cargo/bin --strip-components 2
Expand All @@ -358,69 +232,3 @@ jobs:
run: |
cargo +nightly udeps --all-targets
################################## CACHE LEVEL #################################

cache-level-ubuntu:

needs: [audit-ubuntu, deny-ubuntu, udeps-ubuntu]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
components: rust-src

- name: Cache produced data
id: cache-data
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }}

- name: Install cargo-careful
if: steps.cache-data.outputs.cache-hit != 'true'
run: |
cargo install cargo-careful
################################## UNSAFE CHECKS LEVEL #########################
careful-ubuntu:

needs: cache-level-ubuntu

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
components: rust-src

- name: Cache produced data
id: cache-data
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }}

- name: Run cargo-careful
run: |
cargo +nightly careful test
# cargo +nightly careful run

0 comments on commit e09a224

Please sign in to comment.