Skip to content

Commit

Permalink
ci: split cross-build check into separate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed90 committed Jul 29, 2020
1 parent 131aa7c commit c08c6ac
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 47 deletions.
48 changes: 1 addition & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Used as inspiration: https://github.com/mvdan/github-actions-golang

name: Cross-Platform
name: Cross-Platform Tests

on:
push:
Expand Down Expand Up @@ -120,52 +120,6 @@ jobs:
# echo "step_test ${{ steps.step_test.outputs.status }}\n"
# exit 1

cross-build-check:
name: Cross-Build Check
runs-on: ubuntu-latest
continue-on-error: true
steps:
- 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@v1
with:
path: ${{ steps.vars.outputs.go_cache }}
key: cross-build-go-ci-${{ hashFiles('**/go.sum') }}
restore-keys: |
cross-build-go-ci
- name: Checkout code into the Go module directory
uses: actions/checkout@v2
- name: Run Builds
env:
CGO_ENABLED: '0'
shell: bash
working-directory: ./cmd/caddy
run: |
geese=('android' 'linux' 'solaris' 'illumos' 'dragonfly' 'freebsd' 'openbsd' 'plan9' 'windows' 'darwin' 'netbsd')
failed=()
for GOOS in "${geese[@]}"; do
echo "Building GOOS: $GOOS"
GOOS=$GOOS go build -trimpath -o caddy-"$GOOS"-amd64 || {
echo "Failed: $GOOS"
failed+=("$GOOS")
}
done
if [ ${#failed[@]} -ne 0 ]; then
echo "The following geese failed: " "${failed[@]}"
exit 1
fi
s390x-test:
name: test (s390x on IBM Z)
runs-on: ubuntu-latest
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/cross-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Cross-Build Check

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
cross-build-test:
strategy:
fail-fast: false
matrix:
goos: ['android', 'linux', 'solaris', 'illumos', 'dragonfly', 'freebsd', 'openbsd', 'plan9', 'windows', 'darwin', 'netbsd']
go-version: [ 1.14.x ]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- 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@v1
with:
path: ${{ steps.vars.outputs.go_cache }}
key: cross-build-go-${{ runner.goos }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
cross-build-go-${{ runner.goos }}
- name: Checkout code into the Go module directory
uses: actions/checkout@v2
- name: Run Build
env:
CGO_ENABLED: 0
GOOS: ${{ runner.goos }}
shell: bash
working-directory: ./cmd/caddy
run: go build -trimpath -o caddy-"$GOOS"-amd64

0 comments on commit c08c6ac

Please sign in to comment.