feat(gha): support macos #1156
Workflow file for this run
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: | |
pull_request: | |
branches: | |
- master | |
- v* | |
push: | |
branches: | |
- master | |
- v* | |
tags: | |
- v* | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
go: [1.17, 1.x] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
name: Go ${{ matrix.go }} OS ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Build | |
run: go get -v ./... | |
- name: Run tests | |
run: go test ./... | |
examples: | |
runs-on: ubuntu-latest | |
name: Examples | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.x | |
- 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/[email protected] | |
with: | |
gofmt-path: . | |
gofmt-flags: '-s -l' | |
- name: Check e2e | |
uses: Jerome1337/[email protected] | |
with: | |
gofmt-path: e2e | |
gofmt-flags: '-s -l' | |
- name: Check examples | |
uses: Jerome1337/[email protected] | |
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@v3 | |
with: | |
go-version: 1.x | |
- name: Run linters | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.51.2 | |
working-directory: ${{ matrix.dir }} | |
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@v3 | |
with: | |
go-version: 1.x | |
- name: Run tests | |
run: go test -covermode=count -coverprofile=coverage.out -coverpkg=. ./... | |
- name: Prepare coverage report | |
uses: jandelgado/[email protected] | |
- name: Send coverage report | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: coverage.lcov |