-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: CI Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
go-version: [1.22.x] | ||
os: [linux, darwin, windows] | ||
arch: [amd64, arm64] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Install dependencies | ||
run: go mod tidy | ||
|
||
- name: Run unit tests | ||
run: go test -v ./... | ||
|
||
- name: Build binaries | ||
run: | | ||
if [ "${{ matrix.os }}" == "linux" ]; then | ||
GOOS=linux GOARCH=${{ matrix.arch }} go build -o run-all-linux-${{ matrix.arch }} ./cmd/run-all | ||
zip run-all-linux-${{ matrix.arch }}.zip run-all-linux-${{ matrix.arch }} | ||
elif [ "${{ matrix.os }}" == "darwin" ]; then | ||
GOOS=darwin GOARCH=${{ matrix.arch }} go build -o run-all-darwin-${{ matrix.arch }} ./cmd/run-all | ||
zip run-all-darwin-${{ matrix.arch }}.zip run-all-darwin-${{ matrix.arch }} | ||
elif [ "${{ matrix.os }}" == "windows" ]; then | ||
GOOS=windows GOARCH=${{ matrix.arch }} go build -o run-all-windows-${{ matrix.arch }}.exe ./cmd/run-all | ||
zip run-all-windows-${{ matrix.arch }}.zip run-all-windows-${{ matrix.arch }}.exe | ||
fi | ||
shell: bash | ||
|
||
- name: Generate SHA256 checksums | ||
run: | | ||
if [ "${{ matrix.os }}" == "linux" ]; then | ||
shasum -a 256 run-all-linux-${{ matrix.arch }}.zip > run-all-linux-${{ matrix.arch }}.zip.sha256 | ||
elif [ "${{ matrix.os }}" == "darwin" ]; then | ||
shasum -a 256 run-all-darwin-${{ matrix.arch }}.zip > run-all-darwin-${{ matrix.arch }}.zip.sha256 | ||
elif [ "${{ matrix.os }}" == "windows" ]; then | ||
shasum -a 256 run-all-windows-${{ matrix.arch }}.zip > run-all-windows-${{ matrix.arch }}.zip.sha256 | ||
fi | ||
shell: bash | ||
|
||
- name: List files (debugging) | ||
run: ls -alh | ||
|
||
- name: Upload zipped binaries and checksums as artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: binaries-${{ matrix.os }}-${{ matrix.arch }} | ||
path: | | ||
run-all-${{ matrix.os }}-${{ matrix.arch }}.zip | ||
run-all-${{ matrix.os }}-${{ matrix.arch }}.zip.sha256 |