Go test #538
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 test | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
on: | |
schedule: | |
- cron: '0 10 * * *' | |
# If any commit message in your push or the HEAD commit of your PR contains the strings | |
# [skip ci], [ci skip], [no ci], [skip actions], or [actions skip] | |
# workflows triggered on the push or pull_request events will be skipped. | |
# https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/ | |
push: | |
branches: [ master ] | |
# Publish semver tags as releases. | |
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] | |
# If any commit message in your push or the HEAD commit of your PR contains the strings | |
# [skip ci], [ci skip], [no ci], [skip actions], or [actions skip] | |
# workflows triggered on the push or pull_request events will be skipped. | |
# https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/ | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: none | |
checks: none | |
contents: read | |
deployments: none | |
issues: none | |
discussions: none | |
packages: none | |
pull-requests: none | |
repository-projects: none | |
security-events: none | |
statuses: none | |
steps: | |
# This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it. | |
# https://github.com/actions/checkout | |
- | |
name: Checkout repository | |
id: checkout | |
# You may pin to the exact commit or the version. | |
# uses: https://github.com/actions/checkout/tags | |
uses: actions/checkout@v3 | |
# This action sets up a go environment for use in actions by: | |
# - Optionally downloading and caching a version of Go by version and adding to PATH. | |
# - Registering problem matchers for error output. | |
# https://github.com/actions/setup-go | |
- | |
name: Setup Golang | |
id: setup-go | |
# You may pin to the exact commit or the version. | |
# uses: https://github.com/actions/setup-go/tags | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "stable" | |
go-version-file: './go.mod' | |
cache: true | |
# A GitHub Action for golang tests | |
- | |
name: Golang Tests | |
id: go-tests | |
run: | | |
go version | |
rm -rf example | |
go test -v -race -covermode=atomic -coverprofile=coverage.out ./... | |
go tool cover -html=coverage.out -o coverage.html | |
# https://github.com/apache/skywalking-eyes | |
# issue: go version hard-coded: https://github.com/apache/skywalking-eyes/blob/5dfa68f93380a5e57259faaf95088b7f133b5778/header/action.yml#L47-L51 | |
- name: Check License Header | |
uses: apache/skywalking-eyes/header@main | |
with: | |
log: "info" # optional: set the log level. The default value is `info`. | |
config: ".licenserc.yaml" # optional: set the config file. The default value is `.licenserc.yaml`. | |
token: "" # optional: the token that license eye uses when it needs to comment on the pull request. Set to empty ("") to disable commenting on pull request. The default value is ${{ github.token }} | |
mode: "check" # optional: Which mode License-Eye should be run in. Choices are `check` or `fix`. The default value is `check`. |