|
6 | 6 | pull_request: |
7 | 7 | branches: [ main ] |
8 | 8 |
|
9 | | -jobs: |
10 | | - |
11 | | - checks: |
12 | | - name: Project Checks |
13 | | - runs-on: ubuntu-22.04 |
14 | | - timeout-minutes: 5 |
15 | | - |
16 | | - steps: |
17 | | - - uses: actions/setup-go@v2 |
18 | | - with: |
19 | | - go-version: 1.20.x |
20 | | - |
21 | | - - name: Set env |
22 | | - shell: bash |
23 | | - run: | |
24 | | - echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV |
25 | | - echo "${{ github.workspace }}/bin" >> $GITHUB_PATH |
| 9 | +env: |
| 10 | + # Go version we currently use to build containerd across all CI. |
| 11 | + # Note: don't forget to update `Binaries` step, as it contains the matrix of all supported Go versions. |
| 12 | + GO_VERSION: "1.21.0" |
26 | 13 |
|
27 | | - - uses: actions/checkout@v2 |
28 | | - with: |
29 | | - path: src/github.com/containerd/log |
30 | | - fetch-depth: 25 |
| 14 | +permissions: # added using https://github.com/step-security/secure-workflows |
| 15 | + contents: read |
31 | 16 |
|
32 | | - - uses: containerd/project-checks@v1 |
33 | | - with: |
34 | | - working-directory: src/github.com/containerd/log |
| 17 | +jobs: |
35 | 18 |
|
| 19 | + # |
| 20 | + # golangci-lint |
| 21 | + # |
36 | 22 | linters: |
| 23 | + permissions: |
| 24 | + contents: read # for actions/checkout to fetch code |
| 25 | + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests |
37 | 26 | name: Linters |
38 | 27 | runs-on: ${{ matrix.os }} |
39 | 28 | timeout-minutes: 10 |
40 | 29 |
|
41 | 30 | strategy: |
42 | 31 | matrix: |
43 | | - go-version: [1.20.x] |
44 | | - os: [ubuntu-22.04] |
| 32 | + os: [ubuntu-22.04, macos-12] # TODO: Add windows-2019 |
45 | 33 |
|
46 | 34 | steps: |
47 | | - - uses: actions/checkout@v2 |
| 35 | + - uses: actions/setup-go@v4 |
48 | 36 | with: |
49 | | - path: src/github.com/containerd/log |
| 37 | + go-version: ${{ env.GO_VERSION }} |
| 38 | + cache: false # see actions/setup-go#368 |
50 | 39 |
|
51 | | - - name: Set env |
52 | | - shell: bash |
53 | | - run: | |
54 | | - echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV |
55 | | - echo "${{ github.workspace }}/bin" >> $GITHUB_PATH |
| 40 | + - uses: actions/checkout@v3 |
| 41 | + - uses: golangci/golangci-lint-action@v3 |
| 42 | + with: |
| 43 | + version: v1.52.2 |
| 44 | + skip-cache: true |
| 45 | + args: --timeout=5m |
| 46 | + |
| 47 | + # |
| 48 | + # Project checks |
| 49 | + # |
| 50 | + project: |
| 51 | + name: Project Checks |
| 52 | + if: github.repository == 'containerd/log' |
| 53 | + runs-on: ubuntu-22.04 |
| 54 | + timeout-minutes: 5 |
| 55 | + |
| 56 | + steps: |
| 57 | + - uses: actions/setup-go@v4 |
| 58 | + with: |
| 59 | + go-version: ${{ env.GO_VERSION }} |
| 60 | + cache: false # see actions/setup-go#368 |
| 61 | + |
| 62 | + - uses: actions/checkout@v3 |
| 63 | + with: |
| 64 | + path: src/github.com/containerd/log |
| 65 | + fetch-depth: 25 |
56 | 66 |
|
57 | | - - uses: golangci/golangci-lint-action@v2 |
| 67 | + - uses: containerd/[email protected] |
58 | 68 | with: |
59 | | - version: v1.29 |
60 | 69 | working-directory: src/github.com/containerd/log |
| 70 | + repo-access-token: ${{ secrets.GITHUB_TOKEN }} |
61 | 71 |
|
62 | 72 | tests: |
63 | 73 | name: Tests |
|
71 | 81 |
|
72 | 82 | - uses: actions/setup-go@v2 |
73 | 83 | with: |
74 | | - go-version: 1.20.x |
| 84 | + go-version: ${{ env.GO_VERSION }} |
75 | 85 |
|
76 | 86 | - name: Set env |
77 | 87 | shell: bash |
|
0 commit comments