Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
ci: Use matrix to set per-os variables (#3166)
Simplify cross-platform
Francis Lavoie committed
Mar 21, 2020 at 18:53 UTC
c32f383a0153ea5f53cbccb3f87ed9ffc4da7703
1 file changed
+21
-17
.github/workflows/ci.yml
+21
-17
@@ -18,6 +18,23 @@ jobs:
18
matrix:
19
os: [ ubuntu-latest, macos-latest, windows-latest ]
20
go-version: [ 1.14.x ]
21
+
22
+ # Set some variables per OS, usable via ${{ matrix.VAR }}
23
+ # CADDY_BIN_PATH: the path to the compiled Caddy binary, for artifact publishing
24
+ # SUCCESS: the typical value for $? per OS (Windows/pwsh returns 'True')
25
+ include:
26
+ - os: ubuntu-latest
27
+ CADDY_BIN_PATH: ./cmd/caddy/caddy
28
+ SUCCESS: 0
29
+
30
+ - os: macos-latest
31
+ CADDY_BIN_PATH: ./cmd/caddy/caddy
32
+ SUCCESS: 0
33
+
34
+ - os: windows-latest
35
+ CADDY_BIN_PATH: ./cmd/caddy/caddy.exe
36
+ SUCCESS: 'True'
37
+
38
runs-on: ${{ matrix.os }}
39
40
steps:
@@ -59,19 +76,11 @@ jobs:
76
run: |
77
go build -trimpath -a -ldflags="-w -s" -v
78
62
- - name: Publish Build Artifact (Windows)
63
- if: matrix.os == 'windows-latest'
79
+ - name: Publish Build Artifact
80
uses: actions/upload-artifact@v1
81
with:
82
name: caddy_v2_${{ matrix.os }}
67
- path: ./cmd/caddy/caddy.exe
68
-
69
- - name: Publish Build Artifact (Linux/Mac)
70
- if: matrix.os != 'windows-latest'
71
- uses: actions/upload-artifact@v1
72
- with:
73
- name: caddy_v2_${{ matrix.os }}
74
- path: ./cmd/caddy/caddy
83
+ path: ${{ matrix.CADDY_BIN_PATH }}
84
85
# Commented bits below were useful to allow the job to continue
86
# even if the tests fail, so we can publish the report separately
@@ -93,13 +102,8 @@ jobs:
102
# (cat ./coverage/coverage.json | gocov-xml) > coverage/coverage.xml
103
104
# To return the correct result even though we set 'continue-on-error: true'
96
- # - name: Coerce correct build result (Windows)
97
- # if: matrix.os == 'windows-latest' && steps.step_test.outputs.status != 'True'
98
- # run: |
99
- # echo "step_test ${{ steps.step_test.outputs.status }}\n"
100
- # exit 1
101
- # - name: Coerce correct build result (Linux/Mac)
102
- # if: matrix.os != 'windows-latest' && steps.step_test.outputs.status != 0
105
+ # - name: Coerce correct build result
106
+ # if: matrix.os != 'windows-latest' && steps.step_test.outputs.status != ${{ matrix.SUCCESS }}
107
# run: |
108
# echo "step_test ${{ steps.step_test.outputs.status }}\n"
109
# exit 1