Refine TestBodyWrapper_GetBody #1174
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: build | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- master | |
- v* | |
push: | |
branches: | |
- master | |
- v* | |
tags: | |
- v* | |
jobs: | |
build: | |
strategy: | |
matrix: | |
go: [1.19, 1.x] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
name: Go ${{ matrix.go }} ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4.0.1 | |
with: | |
go-version: ${{ matrix.go }} | |
cache: true | |
- name: Build | |
run: go get -v ./... | |
- name: Run tests | |
run: go test ./... | |
examples: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
name: Examples ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4.0.1 | |
with: | |
go-version: 1.x | |
cache: true | |
- name: Build | |
run: cd _examples && go get -v . | |
- name: Run tests | |
run: cd _examples && go test | |
formatting: | |
runs-on: ubuntu-latest | |
name: Formatting | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.x | |
- name: Check root | |
uses: Jerome1337/gofmt-action@v1.0.5 | |
with: | |
gofmt-path: . | |
gofmt-flags: '-s -l' | |
- name: Check e2e | |
uses: Jerome1337/gofmt-action@v1.0.5 | |
with: | |
gofmt-path: e2e | |
gofmt-flags: '-s -l' | |
- name: Check examples | |
uses: Jerome1337/gofmt-action@v1.0.5 | |
with: | |
gofmt-path: _examples | |
gofmt-flags: '-s -l' | |
linters: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- name: root | |
dir: . | |
- name: examples | |
dir: _examples | |
name: Linters for ${{ matrix.name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4.0.1 | |
with: | |
go-version: 1.x | |
cache: false | |
- name: Run linters | |
uses: golangci/golangci-lint-action@v3 | |
timeout-minutes: 20 | |
with: | |
version: v1.51.2 | |
working-directory: ${{ matrix.dir }} | |
args: --timeout=20m | |
coverage: | |
runs-on: ubuntu-latest | |
needs: [build, examples, formatting, linters] | |
name: Coverage | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4.0.1 | |
with: | |
go-version: 1.x | |
cache: true | |
- name: Run tests | |
run: go test -covermode=count -coverprofile=coverage.out -coverpkg=. ./... | |
- name: Prepare coverage report | |
uses: jandelgado/gcov2lcov-action@v1.0.9 | |
- name: Send coverage report | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: coverage.lcov |