Skip to content

Commit

Permalink
Fix many issues with github workflows (#6)
Browse files Browse the repository at this point in the history
For example: the coverage action doesn't work on macos, we don't have a
self-hosted-arm64 instance, and others.

Also, refactor some names so the UI looks nicer.
  • Loading branch information
joshklop authored Apr 8, 2024
1 parent aeb9fdb commit d394fea
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
Expand All @@ -13,15 +11,16 @@ permissions:
pull-requests: read

jobs:
golangci:
name: golangci
go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
# Required when using setup-go@v5, which enables caching by default.
# https://github.com/golangci/golangci-lint-action/issues/677
cache: false
- uses: golangci/golangci-lint-action@v4
with:
version: v1.57.2
27 changes: 15 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@ on:
workflow_dispatch:

jobs:
test:
name: coverage profile
strategy:
fail-fast: false
matrix:
go: [ '1.22' ]
os: [ ubuntu-latest, macos-latest, self-hosted-linux-arm64]
runs-on: ${{ matrix.os }}
simple:
# Tests will run on Ubuntu when we generate the coverage profile.
# The go-test-coverage action doesn't work on Mac.
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: generate test coverage
run: make install-go-test-coverage && make cover.out
- name: check test coverage
uses: vladopajic/go-test-coverage@v2
- run: make test

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: make cover.out
- uses: vladopajic/go-test-coverage@v2
with:
config: .testcoverage.yml
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ install-go-test-coverage:

$(COVER_OUT):
go test ./... -coverprofile=$@ -covermode=atomic -coverpkg=./...

.PHONY: check-cover
check-cover: $(COVER_OUT)
${GOBIN}/go-test-coverage --config=./.testcoverage.yml

$(COVER_HTML): $(COVER_OUT)
Expand Down

0 comments on commit d394fea

Please sign in to comment.