-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e28e4f
commit 11ca27d
Showing
4 changed files
with
18 additions
and
35 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,31 @@ | ||
name: Unit Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
type: string | ||
skipRefCheck: | ||
type: boolean | ||
default: true | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ~1.20.0 | ||
|
||
- name: Run Unit Tests | ||
if: | ||
(github.event_name == 'repository_dispatch' && | ||
github.event.client_payload.slash_command.args.named.sha != '' && | ||
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.args.named.sha)) || | ||
inputs.skipRefCheck | ||
run: go test -race -v ./... | ||
run: go test -race -v ./... -coverprofile=coverage.out | ||
|
||
- name: Convert coverage to lcov | ||
uses: jandelgado/gcov2lcov-action@c680c0f7c7442485f1749eb2a13e54a686e76eb5 #v1.0.8 | ||
|
||
- name: Ensure ref | ||
uses: actions/github-script@v6 | ||
if: ${{ !((github.event_name == 'repository_dispatch' && github.event.client_payload.slash_command.args.named.sha != '' && contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.args.named.sha)) || inputs.skipRefCheck) }} | ||
- name: Coveralls | ||
uses: coverallsapp/github-action@95b1a2355bd0e526ad2fd62da9fd386ad4c98474 #v2.2.1 | ||
with: | ||
script: core.setFailed('Ref is not latest') | ||
flag-name: unit-test | ||
path-to-lcov: coverage.lcov | ||
|
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