From 379b52295e594f1d1f8e43fc830a7724827dfc32 Mon Sep 17 00:00:00 2001 From: Emmm Monster <58943012+emmmx@users.noreply.github.com> Date: Mon, 22 Feb 2021 00:14:53 +0800 Subject: [PATCH] CI: [GitHub Actions] Build --- .github/workflows/build.yml | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5c2eafe --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,52 @@ +name: Build +on: + push: + branches: [ master ] + paths: + - "**/*.go" + - "go.mod" + - "go.sum" + pull_request: + branches: [ master ] + types: [ opened, synchronize, reopened ] + paths: + - "**/*.go" + - "go.mod" + - "go.sum" + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ windows-latest, ubuntu-latest, macos-latest ] + include: + - os: ubuntu-latest + BIN_SUFFIX: + - os: macos-latest + BIN_SUFFIX: + - os: windows-latest + BIN_SUFFIX: .exe + steps: + - name: Checkout codebase + uses: actions/checkout@v2 + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.16 + + - name: Setup vars + id: vars + run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" + + - name: Build + env: + CGO_ENABLED: 0 + run: go build -trimpath -ldflags="-w -s" -v -o um-${{ runner.os }}${{ matrix.BIN_SUFFIX }} ./cmd/um + + - name: Publish artifact + uses: actions/upload-artifact@v2 + with: + name: um-${{ runner.os }}${{ matrix.BIN_SUFFIX }} + path: ./um-${{ runner.os }}${{ matrix.BIN_SUFFIX }}