Skip to content

Commit

Permalink
chore: Make the CI even leaner
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero committed Dec 26, 2024
1 parent 65d868f commit 9303a6a
Showing 1 changed file with 0 additions and 117 deletions.
117 changes: 0 additions & 117 deletions .github/workflows/wot-serve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,120 +107,3 @@ jobs:
uses: codecov/codecov-action@v3
with:
files: lcov.info

- name: Get total coverage
run: |
grcov . --binary-path ./target/debug/ -s . -t covdir --branch \
--token YOUR_COVDIR_TOKEN --ignore-not-existing --ignore "/*" \
--ignore "../*" > covdir.json
- name: Evaluate code coverage value
shell: bash
run: |
# Retrieve code coverage associated to the repository
FLOAT_COVERAGE=$(jq '.coveragePercent' covdir.json)
# Round the float value to the nearest value
COVERAGE_OUTPUT=$(printf "%.0f" $FLOAT_COVERAGE)
# If code coverage >= 80, green traffic light
if [ $COVERAGE_OUTPUT -ge 80 ]
then
echo "$COVERAGE_OUTPUT > 80 --> Green"
# If code coverage is >=60 but < 80, orange traffic light
elif [ $COVERAGE_OUTPUT -ge 60 ]
then
echo "60 <= $COVERAGE_OUTPUT < 80 --> Orange"
# Otherwise, red traffic light
else
echo "$COVERAGE_OUTPUT < 60 --> Red"
exit 1
fi
static-code-analysis:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install rust-code-analysis
env:
RCA_LINK: https://github.com/mozilla/rust-code-analysis/releases/download
RCA_VERSION: v0.0.23
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
# FIXME: Update rca version to analyze the entire directory of a repo
rust-code-analysis-cli --metrics -O json --pr -o "$HOME/rca-json" -p src/
- name: Upload rust-code-analysis json
uses: actions/upload-artifact@v3
with:
name: rca-json-ubuntu
path: ~/rca-json

weighted-code-coverage:

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.7
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/giovannitangredi/weighted-code-coverage/releases/download
WCC_VERSION: v0.1.0
WCC_BINARY: weighted-code-coverage-0.1.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-serve-%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 --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

0 comments on commit 9303a6a

Please sign in to comment.