-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.github/workflows: build and test for all three supported archs
Signed-off-by: Aaron Klotz <[email protected]>
- Loading branch information
Showing
1 changed file
with
41 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,66 @@ | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: Go | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "main", "bindgen", "ci", "com_objects_v3" ] | ||
pull_request: | ||
branches: [ "main", "bindgen", "ci" ] | ||
# all PRs on all branches | ||
|
||
jobs: | ||
concurrency: | ||
# For PRs, later CI runs preempt previous ones. e.g. a force push on a PR | ||
# cancels running CI jobs and starts all new ones. | ||
# | ||
# For non-PR pushes, concurrency.group needs to be unique for every distinct | ||
# CI run we want to have happen. Use run_id, which in practice means all | ||
# non-PR CI runs will be allowed to run without preempting each other. | ||
group: ${{ github.workflow }}-$${{ github.pull_request.number || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
build: | ||
jobs: | ||
build-and-test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
goarch: [ "386", "amd64", "arm64" ] | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21.x' | ||
go-version-file: go.mod | ||
|
||
- name: Install go-winres | ||
run: go install github.com/tc-hib/go-winres@latest | ||
|
||
- name: Set up build directory | ||
run: mkdir -p ./bin | ||
run: | | ||
mkdir -p ./bin/${{ matrix.goarch }} | ||
- name: Build | ||
- name: Build Binaries | ||
run: | | ||
go build -v -o ./bin ./... | ||
go test -c -o ./bin ./... | ||
go build -v -o ./bin/${{ matrix.goarch }} ./... | ||
env: | ||
GOARCH: ${{ matrix.goarch }} | ||
|
||
- name: Bind resources to all binaries | ||
- name: Build Test Binaries | ||
run: | | ||
go test -c -o ./bin/${{ matrix.goarch }} ./... | ||
env: | ||
GOARCH: ${{ matrix.goarch }} | ||
|
||
- name: Bind Resources to All Binaries | ||
shell: bash | ||
run: | | ||
for f in ./bin/*.exe; do | ||
go-winres patch $f | ||
for f in ./bin/${{ matrix.goarch }}/*.exe; do | ||
go-winres patch ${f} | ||
done | ||
- name: Test | ||
run: go test -o ./bin -v ./... | ||
if: ${{ matrix.goarch != arm64 }} | ||
run: | | ||
go test -o ./bin/${{ matrix.goarch }} -v ./... | ||
env: | ||
GOARCH: ${{ matrix.goarch }} |