mirror of https://github.com/elisescu/tty-share
Add a GH action to build the code for every PR
parent
441eca14dd
commit
8cdcbfcabe
@ -1,22 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15
|
||||
|
||||
- name: Build
|
||||
run: go build -x -v -mod=vendor -ldflags "-X main.version=0.0.1" && test $(./tty-share --version) = 0.0.1
|
@ -0,0 +1,61 @@
|
||||
---
|
||||
name: check the code builds
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# build targets
|
||||
include:
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
- goos: linux
|
||||
goarch: '386'
|
||||
- goos: darwin
|
||||
goarch: amd64
|
||||
steps:
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
lfs: true
|
||||
fetch-depth: 0
|
||||
- name: Set up Golang
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.18
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.13.0
|
||||
|
||||
- name: Build stage
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
|
||||
run: |
|
||||
# TODO: figure out how to get go-bindata here
|
||||
# make -C server
|
||||
v=$(echo ${GITHUB_REF} | awk -F/ '{print substr($3,2,10);}')
|
||||
go build -x -v -mod=vendor -ldflags "-X main.version=${v} -w -s" -o "tty-share_${GOOS}-${GOARCH}"
|
||||
|
||||
- name: Upload to artifact storage
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: tty-share_${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
if-no-files-found: error
|
||||
# only meant for sharing with the publish job
|
||||
retention-days: 1
|
||||
|
||||
publish:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: tty-share_*
|
Loading…
Reference in New Issue