diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ba467b..de19a9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,9 @@ on: - 'main' pull_request: +env: + DESTDIR: ./build + jobs: test: runs-on: ubuntu-24.04 @@ -41,3 +44,33 @@ jobs: ln -s vendor.sum go.sum - name: Run tests run: go test -race + + govulncheck: + runs-on: ubuntu-24.04 + timeout-minutes: 5 + + permissions: + # required to write sarif report + security-events: write + + steps: + - uses: actions/checkout@v4 + - name: Create go.mod + run: | + ln -s vendor.mod go.mod + ln -s vendor.sum go.sum + - name: Create artifact directory + run: mkdir -p ${{ env.DESTDIR }} + - name: Run govulncheck + uses: golang/govulncheck-action@v1 + with: + go-package: ./... + check-latest: true + repo-checkout: false + output-format: 'sarif' + output-file: ${{ env.DESTDIR }}/govulncheck.out + - name: Upload SARIF report + if: ${{ github.event_name != 'pull_request' && github.repository == 'docker/go-events' }} + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: ${{ env.DESTDIR }}/govulncheck.out diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..6e5075e --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,60 @@ +name: codeql + +# Default to 'contents: read', which grants actions to read commits. +# +# If any permission is set, any permission not included in the list is +# implicitly set to "none". +# +# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions +permissions: + contents: read + +on: + push: + branches: + - 'master' + tags: + - 'v*' + pull_request: + # The branches below must be a subset of the branches above + branches: ["master"] + schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12) + # │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday) + # │ │ │ │ │ + # │ │ │ │ │ + # │ │ │ │ │ + # * * * * * + - cron: '0 9 * * 4' + +jobs: + codeql: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + actions: read + contents: read + security-events: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "stable" + - name: Create go.mod + run: | + ln -s vendor.mod go.mod + ln -s vendor.sum go.sum + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: go + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:go"