mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-18 22:11:39 -04:00
67 lines
2.0 KiB
YAML
67 lines
2.0 KiB
YAML
#
|
|
# This GitHub action runs Packer go tests across
|
|
# Windows, Linux, and MacOS runners.
|
|
#
|
|
|
|
name: "Go Test"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
- release/**
|
|
- feature/**
|
|
pull_request:
|
|
|
|
env:
|
|
PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
get-go-version:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
go-version: ${{ steps.get-go-version.outputs.go-version }}
|
|
steps:
|
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
- name: 'Determine Go version'
|
|
id: get-go-version
|
|
run: |
|
|
echo "Found Go $(cat .go-version)"
|
|
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT
|
|
linux-go-tests:
|
|
needs:
|
|
- get-go-version
|
|
runs-on: ubuntu-latest
|
|
name: Linux go tests
|
|
steps:
|
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
|
with:
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
|
- run: TESTARGS="-coverprofile=coverage.txt -covermode=atomic" make ci
|
|
darwin-go-tests:
|
|
needs:
|
|
- get-go-version
|
|
runs-on: macos-latest
|
|
name: Darwin go tests
|
|
steps:
|
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
|
with:
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
|
- run: go test ./... -coverprofile=coverage.txt -covermode=atomic
|
|
windows-go-tests:
|
|
needs:
|
|
- get-go-version
|
|
runs-on: windows-latest
|
|
name: Windows go tests
|
|
steps:
|
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
|
with:
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
|
- run: go test ./... -coverprofile=coverage.txt -covermode=atomic
|