Skip to content

Commit

Permalink
Add test & release flow
Browse files Browse the repository at this point in the history
Signed-off-by: Jo Vandeginste <[email protected]>
  • Loading branch information
jovandeginste committed Feb 23, 2024
1 parent a80f3f0 commit 17dd0a6
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/go-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# .github/workflows/release.yaml

on:
release:
types: [created]

permissions:
contents: write
packages: write

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel:
# linux/386, linux/amd64, linux/arm64,
# windows/386, windows/amd64,
# darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
exclude:
- goarch: arm64
goos: windows
steps:
- uses: actions/checkout@v4
- name: Set BUILD_TIME env
run: echo BUILD_TIME=$(date -u --rfc-3339=seconds) >> ${GITHUB_ENV}

- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
ldflags: |
-X "main.buildTime=${{ env.BUILD_TIME }}"
-X main.gitCommit=${{ github.sha }}
-X main.gitRef=${{ github.ref }}
-X main.gitRefName=${{ github.ref_name }}
-X main.gitRefType=${{ github.ref_type }}
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test the code

on:
push:
branches: ["*"]
pull_request:
branches: ["master"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"

- name: Run Go tests
run: go test -v ./...

0 comments on commit 17dd0a6

Please sign in to comment.