Skip to content

Commit 5923ca9

Browse files
authored
Merge pull request #538 from tstromberg/lint
Introduce more stringent golangci-lint checks & address issues raised
2 parents 7ef02f8 + ac890f6 commit 5923ca9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1136
-982
lines changed

.github/workflows/ci.yaml

+74-98
Original file line numberDiff line numberDiff line change
@@ -6,97 +6,73 @@ env:
66
CGO_ENABLED: 0
77

88
jobs:
9-
golangci-lint:
9+
lint:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Checkout code
13-
uses: actions/checkout@v2
14-
- name: Install Go
15-
uses: actions/setup-go@v2
16-
with:
17-
go-version: '1.14.6'
18-
- name: golangci-lint
19-
uses: golangci/golangci-lint-action@v2
20-
goimports:
21-
runs-on: ubuntu-latest
22-
steps:
23-
- name: Checkout code
24-
uses: actions/checkout@v2
25-
- name: Install Go
26-
uses: actions/setup-go@v2
27-
with:
28-
go-version: '1.14.6'
29-
- name: goimports
30-
run: go get golang.org/x/tools/cmd/goimports && goimports -d . | (! grep .)
31-
vet:
32-
runs-on: ubuntu-latest
33-
steps:
34-
- name: Checkout code
35-
uses: actions/checkout@v2
36-
- name: Install Go
37-
uses: actions/setup-go@v2
38-
with:
39-
go-version: '1.14.6'
40-
- name: go vet
41-
run: go vet ./...
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
- name: Install Go
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: "1.17.0"
18+
- name: make lint
19+
run: make lint
4220
test:
4321
runs-on: ubuntu-latest
4422
steps:
45-
- name: Checkout code
46-
uses: actions/checkout@v2
47-
- name: Install Go
48-
uses: actions/setup-go@v2
49-
with:
50-
go-version: '1.14.6'
51-
- name: go test
52-
run: go test -coverprofile=coverage.txt ./...
53-
- name: upload codecov
54-
run: bash <(curl -s https://codecov.io/bash)
23+
- name: Checkout code
24+
uses: actions/checkout@v2
25+
- name: Install Go
26+
uses: actions/setup-go@v2
27+
with:
28+
go-version: "1.14.6"
29+
- name: go test
30+
run: go test -coverprofile=coverage.txt ./...
31+
- name: upload codecov
32+
run: bash <(curl -s https://codecov.io/bash)
5533
ci-checks:
5634
runs-on: ubuntu-latest
5735
steps:
58-
- name: Checkout code
59-
uses: actions/checkout@v2
60-
- uses: cachix/install-nix-action@v12
61-
with:
62-
nix_path: nixpkgs=channel:nixos-unstable
63-
- run: ./ci-checks.sh
36+
- name: Checkout code
37+
uses: actions/checkout@v2
38+
- uses: cachix/install-nix-action@v12
39+
with:
40+
nix_path: nixpkgs=channel:nixos-unstable
41+
- run: ./ci-checks.sh
6442
validation:
6543
runs-on: ubuntu-latest
6644
needs:
6745
- ci-checks
68-
- goimports
69-
- golangci-lint
46+
- lint
7047
- test
71-
- vet
7248
steps:
73-
- name: fake
74-
run: echo ":+1:"
49+
- name: fake
50+
run: echo ":+1:"
7551
crosscompile:
7652
runs-on: ubuntu-latest
7753
needs:
7854
- validation
7955
steps:
80-
- name: Checkout code
81-
uses: actions/checkout@v2
82-
- name: Install Go
83-
uses: actions/setup-go@v2
84-
with:
85-
go-version: '1.14.6'
86-
- run: make crosscompile -j$(nproc)
87-
- name: Upload tink-cli binaries
88-
uses: actions/upload-artifact@v2
89-
with:
56+
- name: Checkout code
57+
uses: actions/checkout@v2
58+
- name: Install Go
59+
uses: actions/setup-go@v2
60+
with:
61+
go-version: "1.14.6"
62+
- run: make crosscompile -j$(nproc)
63+
- name: Upload tink-cli binaries
64+
uses: actions/upload-artifact@v2
65+
with:
9066
name: tink-cli
9167
path: cmd/tink-cli/tink-cli-*
92-
- name: Upload tink-server binaries
93-
uses: actions/upload-artifact@v2
94-
with:
68+
- name: Upload tink-server binaries
69+
uses: actions/upload-artifact@v2
70+
with:
9571
name: tink-server
9672
path: cmd/tink-server/tink-server-*
97-
- name: Upload tink-worker binaries
98-
uses: actions/upload-artifact@v2
99-
with:
73+
- name: Upload tink-worker binaries
74+
uses: actions/upload-artifact@v2
75+
with:
10076
name: tink-worker
10177
path: cmd/tink-worker/tink-worker-*
10278
docker-images:
@@ -113,35 +89,35 @@ jobs:
11389
- repository: quay.io/tinkerbell/tink-worker
11490
binary: tink-worker
11591
steps:
116-
- name: Docker Image Tag for Sha
117-
id: docker-image-tag
118-
run: |
119-
echo ::set-output name=tags::${{ matrix.repository }}:latest,${{ matrix.repository }}:sha-${GITHUB_SHA::8}
120-
- name: Checkout code
121-
uses: actions/checkout@v2
122-
- name: Login to quay.io
123-
uses: docker/login-action@v1
124-
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
125-
with:
126-
registry: quay.io
127-
username: ${{ secrets.QUAY_USERNAME }}
128-
password: ${{ secrets.QUAY_PASSWORD }}
129-
- name: Set up QEMU
130-
uses: docker/setup-qemu-action@v1
131-
- name: Set up Docker Buildx
132-
uses: docker/setup-buildx-action@v1
133-
- name: Download ${{ matrix.binary }} artifacts
134-
uses: actions/download-artifact@v2
135-
with:
92+
- name: Docker Image Tag for Sha
93+
id: docker-image-tag
94+
run: |
95+
echo ::set-output name=tags::${{ matrix.repository }}:latest,${{ matrix.repository }}:sha-${GITHUB_SHA::8}
96+
- name: Checkout code
97+
uses: actions/checkout@v2
98+
- name: Login to quay.io
99+
uses: docker/login-action@v1
100+
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
101+
with:
102+
registry: quay.io
103+
username: ${{ secrets.QUAY_USERNAME }}
104+
password: ${{ secrets.QUAY_PASSWORD }}
105+
- name: Set up QEMU
106+
uses: docker/setup-qemu-action@v1
107+
- name: Set up Docker Buildx
108+
uses: docker/setup-buildx-action@v1
109+
- name: Download ${{ matrix.binary }} artifacts
110+
uses: actions/download-artifact@v2
111+
with:
136112
name: ${{ matrix.binary}}
137113
path: cmd/${{ matrix.binary }}
138-
- name: Fix Permissions
139-
run: chmod +x cmd/${{ matrix.binary }}/${{ matrix.binary }}*
140-
- name: ${{ matrix.repository }}
141-
uses: docker/build-push-action@v2
142-
with:
143-
context: cmd/${{ matrix.binary }}/
144-
cache-from: type=registry,ref=${{ matrix.repository }}:latest
145-
push: ${{ startsWith(github.ref, 'refs/heads/main') }}
146-
tags: ${{ steps.docker-image-tag.outputs.tags }}
147-
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
114+
- name: Fix Permissions
115+
run: chmod +x cmd/${{ matrix.binary }}/${{ matrix.binary }}*
116+
- name: ${{ matrix.repository }}
117+
uses: docker/build-push-action@v2
118+
with:
119+
context: cmd/${{ matrix.binary }}/
120+
cache-from: type=registry,ref=${{ matrix.repository }}:latest
121+
push: ${{ startsWith(github.ref, 'refs/heads/main') }}
122+
tags: ${{ steps.docker-image-tag.outputs.tags }}
123+
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64

0 commit comments

Comments
 (0)