core: add request and response headers #157
Workflow file for this run
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
# Used as inspiration: https://github.com/mvdan/github-actions-golang | |
name: Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
strategy: | |
# Default is true, cancels jobs for other platforms in the matrix if one fails | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
go: [ '1.21' ] | |
include: | |
# Set the minimum Go patch version for the given Go minor | |
# Usable via ${{ matrix.GO_SEMVER }} | |
- go: '1.21' | |
GO_SEMVER: '~1.21.0' | |
# Set some variables per OS, usable via ${{ matrix.VAR }} | |
# 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: ubuntu-latest | |
CADDY_BIN_PATH: ./cmd/caddy/caddy | |
SUCCESS: 0 | |
- os: macos-latest | |
CADDY_BIN_PATH: ./cmd/caddy/caddy | |
SUCCESS: 0 | |
- os: windows-latest | |
CADDY_BIN_PATH: ./cmd/caddy/caddy.exe | |
SUCCESS: 'True' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.GO_SEMVER }} | |
check-latest: true | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Print Go version and environment | |
id: vars | |
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 SHA1 hash of the git commit | |
echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Cache the build cache | |
uses: actions/cache@v3 | |
with: | |
# 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 | |
~\AppData\Local\go-build | |
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.go }}-go-ci | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
# Commented bits below were useful to allow the job to continue | |
# even if the tests fail, so we can publish the report separately | |
# For info about set-output, see https://stackoverflow.com/questions/57850553/github-actions-check-steps-status | |
- name: Run tests | |
# id: step_test | |
# continue-on-error: true | |
run: | | |
# (go test -v -coverprofile=cover-profile.out -race ./... 2>&1) > test-results/test-result.out | |
go test -v -coverprofile="cover-profile.out" -short -race ./... | |
# echo "status=$?" >> $GITHUB_OUTPUT | |
goreleaser-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- uses: goreleaser/goreleaser-action@v4 | |
with: | |
version: latest | |
args: check | |
env: | |
TAG: ${{ steps.vars.outputs.version_tag }} |