-
Notifications
You must be signed in to change notification settings - Fork 9
104 lines (87 loc) · 2.66 KB
/
Copy pathci.yml
File metadata and controls
104 lines (87 loc) · 2.66 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
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
go_ci: ${{ steps.filter.outputs.go_ci }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Detect changed paths
id: filter
uses: dorny/paths-filter@v4
with:
filters: |
go_ci:
- '**/*.go'
- 'go.mod'
- 'go.sum'
- '.golangci.yml'
- '.github/workflows/ci.yml'
go:
needs: changes
if: needs.changes.outputs.go_ci == 'true'
runs-on: ubuntu-latest
container: golang:1.26-alpine
env:
CGO_ENABLED: 0
GOFLAGS: -buildvcs=false
GOMODCACHE: /go/pkg/mod
GOCACHE: /root/.cache/go-build
defaults:
run:
shell: bash
steps:
- name: Install system dependencies
shell: sh
run: apk add --no-cache bash ca-certificates git
- name: Checkout repository
uses: actions/checkout@v6
- name: Cache Go modules and build outputs
uses: actions/cache@v5
with:
path: |
/go/pkg/mod
/root/.cache/go-build
key: ${{ runner.os }}-go-1.26-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-1.26-
- name: Verify generated files and module metadata
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
go generate ./...
go mod tidy
git diff --exit-code
- name: Check Go formatting
run: test -z "$(gofmt -l .)"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.12
args: --verbose
- name: Run Go tests
run: go test ./... -v -cover
- name: Run Go build
run: go build ./...
- name: Build CoreDNS with the local plugin
run: |
plugin_dir="$GITHUB_WORKSPACE"
coredns_version="$(go list -m -f '{{.Version}}' github.com/coredns/coredns)"
coredns_dir="$(mktemp -d)"
git clone --depth 1 --branch "$coredns_version" https://github.com/coredns/coredns.git "$coredns_dir"
cd "$coredns_dir"
go mod edit -replace "github.com/v-byte-cpu/coredns-https=$plugin_dir"
go get github.com/v-byte-cpu/coredns-https@v0.0.0
COREDNS_PLUGINS="dohproxy:github.com/v-byte-cpu/coredns-https" go generate coredns.go
go build -o coredns .
./coredns -plugins | grep -Fx dohproxy