处理区块分叉流程下VerifyHeader的逻辑 #830
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: unittest | |
on: | |
pull_request: | |
branches: '**' | |
env: | |
GO111MODULE: on | |
jobs: | |
test: | |
name: Build | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.16 | |
id: go | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
- name: Build | |
run: make all | |
- name: Test | |
run: go test -tags=test -covermode=atomic -coverprofile=coverage.txt `go list ./...` | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.txt | |
flags: unittests | |
name: codecov-umbrella | |
- name: Archive code coverage results | |
if: github.event.pull_request.head.repo.fork == false | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: coverage.txt | |
sonarCloudTrigger: | |
name: SonarCloud Trigger | |
if: github.event.pull_request.head.repo.fork == false | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@master | |
- name: Download code coverage results | |
uses: actions/download-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: coverage.txt | |
- name: Analyze with SonarCloud | |
uses: sonarsource/sonarcloud-github-action@master | |
with: | |
args: -X | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |