|
7 | 7 | pull_request: |
8 | 8 |
|
9 | 9 | env: |
10 | | - GO_VERSION: "1.17.x" |
| 10 | + GO_VERSION: "1.18.x" |
| 11 | + GO_STABLE_VERSION: true |
11 | 12 |
|
12 | 13 | jobs: |
| 14 | + # TODO: please delete me once once we move to 1.18 and golangci-lint works with it. |
| 15 | + Static-Analysis-Golangci-lint: |
| 16 | + # Note: changing this job name requires making the same update in the .github/workflows/release.yaml pipeline |
| 17 | + name: "Static analysis against 1.17" |
| 18 | + runs-on: ubuntu-20.04 |
| 19 | + steps: |
| 20 | + - uses: actions/setup-go@v2 |
| 21 | + with: |
| 22 | + go-version: "1.17" |
| 23 | + stable: ${{ env.GO_STABLE_VERSION }} |
| 24 | + |
| 25 | + - uses: actions/checkout@v2 |
| 26 | + |
| 27 | + - name: Restore tool cache |
| 28 | + id: tool-cache |
| 29 | + |
| 30 | + with: |
| 31 | + path: ${{ github.workspace }}/.tmp |
| 32 | + key: ${{ runner.os }}-tool-${{ hashFiles('Makefile') }} |
| 33 | + |
| 34 | + - name: Restore go cache |
| 35 | + id: go-cache |
| 36 | + |
| 37 | + with: |
| 38 | + path: ~/go/pkg/mod |
| 39 | + key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }} |
| 40 | + restore-keys: | |
| 41 | + ${{ runner.os }}-go-${{ env.GO_VERSION }}- |
| 42 | +
|
| 43 | + - name: (cache-miss) Bootstrap all project dependencies |
| 44 | + if: steps.tool-cache.outputs.cache-hit != 'true' || steps.go-cache.outputs.cache-hit != 'true' |
| 45 | + run: make bootstrap |
| 46 | + |
| 47 | + - name: Bootstrap CI environment dependencies |
| 48 | + run: make ci-bootstrap |
| 49 | + |
| 50 | + - name: Run linters |
| 51 | + run: make lint |
| 52 | + |
| 53 | + # allow for PRs to skip validating the syft version to allow for incremental updates of syft before release. |
| 54 | + # In this way checks against the main branch (which are required for release) will fail, but PR checks will not |
| 55 | + - name: Ensure syft version is a release version |
| 56 | + run: | |
| 57 | + echo "GitHub reference: ${GITHUB_REF##*/}" |
| 58 | + git fetch origin main |
| 59 | + git merge-base --is-ancestor ${GITHUB_REF##*/} origin/main && make validate-syft-release-version || echo "skipping syft version checkk" |
13 | 60 |
|
14 | 61 | Static-Analysis: |
15 | 62 | # Note: changing this job name requires making the same update in the .github/workflows/release.yaml pipeline |
|
19 | 66 | - uses: actions/setup-go@v2 |
20 | 67 | with: |
21 | 68 | go-version: ${{ env.GO_VERSION }} |
| 69 | + stable: ${{ env.GO_STABLE_VERSION }} |
22 | 70 |
|
23 | 71 | - uses: actions/checkout@v2 |
24 | 72 |
|
|
64 | 112 | - uses: actions/setup-go@v2 |
65 | 113 | with: |
66 | 114 | go-version: ${{ env.GO_VERSION }} |
| 115 | + stable: ${{ env.GO_STABLE_VERSION }} |
67 | 116 |
|
68 | 117 | - uses: actions/checkout@v2 |
69 | 118 |
|
@@ -106,6 +155,7 @@ jobs: |
106 | 155 | - uses: actions/setup-go@v2 |
107 | 156 | with: |
108 | 157 | go-version: ${{ env.GO_VERSION }} |
| 158 | + stable: ${{ env.GO_STABLE_VERSION }} |
109 | 159 |
|
110 | 160 | - uses: actions/checkout@v2 |
111 | 161 |
|
@@ -154,6 +204,7 @@ jobs: |
154 | 204 | - uses: actions/setup-go@v2 |
155 | 205 | with: |
156 | 206 | go-version: ${{ env.GO_VERSION }} |
| 207 | + stable: ${{ env.GO_STABLE_VERSION }} |
157 | 208 |
|
158 | 209 | - uses: actions/checkout@v2 |
159 | 210 |
|
@@ -248,6 +299,7 @@ jobs: |
248 | 299 | - uses: actions/setup-go@v2 |
249 | 300 | with: |
250 | 301 | go-version: ${{ env.GO_VERSION }} |
| 302 | + stable: ${{ env.GO_STABLE_VERSION }} |
251 | 303 |
|
252 | 304 | - uses: actions/checkout@v2 |
253 | 305 |
|
|
0 commit comments