|
6 | 6 | - main |
7 | 7 | jobs: |
8 | 8 | validate: |
| 9 | + name: "Validate" |
9 | 10 | runs-on: ubuntu-latest |
10 | 11 | steps: |
11 | 12 | - name: Checkout repository |
|
25 | 26 | - name: Execute Pre-Commit |
26 | 27 | run: pre-commit run --show-diff-on-failure --color=always --all-files |
27 | 28 | pyton_tests: |
| 29 | + name: "Python Tests" |
28 | 30 | runs-on: ubuntu-latest |
29 | 31 | strategy: |
30 | 32 | fail-fast: true |
@@ -58,17 +60,50 @@ jobs: |
58 | 60 | - name: Test |
59 | 61 | run: poetry run pytest |
60 | 62 | rust_tests: |
| 63 | + name: "Rust Tests" |
61 | 64 | runs-on: ubuntu-latest |
62 | 65 | steps: |
63 | 66 | - name: Checkout Repository |
64 | 67 | uses: actions/checkout@v3 |
65 | 68 | - name: Install Rust |
66 | 69 | uses: actions-rs/toolchain@v1 |
67 | 70 | with: |
68 | | - profile: minimal |
69 | 71 | toolchain: stable |
70 | 72 | override: true |
71 | | - - name: Install Rust Dependencies |
72 | | - uses: actions-rs/cargo@v1 |
| 73 | + target: x86_64-unknown-linux-musl |
| 74 | + components: llvm-tools-preview |
| 75 | + - name: Download grcov |
| 76 | + run: | |
| 77 | + mkdir -p "${HOME}/.local/bin" |
| 78 | + curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin" |
| 79 | + echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 80 | + - name: Test with Coverage |
| 81 | + run: CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw' cargo test |
| 82 | + - name: Generate Coverage Report |
| 83 | + run: mkdir coverage && grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o coverage.lcov |
| 84 | + - uses: actions/upload-artifact@v3 |
73 | 85 | with: |
74 | | - command: test |
| 86 | + name: coverage-lcov |
| 87 | + path: coverage.lcov |
| 88 | + sonar: |
| 89 | + name: "Sonar" |
| 90 | + needs: |
| 91 | + - pyton_tests |
| 92 | + - rust_tests |
| 93 | + - validate |
| 94 | + if: github.event.pull_request.head.repo.fork == false |
| 95 | + runs-on: ubuntu-latest |
| 96 | + steps: |
| 97 | + - name: Check out repository |
| 98 | + uses: actions/checkout@v3 |
| 99 | + - name: Download Artifacts |
| 100 | + uses: actions/download-artifact@v3 |
| 101 | + with: |
| 102 | + name: coverage-lcov |
| 103 | + - name: Fix coverage file for sonarcloud |
| 104 | + run: sed -i "s/home\/runner\/work\/http_utils\/src/github\/workspace/g" coverage.lcov |
| 105 | + - name: SonarCloud Scan |
| 106 | + uses: sonarsource/sonarcloud-github-action@master |
| 107 | + env: |
| 108 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 109 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
0 commit comments