Update ci.yml #6
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
name: CI Pipeline | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [1.22.x] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
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 }}" == "ubuntu-latest" ]; 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 }}" == "macos-latest" ]; then | |
GOOS=darwin GOARCH=${{ matrix.arch }} go build -o run-all-macos-${{ matrix.arch }} ./cmd/run-all | |
zip run-all-macos-${{ matrix.arch }}.zip run-all-macos-${{ matrix.arch }} | |
elif [ "${{ matrix.os }}" == "windows-latest" ]; 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 }}" == "ubuntu-latest" ]; then | |
shasum -a 256 run-all-linux-${{ matrix.arch }}.zip > run-all-linux-${{ matrix.arch }}.zip.sha256 | |
elif [ "${{ matrix.os }}" == "macos-latest" ]; then | |
shasum -a 256 run-all-macos-${{ matrix.arch }}.zip > run-all-macos-${{ matrix.arch }}.zip.sha256 | |
elif [ "${{ matrix.os }}" == "windows-latest" ]; then | |
shasum -a 256 run-all-windows-${{ matrix.arch }}.zip > run-all-windows-${{ matrix.arch }}.zip.sha256 | |
fi | |
shell: bash | |
- 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 |