Skip to content

go deps: bump to current #30

go deps: bump to current

go deps: bump to current #30

Workflow file for this run

name: Actions CI
# This `name:` is used in the badge.svg rendering in the README.md.
permissions:
# Control the GITHUB_TOKEN permissions.
# By having this block, all permissions not listed here are set to none.
# Available permissions listed at:
# <https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token>
# Which API calls need which permissions at what level, listed at:
# <https://docs.github.com/en/rest/reference/permissions-required-for-github-apps>
#
contents: read
checks: write
statuses: write
on:
push:
branches-ignore:
- 'exp'
- 'exp/*'
- 'exp-*'
- 'exp_*'
- 'wip'
- 'wip/*'
- 'wip-*'
- 'wip_*'
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- go: '1.21.x'
canonical: true
# hunspell requires at least Go 1.17
spellcheck: true
- go: '1.20.x'
canonical: false
spellcheck: false
steps:
- name: Install OS packages
run: |
sudo apt-get -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install -y libhunspell-dev hunspell-en-us
if: matrix.spellcheck
- name: Checkout
uses: actions/checkout@v3
# We're not using release process or version stamping which needs Git History in this workflow.
# Thus we do not need to set with.fetch-depth to 0. We can live with a shallow clone.
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
check-latest: true
- id: go-settings
name: Export Go environment to Actions outputs
run: |
echo >> "$GITHUB_OUTPUT" "arch=$(go env GOARCH)"
echo >> "$GITHUB_OUTPUT" "hostarch=$(go env GOHOSTARCH)"
echo >> "$GITHUB_OUTPUT" "os=$(go env GOOS)"
echo >> "$GITHUB_OUTPUT" "hostos=$(go env GOHOSTOS)"
echo >> "$GITHUB_OUTPUT" "go-version=$(go env GOVERSION)"
# Use with:
# ${{ steps.go-settings.outputs.go-version }}
# which will look like `go1.17.1` if matrix `1.17.x` matches `1.17.1`.
# These are independent of how the matrix is setup, or if a matrix is even used.
- name: Go caches
uses: actions/cache@v3
with:
# (This bit copied from the actions/setup-go@v2 version)
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
# (These bits locally modified:)
key: ${{ runner.os }}-${{ steps.go-settings.outputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ steps.go-settings.outputs.go-version }}-
# In theory, the caches are nowadays multi-version safe.
# In practice, some releases break that; users end up needing to run: go clean --modcache
# But we can't do that, so we just play it safe and accept that the cache is cleaned when the version of Go changes.
- name: Download all Go dependencies
# nb: `go mod download` is heavyweight and extends beyond the actual dependencies
run: |
go list all
- name: Install additional check/lint tools
run: |
go install github.com/kortschak/gospel@latest
if: matrix.spellcheck
- name: Version / Environment Reporting
run: |
./build/show.versions
- name: Basic Go integrity checks
run: |
t="$(gofmt -s -l .)"
if [ ".$t" != "." ]; then printf 'gofmt would modify files:\n%s\n' "$t"; exit 1; fi
go vet ./...
t="$(go list -m -retracted -f '{{if .Retracted}}::error file=go.mod::{{.Path}} is retracted{{end}}' all)"
if [ ".$t" != "." ]; then printf '%s\n' "$t"; exit 1; fi
- name: Spelling checks
run: |
t="$(gospel .)"
if [ ".$t" != "." ]; then printf 'gospel found spelling issues:\n%s\n' "$t"; exit 1; fi
if: matrix.spellcheck
# This doesn't actually invoke static checks unless in a pull-request
# Leaving present-but-commented-out as an easy reference.
# - name: Go static checks
# uses: reviewdog/action-staticcheck@v1
# with:
# filter_mode: nofilter
# fail_on_error: true
# if: matrix.canonical
- name: Go build & test
run: |
go build ./...
go test -v -coverprofile=${{ runner.temp }}/profile.cov -coverpkg ./... ./...
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: ${{ runner.temp }}/profile.cov
flag-name: Go-${{ matrix.go }}
parallel: true
finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: coveralls.io completion notification
uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true
- name: Notify PT Slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_PT_AUTOBUILDS }}