From 131aa7c6f1b9eff5fe0c0730e6c626eb123a30ba Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 29 Jul 2020 03:04:39 +0300 Subject: [PATCH 1/8] ci: include tracking of GOOS for which Caddy fails to build --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67e15d4dce4..ec26b0059c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,6 +120,52 @@ 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 From ce335bcbb686eadd7f48d656ad30e0d9b04c4178 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 29 Jul 2020 18:51:42 +0300 Subject: [PATCH 2/8] ci: split cross-build check into separate workflow --- .github/workflows/ci.yml | 48 +---------------------------- .github/workflows/cross-build.yml | 51 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/cross-build.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec26b0059c9..244563b94b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ # Used as inspiration: https://github.com/mvdan/github-actions-golang -name: Cross-Platform +name: Cross-Platform Tests on: push: @@ -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 diff --git a/.github/workflows/cross-build.yml b/.github/workflows/cross-build.yml new file mode 100644 index 00000000000..e2738c387c4 --- /dev/null +++ b/.github/workflows/cross-build.yml @@ -0,0 +1,51 @@ +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-${{ matrix.goos }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + cross-build-go-${{ matrix.goos }} + - name: Checkout code into the Go module directory + uses: actions/checkout@v2 + - name: Run Build + env: + CGO_ENABLED: 0 + GOOS: ${{ matrix.goos }} + shell: bash + working-directory: ./cmd/caddy + run: | + GOOS=$GOOS go build -trimpath -o caddy-"$GOOS"-amd64 From c7c62637bfaedf22204a9e642dfa936836708466 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 29 Jul 2020 19:24:44 +0300 Subject: [PATCH 3/8] ci: cross-build check: make it clear the cross-build check is not a blocker --- .github/workflows/cross-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cross-build.yml b/.github/workflows/cross-build.yml index e2738c387c4..3d75974296f 100644 --- a/.github/workflows/cross-build.yml +++ b/.github/workflows/cross-build.yml @@ -1,4 +1,4 @@ -name: Cross-Build Check +name: Cross-Build (Advisory Check) on: push: From c9e85b8d6574b2ec5567c60c228c4ae7d010d100 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 29 Jul 2020 21:08:02 +0300 Subject: [PATCH 4/8] ci: cross-build check: set annotation instead of failing the build --- .github/workflows/cross-build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cross-build.yml b/.github/workflows/cross-build.yml index 3d75974296f..8188cad71e9 100644 --- a/.github/workflows/cross-build.yml +++ b/.github/workflows/cross-build.yml @@ -49,3 +49,7 @@ jobs: working-directory: ./cmd/caddy run: | GOOS=$GOOS go build -trimpath -o caddy-"$GOOS"-amd64 + if [ $? -ne 0 ]; then + echo "::warning ::$GOOS Build Failed" + exit 0 + fi From 2b479f7a615f27642d0211ab11d071cb87bb9915 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 29 Jul 2020 21:26:00 +0300 Subject: [PATCH 5/8] ci: cross-build check: explicitly set continue-on-error to force success marker --- .github/workflows/cross-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cross-build.yml b/.github/workflows/cross-build.yml index 8188cad71e9..afd576cb187 100644 --- a/.github/workflows/cross-build.yml +++ b/.github/workflows/cross-build.yml @@ -46,6 +46,7 @@ jobs: 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 From fd324897479cadcb49ef85f0fd309dc417fbc0bc Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Thu, 30 Jul 2020 17:29:01 +0300 Subject: [PATCH 6/8] ci: cross-build check: redirect stderr to stdout to avoid unintended annotations --- .github/workflows/cross-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cross-build.yml b/.github/workflows/cross-build.yml index afd576cb187..0928da4b76f 100644 --- a/.github/workflows/cross-build.yml +++ b/.github/workflows/cross-build.yml @@ -49,7 +49,7 @@ jobs: continue-on-error: true working-directory: ./cmd/caddy run: | - GOOS=$GOOS go build -trimpath -o caddy-"$GOOS"-amd64 + GOOS=$GOOS go build -trimpath -o caddy-"$GOOS"-amd64 2>&1 if [ $? -ne 0 ]; then echo "::warning ::$GOOS Build Failed" exit 0 From 61e85d9e6c177415d73dfe23ec29bee572918ce1 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Thu, 30 Jul 2020 17:48:59 +0300 Subject: [PATCH 7/8] ci: cross-build check: send stderr to /dev/null --- .github/workflows/cross-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cross-build.yml b/.github/workflows/cross-build.yml index 0928da4b76f..e62ffdc33b5 100644 --- a/.github/workflows/cross-build.yml +++ b/.github/workflows/cross-build.yml @@ -49,7 +49,7 @@ jobs: continue-on-error: true working-directory: ./cmd/caddy run: | - GOOS=$GOOS go build -trimpath -o caddy-"$GOOS"-amd64 2>&1 + GOOS=$GOOS go build -trimpath -o caddy-"$GOOS"-amd64 2> /dev/null if [ $? -ne 0 ]; then echo "::warning ::$GOOS Build Failed" exit 0 From c7cad269a3c192c0053eb871b6155ee71f042b06 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Thu, 30 Jul 2020 23:10:36 +0300 Subject: [PATCH 8/8] Simplify workflow names Co-authored-by: Francis Lavoie --- .github/workflows/ci.yml | 2 +- .github/workflows/cross-build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 244563b94b2..8584455ba5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ # Used as inspiration: https://github.com/mvdan/github-actions-golang -name: Cross-Platform Tests +name: Tests on: push: diff --git a/.github/workflows/cross-build.yml b/.github/workflows/cross-build.yml index e62ffdc33b5..a935cbaba5f 100644 --- a/.github/workflows/cross-build.yml +++ b/.github/workflows/cross-build.yml @@ -1,4 +1,4 @@ -name: Cross-Build (Advisory Check) +name: Cross-Build on: push: