ci: Tweaks for multi go version tests (#3673)

This commit is contained in:
Francis Lavoie 2020-08-20 22:40:26 -04:00 committed by GitHub
parent 997ef522bc
commit ecbc1f85c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 22 deletions

View file

@ -17,7 +17,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ] os: [ ubuntu-latest, macos-latest, windows-latest ]
go-version: [ 1.14.x, 1.15.x ] go: [ '1.14', '1.15' ]
# Set some variables per OS, usable via ${{ matrix.VAR }} # Set some variables per OS, usable via ${{ matrix.VAR }}
# CADDY_BIN_PATH: the path to the compiled Caddy binary, for artifact publishing # CADDY_BIN_PATH: the path to the compiled Caddy binary, for artifact publishing
@ -41,7 +41,7 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go }}
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -69,12 +69,12 @@ jobs:
echo "::set-output name=go_cache::$(go env GOCACHE)" echo "::set-output name=go_cache::$(go env GOCACHE)"
- name: Cache the build cache - name: Cache the build cache
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ${{ steps.vars.outputs.go_cache }} path: ${{ steps.vars.outputs.go_cache }}
key: ${{ runner.os }}-go-ci-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
restore-keys: | restore-keys: |
${{ runner.os }}-go-ci ${{ runner.os }}-${{ matrix.go }}-go-ci
- name: Get dependencies - name: Get dependencies
run: | run: |
@ -91,7 +91,7 @@ jobs:
- name: Publish Build Artifact - name: Publish Build Artifact
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: caddy_v2_${{ runner.os }}_${{ steps.vars.outputs.short_sha }} name: caddy_${{ runner.os }}_go${{ matrix.go }}_${{ steps.vars.outputs.short_sha }}
path: ${{ matrix.CADDY_BIN_PATH }} path: ${{ matrix.CADDY_BIN_PATH }}
# Commented bits below were useful to allow the job to continue # Commented bits below were useful to allow the job to continue
@ -167,7 +167,7 @@ jobs:
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- uses: goreleaser/goreleaser-action@v1 - uses: goreleaser/goreleaser-action@v2
with: with:
version: latest version: latest
args: check args: check

View file

@ -14,14 +14,15 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
goos: ['android', 'linux', 'solaris', 'illumos', 'dragonfly', 'freebsd', 'openbsd', 'plan9', 'windows', 'darwin', 'netbsd'] goos: ['android', 'linux', 'solaris', 'illumos', 'dragonfly', 'freebsd', 'openbsd', 'plan9', 'windows', 'darwin', 'netbsd']
go-version: [ 1.14.x, 1.15.x ] go: [ '1.14', '1.15' ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
continue-on-error: true continue-on-error: true
steps: steps:
- name: Install Go - name: Install Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go }}
- name: Print Go version and environment - name: Print Go version and environment
id: vars id: vars
run: | run: |
@ -32,15 +33,18 @@ jobs:
printf "\n\nSystem environment:\n\n" printf "\n\nSystem environment:\n\n"
env env
echo "::set-output name=go_cache::$(go env GOCACHE)" echo "::set-output name=go_cache::$(go env GOCACHE)"
- name: Cache the build cache - name: Cache the build cache
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ${{ steps.vars.outputs.go_cache }} path: ${{ steps.vars.outputs.go_cache }}
key: cross-build-go-${{ matrix.goos }}-${{ hashFiles('**/go.sum') }} key: cross-build-go${{ matrix.go }}-${{ matrix.goos }}-${{ hashFiles('**/go.sum') }}
restore-keys: | restore-keys: |
cross-build-go-${{ matrix.goos }} cross-build-go${{ matrix.go }}-${{ matrix.goos }}
- name: Checkout code into the Go module directory - name: Checkout code into the Go module directory
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Run Build - name: Run Build
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0

View file

@ -12,14 +12,14 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ ubuntu-latest ] os: [ ubuntu-latest ]
go-version: [ 1.14.x ] go: [ '1.14' ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Install Go - name: Install Go
uses: actions/setup-go@v1 uses: actions/setup-go@v2
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go }}
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2

View file

@ -11,14 +11,14 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ ubuntu-latest ] os: [ ubuntu-latest ]
go-version: [ 1.14.x ] go: [ '1.15' ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Install Go - name: Install Go
uses: actions/setup-go@v1 uses: actions/setup-go@v2
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go }}
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -54,16 +54,16 @@ jobs:
echo "::set-output name=tag_special::${TAG_SPECIAL}" echo "::set-output name=tag_special::${TAG_SPECIAL}"
- name: Cache the build cache - name: Cache the build cache
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ${{ steps.vars.outputs.go_cache }} path: ${{ steps.vars.outputs.go_cache }}
key: ${{ runner.os }}-go-release-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go${{ matrix.go }}-release-${{ hashFiles('**/go.sum') }}
restore-keys: | restore-keys: |
${{ runner.os }}-go-release ${{ runner.os }}-go${{ matrix.go }}-release
# GoReleaser will take care of publishing those artifacts into the release # GoReleaser will take care of publishing those artifacts into the release
- name: Run GoReleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1 uses: goreleaser/goreleaser-action@v2
with: with:
version: latest version: latest
args: release --rm-dist args: release --rm-dist