Skip to content

Commit 18e3da6

Browse files
committed
Add Github actions CI
Signed-off-by: Derek McGowan <[email protected]>
1 parent ed29dfd commit 18e3da6

2 files changed

Lines changed: 124 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
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"
13+
14+
permissions: # added using https://github.com/step-security/secure-workflows
15+
contents: read
16+
17+
jobs:
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, windows-2022]
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/platforms'
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/platforms
65+
fetch-depth: 25
66+
67+
- uses: containerd/[email protected]
68+
with:
69+
working-directory: src/github.com/containerd/platforms
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/platforms
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/platforms

.golangci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
linters:
2+
enable:
3+
- exportloopref # Checks for pointers to enclosing loop variables
4+
- gofmt
5+
- goimports
6+
- gosec
7+
- ineffassign
8+
- misspell
9+
- nolintlint
10+
- revive
11+
- staticcheck
12+
- tenv # Detects using os.Setenv instead of t.Setenv since Go 1.17
13+
- unconvert
14+
- unused
15+
- vet
16+
- dupword # Checks for duplicate words in the source code
17+
disable:
18+
- errcheck
19+
20+
run:
21+
timeout: 5m
22+
skip-dirs:
23+
- api
24+
- cluster
25+
- design
26+
- docs
27+
- docs/man
28+
- releases
29+
- reports
30+
- test # e2e scripts

0 commit comments

Comments
 (0)