[NRL-1922] Fix pr-checks workflow issues #2
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: Run PR checks | ||
| run-name: "Running checks for PR #${{ github.event.pull_request.number }} (${{ github.event.pull_request.title }})" | ||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| actions: write | ||
| pull-requests: write | ||
| jobs: | ||
| build: | ||
| name: Build and test | ||
| runs-on: codebuild-nhsd-nrlf-ci-build-project-${{ github.run_id }}-${{ github.run_attempt }} | ||
| steps: | ||
| - name: Git clone - ${{ github.ref }} | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.ref }} | ||
| - name: Setup environment | ||
| run: | | ||
| echo "${HOME}/.asdf/bin" >> $GITHUB_PATH | ||
| poetry install --no-root | ||
| - name: Build | ||
| run: make build | ||
| - name: Test | ||
| run: make test | ||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: build-artifacts | ||
| path: dist | ||
| sonar: | ||
| name: SonarQube analysis and quality gate check | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.ref }} | ||
| - name: Get build artifacts | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: build-artifacts | ||
| path: dist | ||
| # Triggering SonarQube analysis as results of it are required by Quality Gate check. | ||
| - name: SonarQube Scan | ||
| uses: sonarsource/sonarqube-scan-action@master | ||
| env: | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
| # Check the Quality Gate status. | ||
| - name: SonarQube Quality Gate check | ||
| id: sonarqube-quality-gate-check | ||
| uses: sonarsource/sonarqube-quality-gate-action@master | ||
| with: | ||
| pollingTimeoutSec: 600 | ||
| env: | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||