|
| 1 | +name: Coverage |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + pull_request: |
| 8 | + types: |
| 9 | + - opened |
| 10 | + - reopened |
| 11 | + - synchronize |
| 12 | + branches: |
| 13 | + - "main" |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + compliance: |
| 21 | + name: "License Compliance" |
| 22 | + runs-on: ubuntu-24.04 |
| 23 | + steps: |
| 24 | + - name: "Checkout Code" |
| 25 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 26 | + - name: Check secret |
| 27 | + id: checksecret |
| 28 | + uses: ./.github/actions/exists |
| 29 | + with: |
| 30 | + value: ${{ secrets.FOSSA_API_KEY }} |
| 31 | + - name: "Run FOSSA Scan" |
| 32 | + if: steps.checksecret.outputs.result == 'true' |
| 33 | + uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0 |
| 34 | + with: |
| 35 | + api-key: ${{ secrets.FOSSA_API_KEY }} |
| 36 | + - name: "Run FOSSA Test" |
| 37 | + if: steps.checksecret.outputs.result == 'true' |
| 38 | + uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0 |
| 39 | + with: |
| 40 | + api-key: ${{ secrets.FOSSA_API_KEY }} |
| 41 | + run-tests: true |
| 42 | + sast: |
| 43 | + name: "SAST" |
| 44 | + runs-on: ubuntu-24.04 |
| 45 | + env: |
| 46 | + GO111MODULE: on |
| 47 | + permissions: |
| 48 | + security-events: write |
| 49 | + actions: read |
| 50 | + contents: read |
| 51 | + steps: |
| 52 | + - name: Checkout Source |
| 53 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 54 | + - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 |
| 55 | + with: |
| 56 | + go-version-file: 'go.mod' |
| 57 | + - name: Run Gosec Security Scanner |
| 58 | + uses: securego/gosec@43fee884f668c23601e0bec7a8c095fba226f889 # v2.22.1 |
| 59 | + with: |
| 60 | + args: '-no-fail -fmt sarif -out gosec.sarif ./...' |
| 61 | + - name: Upload SARIF file |
| 62 | + uses: github/codeql-action/upload-sarif@1bb15d06a6fbb5d9d9ffd228746bf8ee208caec8 |
| 63 | + with: |
| 64 | + sarif_file: gosec.sarif |
| 65 | + unit_tests: |
| 66 | + name: "Unit tests" |
| 67 | + runs-on: ubuntu-24.04 |
| 68 | + steps: |
| 69 | + - name: Checkout |
| 70 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 71 | + - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 |
| 72 | + with: |
| 73 | + go-version-file: 'go.mod' |
| 74 | + - name: Unit Test |
| 75 | + run: make test |
| 76 | + - name: Check secret |
| 77 | + id: checksecret |
| 78 | + uses: ./.github/actions/exists |
| 79 | + with: |
| 80 | + value: ${{ secrets.CODECOV_TOKEN }} |
| 81 | + - name: Upload Report to Codecov |
| 82 | + if: ${{ steps.checksecret.outputs.result == 'true' }} |
| 83 | + uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 |
| 84 | + with: |
| 85 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 86 | + slug: projectcapsule/cortex-tenant |
| 87 | + files: ./coverage.out |
| 88 | + fail_ci_if_error: true |
| 89 | + verbose: true |
0 commit comments