v1.8 RC #201
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: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Build | |
run: go build -v ./... | |
- uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-2go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-2go- | |
- name: Run Test | |
env: | |
WALLET_SEED: ${{ secrets.WALLET_SEED }} | |
run: | | |
go test -v $(go list ./... | grep -v /example/) -covermode=count -coverprofile=coverage.out | |
go tool cover -func=coverage.out -o=coverage.out | |
- name: Go Coverage Badge # Pass the `coverage.out` output to this action | |
uses: tj-actions/[email protected] | |
with: | |
filename: coverage.out | |
- name: Verify Changed files | |
uses: tj-actions/[email protected] | |
id: verify-changed-files | |
with: | |
files: README.md | |
- name: Commit changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' && github.ref != 'refs/heads/master' | |
run: | | |
git add README.md | |
git config --global user.email "[email protected]" | |
git config --global user.name "Coverage" | |
git commit -m "Updated coverage badge" | |
- name: Push changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' && github.ref != 'refs/heads/master' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ github.token }} | |
branch: ${{ github.head_ref }} |