add initial test coverage, build, benchmarks; add more filter options #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17 | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Get dependencies | |
run: go mod download | |
- name: Run tests | |
run: go test -v ./... | |
- name: Run Benchmarks and Store Results | |
run: go test -bench=. -benchmem ./... 2>&1 | tee bench.txt | |
- name: Upload Benchmark Results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: benchmark-results | |
path: bench.txt | |
release: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Calculate Version | |
id: calc_version | |
run: echo "::set-output name=version::$(cat VERSION)" | |
continue-on-error: true | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.calc_version.outputs.version }} | |
release_name: Release ${{ steps.calc_version.outputs.version }} | |
draft: false | |
prerelease: false |