...
1name: CI
2
3on:
4 push:
5 branches: [ main ]
6 pull_request:
7 branches: [ main ]
8
9env:
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"
13
14permissions: # added using https://github.com/step-security/secure-workflows
15 contents: read
16
17jobs:
18
19 #
20 # golangci-lint
21 #
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
26 name: Linters
27 runs-on: ${{ matrix.os }}
28 timeout-minutes: 10
29
30 strategy:
31 matrix:
32 os: [ubuntu-22.04, macos-12] # TODO: Add windows-2019
33
34 steps:
35 - uses: actions/setup-go@v4
36 with:
37 go-version: ${{ env.GO_VERSION }}
38 cache: false # see actions/setup-go#368
39
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
66
67 - uses: containerd/project-checks@v1.1.0
68 with:
69 working-directory: src/github.com/containerd/log
70 repo-access-token: ${{ secrets.GITHUB_TOKEN }}
71
72 tests:
73 name: Tests
74 runs-on: ubuntu-22.04
75 timeout-minutes: 5
76
77 steps:
78 - uses: actions/checkout@v2
79 with:
80 path: src/github.com/containerd/log
81
82 - uses: actions/setup-go@v2
83 with:
84 go-version: ${{ env.GO_VERSION }}
85
86 - name: Set env
87 shell: bash
88 run: |
89 echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
90 echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
91
92 - run: |
93 go test -v -race
94 working-directory: src/github.com/containerd/log
View as plain text