Skip to content

Commit 668d1fd

Browse files
committed
Phase 8: CI/CD workflow updates for Go binaries
Update GitHub Actions workflows to build, test, lint, and publish Go binaries alongside the existing pipeline. CI.yml changes: - Add "go" to the build matrix; gate C# steps with language condition - Go build steps: setup-go, just go-build, just go-test, golangci-lint - build-for-e2e-test: replace dotnet publish with Go cross-compilation (just go-publish-linux/windows/macos) producing platform binaries - e2e-test: update binary copy steps to reference Go binary names; keep Setup .NET since integration tests are C# projects that invoke binaries - publish: replace dotnet/publish.ps1 with just go-publish-all; release 18 flat binaries (3 CLIs x 6 platform/arch combos) instead of zips Other workflow changes: - codeql-config.yml: remove disable-default-queries so Go gets CodeQL default query suite - dependabot.yml: add gomod ecosystem for Go dependency updates - copilot-setup-steps.yml: add Go setup and go mod download Justfile fixes: - go-publish-linux: add mkdir -p for dist/linux-arm64 directory - go-publish-macos: add arm64 builds (darwin-arm64) for all 3 CLIs
1 parent 0bbefae commit 668d1fd

5 files changed

Lines changed: 82 additions & 23 deletions

File tree

.github/codeql/codeql-config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: "CodeQL code scanning custom configuration"
2-
disable-default-queries: true
32
queries:
43
- name: Use the custom query suite file from this repo
54
uses: ./.github/codeql/csharp-custom-queries.qls

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ updates:
1010
directory: "/" # Location of package manifests
1111
schedule:
1212
interval: "weekly"
13+
- package-ecosystem: "gomod"
14+
directory: "/"
15+
schedule:
16+
interval: "weekly"
1317
- package-ecosystem: "github-actions" # See documentation for possible values
1418
directory: "/" # Location of package manifests
1519
schedule:

.github/workflows/CI.yml

Lines changed: 53 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
runner-os: [windows-latest, ubuntu-latest, macos-latest]
27-
language: [csharp, actions]
27+
language: [csharp, go, actions]
2828

2929
runs-on: ${{ matrix.runner-os }}
3030

@@ -42,21 +42,27 @@ jobs:
4242
queries: +security-and-quality
4343
config-file: ./.github/codeql/codeql-config.yml
4444

45+
# --- C# steps ---
4546
- name: Setup .NET
47+
if: matrix.language == 'csharp'
4648
uses: actions/setup-dotnet@v5
4749
with:
4850
global-json-file: global.json
4951

5052
- name: dotnet format
53+
if: matrix.language == 'csharp'
5154
run: just format-check
5255

5356
- name: Restore dependencies
57+
if: matrix.language == 'csharp'
5458
run: just restore
5559

5660
- name: Build
61+
if: matrix.language == 'csharp'
5762
run: just build
5863

5964
- name: Unit Test
65+
if: matrix.language == 'csharp'
6066
run: just test-coverage
6167

6268
- name: Copy Coverage To Predictable Location
@@ -89,6 +95,27 @@ jobs:
8995
name: Code Coverage Report
9096
path: code-coverage-results.md
9197

98+
# --- Go steps ---
99+
- name: Setup Go
100+
if: matrix.language == 'go'
101+
uses: actions/setup-go@v5
102+
with:
103+
go-version-file: go.mod
104+
105+
- name: Go Build
106+
if: matrix.language == 'go'
107+
run: just go-build
108+
109+
- name: Go Test
110+
if: matrix.language == 'go'
111+
run: just go-test
112+
113+
- name: Go Lint
114+
if: matrix.language == 'go'
115+
uses: golangci/golangci-lint-action@v8
116+
with:
117+
version: v2.11.3
118+
92119
- name: Perform CodeQL Analysis
93120
uses: github/codeql-action/analyze@v4
94121
if: matrix.runner-os == 'ubuntu-latest'
@@ -123,22 +150,22 @@ jobs:
123150
# e33e0265a09d6d736e2ee1e0eb685ef1de4669ff is tag v3, pinned to avoid supply chain attacks
124151
- uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b
125152

126-
- name: Setup .NET
127-
uses: actions/setup-dotnet@v5
153+
- name: Setup Go
154+
uses: actions/setup-go@v5
128155
with:
129-
global-json-file: global.json
156+
go-version-file: go.mod
130157

131158
- name: Build Artifacts (Linux)
132159
if: matrix.target-os == 'ubuntu-latest'
133-
run: just publish-linux
160+
run: just go-publish-linux
134161

135162
- name: Build Artifacts (Windows)
136163
if: matrix.target-os == 'windows-latest'
137-
run: just publish-windows
164+
run: just go-publish-windows
138165

139166
- name: Build Artifacts (MacOS)
140167
if: matrix.target-os == 'macos-latest'
141-
run: just publish-macos
168+
run: just go-publish-macos
142169

143170
- name: Upload Binaries
144171
uses: actions/upload-artifact@v6
@@ -325,14 +352,16 @@ jobs:
325352
exit 1
326353
}
327354
328-
- name: Setup .NET
329-
uses: actions/setup-dotnet@v5
355+
- name: Setup Go
356+
uses: actions/setup-go@v5
330357
with:
331-
global-json-file: global.json
358+
go-version-file: go.mod
359+
360+
# e33e0265a09d6d736e2ee1e0eb685ef1de4669ff is tag v3, pinned to avoid supply chain attacks
361+
- uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b
332362

