github.com/quay/claircore@v1.5.28/.github/workflows/main.yml (about) 1 --- 2 name: CI 3 4 on: 5 push: 6 branches: 7 - main 8 pull_request: 9 branches: 10 - "**" 11 12 jobs: 13 gating-lints: 14 name: Gating Lints 15 runs-on: ubuntu-latest 16 steps: 17 - name: Commit Check 18 uses: gsactions/commit-message-checker@v2 19 with: 20 pattern: | 21 ^[^:!]+: .+\n\n.*$ 22 error: 'Commit must begin with <scope>: <subject>' 23 flags: 'gm' 24 excludeTitle: true 25 excludeDescription: true 26 checkAllCommitMessages: true 27 accessToken: ${{ secrets.GITHUB_TOKEN }} 28 - name: Checkout 29 id: checkout 30 if: ${{ !cancelled() }} 31 uses: actions/checkout@v4 32 - name: Check Filenames 33 if: ${{ !cancelled() && steps.checkout.conclusion == 'success' }} 34 run: | # Check for all the characters Windows hates. 35 git ls-files -- ':/:*[<>:"|?*]*' | while read -r file; do 36 printf '::error file=%s,title=Bad Filename::Disallowed character in file name\n' "$file" 37 done 38 exit $(git ls-files -- ':/:*[<>:"|?*]*' | wc -l) 39 - name: Setup Go 40 id: 'setupgo' 41 if: ${{ !cancelled() && steps.checkout.conclusion == 'success' }} 42 uses: actions/setup-go@v5 43 with: 44 go-version-file: ./go.mod 45 - name: Go Tidy 46 if: ${{ !cancelled() && steps.checkout.conclusion == 'success' && steps.setupgo.conclusion == 'success' }} 47 run: | 48 trap 'echo "::error file=go.mod,title=Tidy Check::Commit would leave go.mod untidy"' ERR 49 go mod tidy 50 git diff --exit-code 51 52 build-documentation: 53 name: Build Docs 54 runs-on: ubuntu-latest 55 steps: 56 - name: Checkout 57 uses: actions/checkout@v4 58 - name: Setup mdBook 59 uses: peaceiris/actions-mdbook@v2 60 with: 61 mdbook-version: 'latest' 62 - name: mdBook Build 63 run: mdbook build 64 65 tests: 66 name: Tests 67 runs-on: ubuntu-latest 68 strategy: 69 fail-fast: false 70 matrix: 71 go: 72 - '1.22' 73 - '1.21' 74 steps: 75 - name: Check for Previous Run 76 id: previous 77 uses: actions/cache@v4 78 with: 79 path: ~/ok-by-run 80 key: commit-ok-${{ matrix.go }}-${{ github.sha }} 81 - name: Checkout 82 if: steps.previous.outputs.cache-hit != 'true' 83 uses: actions/checkout@v4 84 - uses: actions/setup-go@v5 85 if: steps.previous.outputs.cache-hit != 'true' 86 with: 87 go-version: ${{ matrix.go }} 88 - name: Cache Integration Assets 89 if: steps.previous.outputs.cache-hit != 'true' 90 uses: actions/cache@v4 91 with: 92 key: integration-assets-${{ hashFiles('**/*_test.go') }} 93 restore-keys: | 94 integration-assets- 95 path: | 96 ~/.cache/clair-testing 97 - name: Tests 98 run: | 99 if test -f ~/ok-by-run; then 100 echo "::notice title=Commit Previously Passed::See $(cat ~/ok-by-run) (cache key 'commit-ok-${{ matrix.go }}-${{ github.sha }}')" 101 exit 0 102 fi 103 printf '%s/%s/actions/runs/%s/attempts/%s\n'\ 104 "${GITHUB_SERVER_URL}" "${GITHUB_REPOSITORY}" "${GITHUB_RUN_ID}" "${GITHUB_RUN_ATTEMPT}"\ 105 > ~/ok-by-run 106 find . -name .git -prune -o -name testdata -prune -o -name go.mod -printf '%h\n' | 107 while read -r dir; do ( 108 cd "$dir" 109 go list -m 110 go mod download 111 go test -race ${RUNNER_DEBUG:+-v} "-coverprofile=${{ runner.temp }}/$(go list -m | tr / _).codecov.out" -covermode=atomic ./... 112 ); done 113 - name: Codecov 114 if: >- 115 steps.previous.outputs.cache-hit != 'true' && 116 success() && 117 strategy.job-index == 0 118 uses: codecov/codecov-action@v4 119 with: 120 directory: ${{ runner.temp }} 121 override_branch: ${{ github.ref_name }} 122 - name: Database Logs 123 if: failure() || env.RUNNER_DEBUG == 1 124 run: | 125 sudo -u postgres psql -c 'SELECT version();' 126 sudo journalctl --unit postgresql.service --boot -0 127 ls /var/log/postgresql/postgresql-*.log 128 sudo cat /var/log/postgresql/postgresql-*.log