Skip to content

added unit tests

added unit tests #115

name: build_and_release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build_and_release:
strategy:
fail-fast: false
matrix:
go: [1.21]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
name: Build and release gh-gr
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install upx
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
- name: Install go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Install go tools
run: |
go install golang.org/x/tools/gopls@latest && \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && \
go install github.com/axw/gocov/gocov@latest
- name: Export Module Name
id: export_module_name
run: echo "MODULE_NAME=$(go mod edit -json | jq -r '.Module.Path')" >> "$GITHUB_OUTPUT"
- name: Run linters
run: gofmt -s -d ./ && golangci-lint run -v -e printf
- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v5.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_REPORTER_ID }}
with:
coverageCommand: gocov test ./... -coverprofile=c.out
coverageLocations: ./c.out:gocov
debug: true
prefix: ${{ steps.export_module_name.outputs.MODULE_NAME }}
- name: Precompile binaries and upload assets
uses: cli/gh-extension-precompile@v1
with:
build_script_override: "scripts/build.sh"
go_version: ${{ matrix.go }}
- name: Update code documentation
run: curl -fsSL https://proxy.golang.org/${{ steps.export_module_name.outputs.MODULE_NAME }}/@v/${{ github.ref_name }}.info