Add workflow to autobuild & test

This commit is contained in:
Tom Wiesing 2023-03-09 12:41:02 +01:00
parent 57b957905e
commit b8b3f82986
No known key found for this signature in database

50
.github/workflows/test.yaml vendored Normal file
View file

@ -0,0 +1,50 @@
name: CI
on: [push, pull_request]
env:
GO_VERSION: '~1.20'
GO_STABLE: 'true'
NODE_VERSION: 18
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
stable: ${{ env.GO_STABLE }}
go-version: ${{ env.GO_VERSION }}
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install go dependencies
run: |
go get -t ./...
go install github.com/tkw1536/gogenlicense/cmd/gogenlicense@latest
- name: Install node dependencies
run: |
cd internal/dis/component/server/assets
yarn install --frozen-lockfile
- name: Run 'go generate ./...'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go generate ./...
- name: Run 'go test ./...'
run: |
go test ./...
- name: Build executable
run: |
go build -o wdcli ./cmd/wdcli
- name: Upload Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
wdcli
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: wdcli
path: wdcli