Initial commit #1
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
strategy: | |
# Default is true, cancels jobs for other platforms in the matrix if one fails | |
fail-fast: false | |
matrix: | |
os: | |
- linux | |
- mac | |
- windows | |
go: | |
- '1.23' | |
include: | |
- go: '1.23' | |
GO_SEMVER: '~1.23.0' | |
# Set some variables per OS, usable via ${{ matrix.VAR }} | |
# OS_LABEL: the VM label from GitHub Actions (see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories) | |
# CADDY_BIN_PATH: the path to the compiled Caddy binary, for artifact publishing | |
# SUCCESS: the typical value for $? per OS (Windows/pwsh returns 'True') | |
- os: linux | |
OS_LABEL: ubuntu-latest | |
- os: mac | |
OS_LABEL: macos-14 | |
- os: windows | |
OS_LABEL: windows-latest | |
runs-on: ${{ matrix.OS_LABEL }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.GO_SEMVER }} | |
check-latest: true | |
- name: Print Go version and environment | |
id: vars | |
shell: bash | |
run: | | |
printf "Using go at: $(which go)\n" | |
printf "Go version: $(go version)\n" | |
printf "\n\nGo environment:\n\n" | |
go env | |
printf "\n\nSystem environment:\n\n" | |
env | |
printf "Git version: $(git version)\n\n" | |
# Calculate the short SHA hash of the git commit | |
echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Run tests | |
run: | | |
go test -v -race ./... |