-
Notifications
You must be signed in to change notification settings - Fork 9
157 lines (135 loc) · 4.29 KB
/
build.yml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
schedule:
- cron: 0 0 * * 1
jobs:
test:
name: Build and Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go:
- '1.21'
- '1.22'
env:
DNS_HOST: ns.example.com
DNS_PORT: 8053
DNS_REALM: EXAMPLE.COM
DNS_USERNAME: test
DNS_PASSWORD: password
DNS_KEYTAB: ${{ github.workspace }}/testdata/test.keytab
KRB5_CONFIG: ${{ github.workspace }}/testdata/krb5.conf
KRB5_KTNAME: ${{ github.workspace }}/testdata/dns.keytab
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Install Kerberos client
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq libkrb5-dev krb5-user
- name: golangci-lint (gokrb5)
uses: golangci/golangci-lint-action@v6
if: github.event_name == 'pull_request'
with:
only-new-issues: true
- name: golangci-lint (apcera)
uses: golangci/golangci-lint-action@v6
if: github.event_name == 'pull_request'
with:
only-new-issues: true
args: --build-tags apcera
- name: golangci-lint (SSPI)
uses: golangci/golangci-lint-action@v6
if: github.event_name == 'pull_request'
with:
only-new-issues: true
env:
GOOS: windows
- name: Podman version
id: podman
shell: bash
run: |
echo "version=$(podman version | grep '^Version:' | tr -s ' ' | cut -d ' ' -f 2)" >>"${GITHUB_OUTPUT}"
- name: Downgrade Docker
if: steps.podman.outputs.version == '3.4.4'
shell: bash
run: |
apt-cache madison docker.io
sudo apt-get remove containerd.io
sudo apt-get install docker.io=24.0.7-0ubuntu2~22.04.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build KDC image
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:testdata"
load: true
tags: kdc
target: kdc
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build DNS image
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:testdata"
load: true
tags: ns
target: ns
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Extract keytab
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:testdata"
outputs: type=local,dest=testdata
target: keytab
- name: Pull containers into Podman
run: |
podman pull docker-daemon:kdc:latest
podman pull docker-daemon:ns:latest
- name: Create infrastructure
run: |
podman run -d \
-v /etc/localtime:/etc/localtime:ro \
-p 127.0.0.1:8088:8088 \
-p 127.0.0.1:8088:8088/udp \
-p 127.0.0.1:8464:8464 \
-p 127.0.0.1:8464:8464/udp \
--name kdc kdc
podman run -d \
-v /etc/localtime:/etc/localtime:ro \
-p 127.0.0.1:${DNS_PORT}:${DNS_PORT} \
--name ns --hostname $DNS_HOST ns
echo 127.0.0.1 $DNS_HOST | sudo tee -a /etc/hosts
echo $DNS_PASSWORD | KRB5_TRACE=/dev/stdout kinit ${DNS_USERNAME}@${DNS_REALM}
- name: Test (gokrb5)
run: go test -v -coverprofile=gokrb5.out ./...
- name: Test (apcera)
run: go test -v -coverprofile=apcera.out -tags apcera ./...
- name: Build (SSPI)
run: go build ./...
env:
GOARCH: amd64
GOOS: windows
- name: Install coverage tools
run: |
go install github.com/wadey/gocovmerge@latest
go install github.com/mattn/goveralls@latest
- name: Merge coverage reports
run: gocovmerge gokrb5.out apcera.out >cover.out
- name: Send coverage
run: goveralls -coverprofile=cover.out -service=github
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}