-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (143 loc) · 4.28 KB
/
Copy pathci.yml
File metadata and controls
152 lines (143 loc) · 4.28 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
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
GOWORK: "off"
jobs:
changes:
runs-on: ubuntu-latest
outputs:
quality_ci: ${{ steps.filter.outputs.quality_ci }}
docker_ci: ${{ steps.filter.outputs.docker_ci }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Detect changed paths
id: filter
uses: dorny/paths-filter@v4
with:
filters: |
quality_ci:
- '**/*.go'
- 'go.mod'
- 'go.sum'
- '.golangci.yml'
- '.mise.toml'
- 'README.md'
- 'CONTEXT.md'
- 'docs/**'
- 'examples/**'
- 'e2e/**'
- 'internal/service/scaffold/templates/**'
- '.github/workflows/**'
- '.github/scripts/**'
docker_ci:
- 'go.mod'
- 'go.sum'
- 'Dockerfile'
- '.dockerignore'
- '.github/workflows/ci.yml'
- '.github/workflows/publish-image.yml'
linux:
name: quality (Linux)
needs: changes
if: needs.changes.outputs.quality_ci == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Set up project tools
uses: jdx/mise-action@v4
with:
cache: true
install: true
github_token: ${{ github.token }}
- name: Cache golangci-lint analysis
uses: actions/cache@v5
with:
path: ~/.cache/golangci-lint
key: golangci-lint-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.mise.toml', '.golangci.yml', 'go.mod', 'go.sum') }}
restore-keys: |
golangci-lint-${{ runner.os }}-${{ runner.arch }}-
- name: Run full check
run: mise run check
- name: Build macOS binaries
env:
CGO_ENABLED: "0"
GOOS: darwin
run: |
set -euo pipefail
for goarch in amd64 arm64; do
GOARCH="${goarch}" GOWORK=off go build \
-trimpath \
-o "${RUNNER_TEMP}/devctl-darwin-${goarch}" \
./cmd/devctl
done
docker:
name: docker (linux/amd64)
needs: changes
if: needs.changes.outputs.docker_ci == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Docker image
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
load: true
push: false
tags: devctl:ci
build-args: |
VERSION=ci
COMMIT=${{ github.sha }}
cache-from: type=gha,scope=docker-amd64
cache-to: type=gha,scope=docker-amd64,mode=max
provenance: false
- name: Verify image metadata
env:
EXPECTED_COMMIT: ${{ github.sha }}
run: |
set -euo pipefail
version_output="$(docker run --rm --platform linux/amd64 devctl:ci --version)"
grep -Fqx "devctl version ci" <<< "${version_output}"
grep -Fqx "commit: ${EXPECTED_COMMIT}" <<< "${version_output}"
- name: Verify project runner tools
run: |
set -euo pipefail
docker run --rm --platform linux/amd64 --entrypoint sh devctl:ci -ceu '
test -x /devctl
command -v devctl
go version
git --version
node --version | grep -E "^v24\\."
quicktype --version
'
release-helper:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Run release helper tests
run: python3 -B -m unittest discover -s .github/scripts/tests -t .github/scripts