-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci]: Configure Sonarqube and Defectdojo in iroha2 CI (#4414)
* [ci]: Configure Sonarqube and Defectdojo in iroha2 CI Signed-off-by: BAStos525 <[email protected]> * [ci]: fix grcov --ignore pattern Co-authored-by: Shunkichi Sato <[email protected]> Signed-off-by: BAStos525 <[email protected]> * [ci]: take back llvm-tools-preview Signed-off-by: BAStos525 <[email protected]> --------- Signed-off-by: BAStos525 <[email protected]> Signed-off-by: BAStos525 <[email protected]> Co-authored-by: Shunkichi Sato <[email protected]>
- Loading branch information
Showing
7 changed files
with
76 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,44 +40,38 @@ jobs: | |
container: | ||
image: hyperledger/iroha2-ci:nightly-2024-01-12 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
# TODO Remove this step #2165 | ||
# - name: Adjust toolchain | ||
# run: | | ||
# rustup component add llvm-tools-preview | ||
- uses: actions/checkout@v4 | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Run tests, with coverage | ||
run: | | ||
mold --run cargo llvm-cov clean --workspace | ||
mold --run cargo llvm-cov --doc --no-report --all-features --workspace --no-fail-fast --ignore-filename-regex='(^client_cli/|main\.rs)' | ||
mold --run cargo llvm-cov --no-report --ignore-filename-regex='(^client_cli/|main\.rs)' --all-features --workspace --no-fail-fast | ||
run: mold --run cargo test --all-features --workspace --no-fail-fast | ||
env: | ||
RUSTFLAGS: "-C instrument-coverage" | ||
LLVM_PROFILE_FILE: "iroha-%p-%m.profraw" | ||
- name: Generate lcov report | ||
run: | | ||
# generate report without tests | ||
# https://github.com/taiki-e/cargo-llvm-cov#merge-coverages-generated-under-different-test-conditions | ||
mold --run cargo llvm-cov --doctests --no-run --all-features --workspace --lcov --output-path lcov.info | ||
if: always() | ||
run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/client_cli" --ignore "**/main.rs" -o lcov.info | ||
- name: Upload coverage to coveralls.io | ||
if: always() | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
file: lcov.info | ||
compare-ref: ${{ github.base_ref }} | ||
compare-sha: ${{ github.event.pull_request.base.sha}} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
# (Temporally) Add the parallel coverage upload to Codecov to compare the results with Coveralls | ||
# - name: Upload coverage to codecov.io | ||
# uses: codecov/[email protected] | ||
# with: | ||
# files: lcov.info | ||
# commit_parent: ${{ github.event.pull_request.base.sha }} | ||
# fail_ci_if_error: false | ||
- name: Upload lcov report artifact | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: lcov.info | ||
path: lcov.info | ||
|
||
integration: | ||
runs-on: [self-hosted, Linux, iroha2] | ||
container: | ||
image: hyperledger/iroha2-ci:nightly-2024-01-12 | ||
timeout-minutes: 30 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Run tests, with no-default-features | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,3 +150,51 @@ jobs: | |
with: | ||
name: telemetry | ||
path: target/telemetry | ||
|
||
sonarqube-defectdojo: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: hyperledger/iroha2-ci:nightly-2024-01-12 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Download clippy report artifact | ||
uses: dawidd6/[email protected] | ||
with: | ||
workflow: iroha2-dev-pr-static.yml | ||
name: clippy.json | ||
search_artifacts: true | ||
- name: Download lcov report artifact | ||
uses: dawidd6/[email protected] | ||
with: | ||
workflow: iroha2-dev-pr.yml | ||
name: lcov.info | ||
search_artifacts: true | ||
- name: SonarQube | ||
uses: sonarsource/sonarqube-scan-action@master | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | ||
with: | ||
args: > | ||
-Dcommunity.rust.clippy.reportPaths=clippy.json | ||
-Dcommunity.rust.lcov.reportPaths=lcov.info | ||
- name: DefectDojo | ||
id: defectdojo | ||
uses: C4tWithShell/[email protected] | ||
with: | ||
token: ${{ secrets.DEFECTOJO_TOKEN }} | ||
defectdojo_url: ${{ secrets.DEFECTOJO_URL }} | ||
product_type: iroha2 | ||
engagement: ${{ github.ref_name }} | ||
tools: "SonarQube API Import,Github Vulnerability Scan" | ||
sonar_projectKey: hyperledger:iroha | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
github_repository: ${{ github.repository }} | ||
product: ${{ github.repository }} | ||
environment: Test | ||
reports: '{"Github Vulnerability Scan": "github.json"}' | ||
- name: Show Defectdojo response | ||
if: always() | ||
run: | | ||
set -e | ||
printf '%s\n' '${{ steps.defectdojo.outputs.response }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sonar.projectKey=hyperledger:iroha |