Main #56
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: Main | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: "0 14 * * MON" | |
jobs: | |
test: | |
name: Test and report coverage | |
runs-on: ubuntu-latest | |
env: | |
COVERAGE_DIR: COVERAGE | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.x | |
- name: Run tests | |
run: | | |
mkdir "$COVERAGE_DIR" | |
go test \ | |
-coverprofile="${COVERAGE_DIR}/main" \ | |
-race \ | |
-v \ | |
./... | |
- name: Merge coverage profiles | |
run: | | |
go install github.com/wadey/gocovmerge@latest | |
gocovmerge $(find "$COVERAGE_DIR" -type f) > coverage.out | |
- name: Show per-function coverage profile | |
run: go tool cover -func=coverage.out | |
- name: Convert coverage profile to lcov format | |
uses: jandelgado/[email protected] | |
with: | |
infile: coverage.out | |
outfile: coverage.lcov | |
- name: Report to Coveralls | |
uses: coverallsapp/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
golangci-lint: | |
name: golangci-lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.x | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
prettier: | |
name: Prettier | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Run Prettier | |
uses: creyD/[email protected] | |
with: | |
dry: true | |
prettier_options: --check . |