Merge pull request #17 from Arquisoft/tests #28
This file contains hidden or 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
| name: Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - run: npm --prefix users ci | |
| - run: npm --prefix webapp ci | |
| - run: npm --prefix gateway ci | |
| - name: Run users tests with MongoDB | |
| run: npm --prefix users run test:coverage | |
| env: | |
| MONGODB_URI: ${{ secrets.MONGODB_URI }} | |
| - name: Run webapp tests | |
| run: npm --prefix webapp run test:coverage | |
| - name: Run gateway tests | |
| run: npm --prefix gateway run test:coverage | |
| - name: Install cargo-llvm-cov | |
| run: cargo install cargo-llvm-cov --locked | |
| - name: Generate gamey code coverage | |
| run: cd gamey && cargo llvm-cov --lcov --output-path lcov.info | |
| - name: Normalize Rust coverage paths | |
| run: | | |
| sed -i "s|SF:${GITHUB_WORKSPACE}/|SF:|g" gamey/lcov.info | |
| grep '^SF:' gamey/lcov.info | head | |
| - name: Analyze with SonarQube | |
| uses: SonarSource/sonarqube-scan-action@master | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |