2021-02-21 16:14:53 +00:00
|
|
|
name: Build
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths:
|
|
|
|
- "**/*.go"
|
|
|
|
- "go.mod"
|
|
|
|
- "go.sum"
|
2021-05-16 05:43:36 +00:00
|
|
|
- ".github/workflows/*.yml"
|
2021-02-21 16:14:53 +00:00
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
|
|
|
types: [ opened, synchronize, reopened ]
|
|
|
|
paths:
|
|
|
|
- "**/*.go"
|
|
|
|
- "go.mod"
|
|
|
|
- "go.sum"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
2021-11-11 21:17:06 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-02-21 16:14:53 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
2021-11-11 21:17:06 +00:00
|
|
|
- target: "linux/amd64"
|
|
|
|
GOOS: "linux"
|
|
|
|
GOARCH: "amd64"
|
2021-05-16 04:30:48 +00:00
|
|
|
BIN_SUFFIX: ""
|
2021-11-11 21:17:06 +00:00
|
|
|
- target: "windows/amd64"
|
|
|
|
GOOS: "windows"
|
|
|
|
GOARCH: "amd64"
|
2021-05-16 04:30:48 +00:00
|
|
|
BIN_SUFFIX: ".exe"
|
2021-11-11 21:17:06 +00:00
|
|
|
- target: "darwin/amd64"
|
|
|
|
GOOS: "darwin"
|
|
|
|
GOARCH: "amd64"
|
|
|
|
BIN_SUFFIX: ""
|
|
|
|
|
2021-02-21 16:14:53 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout codebase
|
|
|
|
uses: actions/checkout@v2
|
2021-05-16 05:50:35 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-02-21 16:14:53 +00:00
|
|
|
|
|
|
|
- name: Set up Go 1.x
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-11-11 15:18:17 +00:00
|
|
|
go-version: ^1.17
|
2021-02-21 16:14:53 +00:00
|
|
|
|
|
|
|
- name: Setup vars
|
|
|
|
id: vars
|
2021-05-16 04:30:48 +00:00
|
|
|
run: |
|
|
|
|
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
|
2021-05-16 05:41:13 +00:00
|
|
|
echo "::set-output name=git_tag::$(git describe --tags --always)"
|
2021-02-21 16:14:53 +00:00
|
|
|
|
2021-12-13 20:11:13 +00:00
|
|
|
- name: Test
|
|
|
|
run: go test -v ./...
|
|
|
|
|
2021-02-21 16:14:53 +00:00
|
|
|
- name: Build
|
|
|
|
env:
|
2021-11-11 21:17:06 +00:00
|
|
|
GOOS: ${{ matrix.GOOS }}
|
|
|
|
GOARCH: ${{ matrix.GOARCH }}
|
2021-02-21 16:14:53 +00:00
|
|
|
CGO_ENABLED: 0
|
2021-11-11 21:17:06 +00:00
|
|
|
run: go build -v -trimpath -ldflags="-w -s -X main.AppVersion=${{ steps.vars.outputs.git_tag }}" -o um-${{ matrix.GOOS }}-${{ matrix.GOARCH }}${{ matrix.BIN_SUFFIX }} ./cmd/um
|
2021-02-21 16:14:53 +00:00
|
|
|
|
|
|
|
- name: Publish artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-11-11 21:17:06 +00:00
|
|
|
name: um-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
|
|
|
|
path: ./um-${{ matrix.GOOS }}-${{ matrix.GOARCH }}${{ matrix.BIN_SUFFIX }}
|