2020-08-01 15:23:22 -05:00
|
|
|
name: Cross-Build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2021-05-11 23:26:16 -05:00
|
|
|
- 2.*
|
2020-08-01 15:23:22 -05:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2021-05-11 23:26:16 -05:00
|
|
|
- 2.*
|
2020-08-01 15:23:22 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
cross-build-test:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
goos: ['android', 'linux', 'solaris', 'illumos', 'dragonfly', 'freebsd', 'openbsd', 'plan9', 'windows', 'darwin', 'netbsd']
|
2023-02-06 11:29:20 -05:00
|
|
|
go: [ '1.20' ]
|
2022-04-13 15:03:38 -05:00
|
|
|
|
|
|
|
include:
|
|
|
|
# Set the minimum Go patch version for the given Go minor
|
|
|
|
# Usable via ${{ matrix.GO_SEMVER }}
|
2023-02-06 11:29:20 -05:00
|
|
|
- go: '1.20'
|
2023-02-24 15:45:44 -05:00
|
|
|
GO_SEMVER: '~1.20.1'
|
2022-04-13 15:03:38 -05:00
|
|
|
|
2020-08-01 15:23:22 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
continue-on-error: true
|
|
|
|
steps:
|
|
|
|
- name: Install Go
|
2023-04-01 23:36:16 -05:00
|
|
|
uses: actions/setup-go@v4
|
2020-08-01 15:23:22 -05:00
|
|
|
with:
|
2022-04-13 15:03:38 -05:00
|
|
|
go-version: ${{ matrix.GO_SEMVER }}
|
|
|
|
check-latest: true
|
2020-08-20 21:40:26 -05:00
|
|
|
|
2020-08-01 15:23:22 -05:00
|
|
|
- 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
|
2020-08-20 21:40:26 -05:00
|
|
|
|
2020-08-01 15:23:22 -05:00
|
|
|
- name: Cache the build cache
|
2022-12-19 18:56:52 -05:00
|
|
|
uses: actions/cache@v3
|
2020-08-01 15:23:22 -05:00
|
|
|
with:
|
2022-05-25 12:56:39 -05:00
|
|
|
# In order:
|
|
|
|
# * Module download cache
|
|
|
|
# * Build cache (Linux)
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
~/.cache/go-build
|
2020-08-20 21:40:26 -05:00
|
|
|
key: cross-build-go${{ matrix.go }}-${{ matrix.goos }}-${{ hashFiles('**/go.sum') }}
|
2020-08-01 15:23:22 -05:00
|
|
|
restore-keys: |
|
2020-08-20 21:40:26 -05:00
|
|
|
cross-build-go${{ matrix.go }}-${{ matrix.goos }}
|
|
|
|
|
2020-08-01 15:23:22 -05:00
|
|
|
- name: Checkout code into the Go module directory
|
2022-03-15 17:09:19 -05:00
|
|
|
uses: actions/checkout@v3
|
2020-08-20 21:40:26 -05:00
|
|
|
|
2020-08-01 15:23:22 -05:00
|
|
|
- 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
|