Co-authored-by: hashicorp-tsccr[bot] <hashicorp-tsccr[bot]@users.noreply.github.com>
46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
name: test
|
|
|
|
on:
|
|
- push
|
|
- pull_request
|
|
- workflow_dispatch
|
|
- workflow_call
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Determine go version
|
|
id: get-go-version
|
|
# We use .go-version as our source of truth for current Go
|
|
# version, because "goenv" can react to it automatically.
|
|
run: |
|
|
echo "Building with Go $(cat .go-version)"
|
|
echo "go-version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
|
|
- name: Set up Go
|
|
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
|
|
with:
|
|
go-version: "${{ steps.get-go-version.outputs.go-version }}"
|
|
cache: false
|
|
- name: Determine Go cache paths
|
|
id: go-cache-paths
|
|
run: |
|
|
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
|
|
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
|
|
- name: Set up Go modules cache
|
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
|
with:
|
|
path: |
|
|
${{ steps.go-cache-paths.outputs.go-build }}
|
|
${{ steps.go-cache-paths.outputs.go-mod }}
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go
|
|
- name: Acceptance Tests
|
|
run: |
|
|
make testacc
|