summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2020-03-21 18:53:42 -0400
committerGitHub <noreply@github.com>2020-03-21 16:53:42 -0600
commitc32f383a0153ea5f53cbccb3f87ed9ffc4da7703 (patch)
tree5d9d34a7813b62d7e43d73865ce6d09ea4d1be04 /.github/workflows
parent37093befd59107316d422fcd3cc011b2481cd2cf (diff)
ci: Use matrix to set per-os variables (#3166)
Simplify cross-platform
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/ci.yml38
1 files changed, 21 insertions, 17 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1bd13fd..247b52e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,6 +18,23 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
go-version: [ 1.14.x ]
+
+ # 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')
+ include:
+ - 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:
@@ -59,19 +76,11 @@ jobs:
run: |
go build -trimpath -a -ldflags="-w -s" -v
- - name: Publish Build Artifact (Windows)
- if: matrix.os == 'windows-latest'
+ - name: Publish Build Artifact
uses: actions/upload-artifact@v1
with:
name: caddy_v2_${{ matrix.os }}
- path: ./cmd/caddy/caddy.exe
-
- - name: Publish Build Artifact (Linux/Mac)
- if: matrix.os != 'windows-latest'
- uses: actions/upload-artifact@v1
- with:
- name: caddy_v2_${{ matrix.os }}
- path: ./cmd/caddy/caddy
+ path: ${{ matrix.CADDY_BIN_PATH }}
# Commented bits below were useful to allow the job to continue
# even if the tests fail, so we can publish the report separately
@@ -93,13 +102,8 @@ jobs:
# (cat ./coverage/coverage.json | gocov-xml) > coverage/coverage.xml
# To return the correct result even though we set 'continue-on-error: true'
- # - name: Coerce correct build result (Windows)
- # if: matrix.os == 'windows-latest' && steps.step_test.outputs.status != 'True'
- # run: |
- # echo "step_test ${{ steps.step_test.outputs.status }}\n"
- # exit 1
- # - name: Coerce correct build result (Linux/Mac)
- # if: matrix.os != 'windows-latest' && steps.step_test.outputs.status != 0
+ # - name: Coerce correct build result
+ # if: matrix.os != 'windows-latest' && steps.step_test.outputs.status != ${{ matrix.SUCCESS }}
# run: |
# echo "step_test ${{ steps.step_test.outputs.status }}\n"
# exit 1