Scan repository #621
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
name: Scan repository | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
schedule: | |
# Every Monday at 9am | |
- cron: "0 9 * * 1" | |
concurrency: | |
group: scan-repo-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
permissions: read-all | |
jobs: | |
unit-tests-ts: | |
name: Test coverage | |
uses: ./.github/workflows/run-unit-tests-ts.yml | |
with: | |
coverage-report: true | |
unit-tests-java: | |
name: Test coverage | |
uses: ./.github/workflows/run-unit-tests-java.yml | |
with: | |
coverage-report: true | |
sonarcloud-java: | |
name: SonarCloud / Java | |
needs: unit-tests-java | |
runs-on: ubuntu-latest | |
steps: | |
- name: Pull repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: 7.5.1 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: zulu | |
cache: gradle | |
- name: Cache build artifacts | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-common-lambdas-java-${{ github.head_ref || github.ref_name }} | |
restore-keys: ${{ runner.os }}-common-lambdas-java- | |
path: | | |
**/*/build/ | |
!**/*/build/jacoco | |
!**/*/build/reports | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
path: ~/.sonar/cache | |
- name: Get coverage results | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.unit-tests-java.outputs.coverage-artifact }} | |
- name: Run SonarCloud scan | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_JAVA }} | |
run: ./gradlew sonar --build-cache --parallel --info | |
sonarcloud-ts: | |
name: SonarCloud / TypeScript | |
needs: unit-tests-ts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run SonarCloud scan | |
uses: govuk-one-login/github-actions/code-quality/sonarcloud@0739d7e7a19bae3177cf851ae51944bb4dd53565 #30th Jan 2024 | |
with: | |
projectBaseDir: lambdas | |
coverage-location: lambdas/coverage | |
coverage-artifact: ${{ needs.unit-tests-ts.outputs.coverage-artifact }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
sonar-token: ${{ secrets.SONAR_TOKEN_TS }} | |
codeql: | |
name: CodeQL | |
runs-on: ubuntu-latest | |
permissions: | |
security-events: write | |
steps: | |
- name: Run CodeQL scan | |
uses: govuk-one-login/github-actions/code-quality/codeql@cf644c0d66c41259bfe2509852d1211e3f01f44d | |
with: | |
languages: javascript-typescript |