mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
c3a82f53d5
* ci: Ensure we always check for latest version of Go * Try to force 1.18.1, 1.17.9 * Use includes for the actual go semver * Use `~` for semver here, apparently * Try to make tests still run on 1.18.0 for Mac, for now
70 lines
1.9 KiB
YAML
70 lines
1.9 KiB
YAML
name: Cross-Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- 2.*
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- 2.*
|
|
|
|
jobs:
|
|
cross-build-test:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
goos: ['android', 'linux', 'solaris', 'illumos', 'dragonfly', 'freebsd', 'openbsd', 'plan9', 'windows', 'darwin', 'netbsd']
|
|
go: [ '1.18' ]
|
|
|
|
include:
|
|
# Set the minimum Go patch version for the given Go minor
|
|
# Usable via ${{ matrix.GO_SEMVER }}
|
|
- go: '1.18'
|
|
GO_SEMVER: '~1.18.1'
|
|
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
steps:
|
|
- name: Install Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ matrix.GO_SEMVER }}
|
|
check-latest: true
|
|
|
|
- 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
|
|
echo "::set-output name=go_cache::$(go env GOCACHE)"
|
|
|
|
- name: Cache the build cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.vars.outputs.go_cache }}
|
|
key: cross-build-go${{ matrix.go }}-${{ matrix.goos }}-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
cross-build-go${{ matrix.go }}-${{ matrix.goos }}
|
|
|
|
- name: Checkout code into the Go module directory
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Run Build
|
|
env:
|
|
CGO_ENABLED: 0
|
|
GOOS: ${{ matrix.goos }}
|
|
shell: bash
|
|
continue-on-error: true
|
|
working-directory: ./cmd/caddy
|
|
run: |
|
|
GOOS=$GOOS go build -trimpath -o caddy-"$GOOS"-amd64 2> /dev/null
|
|
if [ $? -ne 0 ]; then
|
|
echo "::warning ::$GOOS Build Failed"
|
|
exit 0
|
|
fi
|