333363
- name: Build Artifacts
334-
run: ./publish.ps1
335-
shell: pwsh
364+
run: just go-publish-all
336365
env:
337366
CLI_VERSION: ${{ github.ref }}
338367

@@ -342,18 +371,24 @@ jobs:
342371
with:
343372
body_path: ./RELEASENOTES.md
344373
files: |
345-
./dist/ado2gh.*.win-x64.zip
346-
./dist/ado2gh.*.win-x86.zip
347-
./dist/ado2gh.*.linux-x64.tar.gz
348-
./dist/ado2gh.*.linux-arm64.tar.gz
349-
./dist/ado2gh.*.osx-x64.tar.gz
350-
./dist/ado2gh.*.osx-arm64.tar.gz
351374
./dist/win-x64/gei-windows-amd64.exe
352375
./dist/win-x86/gei-windows-386.exe
353376
./dist/linux-x64/gei-linux-amd64
354377
./dist/linux-arm64/gei-linux-arm64
355378
./dist/osx-x64/gei-darwin-amd64
356379
./dist/osx-arm64/gei-darwin-arm64
380+
./dist/win-x64/ado2gh-windows-amd64.exe
381+
./dist/win-x86/ado2gh-windows-386.exe
382+
./dist/linux-x64/ado2gh-linux-amd64
383+
./dist/linux-arm64/ado2gh-linux-arm64
384+
./dist/osx-x64/ado2gh-darwin-amd64
385+
./dist/osx-arm64/ado2gh-darwin-arm64
386+
./dist/win-x64/bbs2gh-windows-amd64.exe
387+
./dist/win-x86/bbs2gh-windows-386.exe
388+
./dist/linux-x64/bbs2gh-linux-amd64
389+
./dist/linux-arm64/bbs2gh-linux-arm64
390+
./dist/osx-x64/bbs2gh-darwin-amd64
391+
./dist/osx-arm64/bbs2gh-darwin-arm64
357392
358393
- name: Create gh-ado2gh Release
359394
# a06a81a03ee405af7f2048a818ed3f03bbf83c7b is tag v2, pinned to avoid supply chain attacks

.github/workflows/copilot-setup-steps.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ jobs:
2727

2828
- name: Restore dependencies
2929
run: dotnet restore src/OctoshiftCLI.sln
30+
31+
- name: Setup Go
32+
uses: actions/setup-go@v5
33+
with:
34+
go-version-file: go.mod
35+
36+
- name: Download Go dependencies
37+
run: go mod download

justfile

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ go-lint:
167167

168168
# Build Go binaries for Linux
169169
go-publish-linux:
170-
mkdir -p dist/linux-x64
170+
mkdir -p dist/linux-x64 dist/linux-arm64
171171
GOOS=linux GOARCH=amd64 go build -o dist/linux-x64/gei-linux-amd64 ./cmd/gei
172172
GOOS=linux GOARCH=amd64 go build -o dist/linux-x64/ado2gh-linux-amd64 ./cmd/ado2gh
173173
GOOS=linux GOARCH=amd64 go build -o dist/linux-x64/bbs2gh-linux-amd64 ./cmd/bbs2gh
@@ -187,10 +187,13 @@ go-publish-windows:
187187

188188
# Build Go binaries for macOS
189189
go-publish-macos:
190-
mkdir -p dist/osx-x64
190+
mkdir -p dist/osx-x64 dist/osx-arm64
191191
GOOS=darwin GOARCH=amd64 go build -o dist/osx-x64/gei-darwin-amd64 ./cmd/gei
192192
GOOS=darwin GOARCH=amd64 go build -o dist/osx-x64/ado2gh-darwin-amd64 ./cmd/ado2gh
193193
GOOS=darwin GOARCH=amd64 go build -o dist/osx-x64/bbs2gh-darwin-amd64 ./cmd/bbs2gh
194+
GOOS=darwin GOARCH=arm64 go build -o dist/osx-arm64/gei-darwin-arm64 ./cmd/gei
195+
GOOS=darwin GOARCH=arm64 go build -o dist/osx-arm64/ado2gh-darwin-arm64 ./cmd/ado2gh
196+
GOOS=darwin GOARCH=arm64 go build -o dist/osx-arm64/bbs2gh-darwin-arm64 ./cmd/bbs2gh
194197

195198
# Build Go binaries for all platforms
196199
go-publish-all: go-publish-linux go-publish-windows go-publish-macos
@@ -199,12 +202,22 @@ go-publish-all: go-publish-linux go-publish-windows go-publish-macos
199202
go-install-extensions-macos: go-publish-macos
200203
#!/usr/bin/env bash
201204
set -euo pipefail
205+
arch=$(uname -m)
206+
if [ "$arch" = "arm64" ]; then
207+
dist_dir="osx-arm64"
208+
suffix="darwin-arm64"
209+
else
210+
dist_dir="osx-x64"
211+
suffix="darwin-amd64"
212+
fi
202213
for cli in gei ado2gh bbs2gh; do
203214
dir="gh-${cli}"
204215
mkdir -p "$dir"
205-
cp "./dist/osx-x64/${cli}-darwin-amd64" "./${dir}/gh-${cli}"
216+
cp "./dist/${dist_dir}/${cli}-${suffix}" "./${dir}/gh-${cli}"
206217
chmod +x "./${dir}/gh-${cli}"
207-
cd "$dir" && gh extension install . --force && cd ..
218+
pushd "$dir" > /dev/null
219+
gh extension install . --force || true
220+
popd > /dev/null
208221
done
209222
echo "Go extensions installed successfully!"
210223

0 commit comments

Comments
 (0)