Repository navigation
74 lines (59 loc) · 1.82 KB
/
Copy pathci.yml
File metadata and controls
74 lines (59 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: CI
on:
push:
branches:
- "**"
tags-ignore:
- "v*.*.*"
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
go:
name: Go Checks
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Download dependencies
run: go mod download
- name: Verify module downloads
run: go mod verify
- name: Check Go formatting
run: |
unformatted="$(find . -name '*.go' -type f -print0 | xargs -0 gofmt -l)"
if [ -n "$unformatted" ]; then
echo "The following files need gofmt:"
echo "$unformatted"
exit 1
fi
- name: Run tests
run: go test ./...
- name: Build binary
run: go build -o /tmp/containerscope ./cmd/containerscope
# Non-publishing Docker image build smoke test
docker:
name: Docker Build
runs-on: ubuntu-latest
needs: go
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build image
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
push: false
tags: containerscope:ci