Merge pull request #430 from qnnn/master #263
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: | |
push: | |
branches: | |
- master | |
paths: | |
- 'go.mod' | |
- 'go.sum' | |
- '*.go' | |
- '*/*.go' | |
- '*/*/*.go' | |
- '*/*/*/*.go' | |
- '*/*/*/*/*.go' | |
- '*/*/*/*/*/*.go' | |
- '*/*/*/*/*/*/*.go' | |
- '*/*/*/*/*/*/*/*.go' | |
pull_request: | |
branches: | |
- master | |
paths: | |
- 'go.mod' | |
- 'go.sum' | |
- '*.go' | |
- '*/*.go' | |
- '*/*/*.go' | |
- '*/*/*/*.go' | |
- '*/*/*/*/*.go' | |
- '*/*/*/*/*/*.go' | |
- '*/*/*/*/*/*/*.go' | |
- '*/*/*/*/*/*/*/*.go' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GO111MODULE: on | |
GOLANGCI_LINT_VERSION: v1.49.0 | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
id: go | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Cache Go modules | |
uses: actions/cache@v3 | |
id: cache-go-mod | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Cache bin directory | |
id: cache-go-bin | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/bin | |
key: ${{ runner.os }}-go-bin-${{ env.GOLANGCI_LINT_VERSION }} | |
- name: Install tparse | |
if: steps.cache-go-bin.outputs.cache-hit != 'true' | |
run: go install github.com/mfridman/tparse | |
- name: Install golangci-lint | |
if: steps.cache-go-bin.outputs.cache-hit != 'true' | |
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $HOME/go/bin $GOLANGCI_LINT_VERSION | |
- name: Lint | |
run: $HOME/go/bin/golangci-lint run --timeout=2m ./... | |
- name: Test | |
run: go test -failfast -race -covermode=atomic -coverprofile=coverage.txt -cover -json ./... | $HOME/go/bin/tparse | |
build_docker_image: | |
name: Build Docker image from latest tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Build image | |
run: docker build https://github.com/bojand/ghz.git | |
env: | |
DOCKER_BUILDKIT: '1' |