Skip to content

Instantly share code, notes, and snippets.

@irwinby
Created July 8, 2022 17:06
Show Gist options
  • Save irwinby/36a80ddfe994b5546d9c2a92d3989bb9 to your computer and use it in GitHub Desktop.
Save irwinby/36a80ddfe994b5546d9c2a92d3989bb9 to your computer and use it in GitHub Desktop.
An example of GitHub Actions for the Go application
name: "[lint, test, build]"
on: [push, pull_request]
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Setup Go environment
uses: actions/setup-go@v3.2.0
with:
go-version: 1.18.x
- name: Checkout repository
uses: actions/checkout@v2.4.2
- name: Run linters
uses: golangci/golangci-lint-action@v3.2.0
with:
version: v1.45.2
test:
name: test
runs-on: ubuntu-latest
steps:
- name: Setup Go environment
uses: actions/setup-go@v3.2.0
with:
go-version: 1.18.x
- name: Checkout repository
uses: actions/checkout@v2.4.2
- name: Run unit tests
run: go test -covermode=atomic -v -race ./...
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Setup Go environment
uses: actions/setup-go@v3.2.0
with:
go-version: 1.18.x
- name: Checkout repository
uses: actions/checkout@v2.4.2
- name: Build binary file
run: go build -o {BINARY_NAME} main.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment