Skip to content

Instantly share code, notes, and snippets.

@theghostmac
Created October 1, 2023 04:35
Show Gist options
  • Save theghostmac/4e3d2a679f9363a1e4b18ab20bad1a38 to your computer and use it in GitHub Desktop.
Save theghostmac/4e3d2a679f9363a1e4b18ab20bad1a38 to your computer and use it in GitHub Desktop.
ci/cd for 3 os and Golang
name: build
on:
workflow_dispatch:
pull_request:
branches:
- master
- v*
push:
branches:
- master
@@ -15,21 +15,21 @@ on:
jobs:
build:
strategy:
matrix:
go: [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/[email protected]
with:
go-version: ${{ matrix.go }}
cache: true
- name: Build
run: go get -v ./...
@@ -38,17 +38,21 @@ jobs:
run: go test ./...
examples:
strategy:
matrix:
go: [1.x]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: Examples ${{ matrix.go }} ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Go
uses: actions/[email protected]
with:
go-version: ${{ matrix.go }}
cache: true
- name: Build
run: cd _examples && go get -v .
@@ -104,12 +108,13 @@ jobs:
uses: actions/checkout@v3
- name: Install Go
uses: actions/[email protected]
with:
go-version: 1.x
- name: Run linters
uses: golangci/golangci-lint-action@v3
timeout-minutes: 5
with:
version: v1.51.2
working-directory: ${{ matrix.dir }}
@@ -124,9 +129,10 @@ jobs:
uses: actions/checkout@v3
- name: Install Go
uses: actions/[email protected]
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/[email protected]
- name: Send coverage report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment