Added CI github action for test, build and release

This commit is contained in:
Dmitriy Shishkov 2022-07-08 03:03:47 +03:00
parent b14cc461a3
commit 62d70126c9

61
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,61 @@
name: CI
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Run tests
run: go test -cover -v .
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Build
run: go build -v .
- name: Upload binary to artifacts
uses: actions/upload-artifact@v3
with:
name: gordle-bin
path: ./gordle
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download binary from artifacts
uses: actions/download-artifact@v3
with:
name: gordle-bin
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: gordle
generate_release_notes: true