From 146ced41bb51e968a0d05f8a50b0d1c7537bf423 Mon Sep 17 00:00:00 2001 From: Richard Weston Date: Fri, 10 Jun 2022 20:52:38 +0100 Subject: [PATCH 1/5] ci: Add actions to bump go version --- .github/workflows/cd.release.yml | 19 +++++++++++++++++-- .github/workflows/ci.build.yml | 19 +++++++++++++++++-- .github/workflows/ci.lint_test.yml | 17 +++++++++++++++-- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cd.release.yml b/.github/workflows/cd.release.yml index a1ddbb0..6faf021 100644 --- a/.github/workflows/cd.release.yml +++ b/.github/workflows/cd.release.yml @@ -7,9 +7,23 @@ on: - "*" jobs: + go-versions: + name: Lookup go versions + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.versions.outputs.matrix }} + steps: + - uses: actions/checkout@v3 + - uses: arnested/go-version-action@v1 + id: versions + goreleaser: name: "CD: Release" runs-on: ubuntu-latest + needs: go-versions + strategy: + matrix: + version: ${{ fromJSON(needs.go-versions.outputs.matrix) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -17,9 +31,10 @@ jobs: fetch-depth: 0 ssh-key: "${{ secrets.DEPLOY_KEY }}" - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: 1.16 + go-version: ${{ matrix.version }} + check-latest: true - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: diff --git a/.github/workflows/ci.build.yml b/.github/workflows/ci.build.yml index d7a0658..13853ca 100644 --- a/.github/workflows/ci.build.yml +++ b/.github/workflows/ci.build.yml @@ -5,18 +5,33 @@ on: pull_request: jobs: + go-versions: + name: Lookup go versions + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.versions.outputs.matrix }} + steps: + - uses: actions/checkout@v3 + - uses: arnested/go-version-action@v1 + id: versions + goreleaser: name: "CI: Build Test Release" runs-on: ubuntu-latest + needs: go-versions + strategy: + matrix: + version: ${{ fromJSON(needs.go-versions.outputs.matrix) }} steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: 1.16 + go-version: ${{ matrix.version }} + check-latest: true - name: Build a test release run: | go build . diff --git a/.github/workflows/ci.lint_test.yml b/.github/workflows/ci.lint_test.yml index 15d5edf..f83fa4d 100644 --- a/.github/workflows/ci.lint_test.yml +++ b/.github/workflows/ci.lint_test.yml @@ -27,17 +27,30 @@ jobs: VALIDATE_GO: true FILTER_REGEX_EXCLUDE: ".*test/.*" + go-versions: + name: Lookup go versions + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.versions.outputs.matrix }} + steps: + - uses: actions/checkout@v3 + - uses: arnested/go-version-action@v1 + id: versions + Test: name: "CI: Go Tests" + needs: go-versions strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] + version: ${{ fromJSON(needs.go-versions.outputs.matrix) }} runs-on: ${{ matrix.os }} steps: - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: 1.16 + go-version: ${{ matrix.version }} + check-latest: true - name: Checkout code uses: actions/checkout@v2 - name: Test From 4dbfa018c6e34b10bdc3c492cfd0de2bd2a7e819 Mon Sep 17 00:00:00 2001 From: Richard Weston Date: Sat, 11 Jun 2022 11:59:00 +0100 Subject: [PATCH 2/5] ci: Adjusted logic to run only latest go version --- .github/workflows/cd.release.yml | 2 +- .github/workflows/ci.build.yml | 2 +- .github/workflows/ci.lint_test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.release.yml b/.github/workflows/cd.release.yml index 6faf021..f976340 100644 --- a/.github/workflows/cd.release.yml +++ b/.github/workflows/cd.release.yml @@ -23,7 +23,7 @@ jobs: needs: go-versions strategy: matrix: - version: ${{ fromJSON(needs.go-versions.outputs.matrix) }} + version: ${{ fromJSON(needs.go-versions.outputs.latest) }} steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/ci.build.yml b/.github/workflows/ci.build.yml index 13853ca..c094701 100644 --- a/.github/workflows/ci.build.yml +++ b/.github/workflows/ci.build.yml @@ -21,7 +21,7 @@ jobs: needs: go-versions strategy: matrix: - version: ${{ fromJSON(needs.go-versions.outputs.matrix) }} + version: ${{ fromJSON(needs.go-versions.outputs.latest) }} steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/ci.lint_test.yml b/.github/workflows/ci.lint_test.yml index f83fa4d..c03586f 100644 --- a/.github/workflows/ci.lint_test.yml +++ b/.github/workflows/ci.lint_test.yml @@ -43,7 +43,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - version: ${{ fromJSON(needs.go-versions.outputs.matrix) }} + version: ${{ fromJSON(needs.go-versions.outputs.latest) }} runs-on: ${{ matrix.os }} steps: - name: Install Go From 896abe5b8cc5a4297621977f05cfd9a2f36d550e Mon Sep 17 00:00:00 2001 From: Richard Weston Date: Sat, 11 Jun 2022 12:02:22 +0100 Subject: [PATCH 3/5] ci: Remove matrix --- .github/workflows/cd.release.yml | 5 +---- .github/workflows/ci.build.yml | 5 +---- .github/workflows/ci.lint_test.yml | 3 +-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cd.release.yml b/.github/workflows/cd.release.yml index f976340..6819b25 100644 --- a/.github/workflows/cd.release.yml +++ b/.github/workflows/cd.release.yml @@ -21,9 +21,6 @@ jobs: name: "CD: Release" runs-on: ubuntu-latest needs: go-versions - strategy: - matrix: - version: ${{ fromJSON(needs.go-versions.outputs.latest) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -33,7 +30,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: ${{ matrix.version }} + go-version: ${{ needs.go-versions.outputs.latest }} check-latest: true - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 diff --git a/.github/workflows/ci.build.yml b/.github/workflows/ci.build.yml index c094701..e711416 100644 --- a/.github/workflows/ci.build.yml +++ b/.github/workflows/ci.build.yml @@ -19,9 +19,6 @@ jobs: name: "CI: Build Test Release" runs-on: ubuntu-latest needs: go-versions - strategy: - matrix: - version: ${{ fromJSON(needs.go-versions.outputs.latest) }} steps: - name: Checkout uses: actions/checkout@v2 @@ -30,7 +27,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: ${{ matrix.version }} + go-version: ${{ needs.go-versions.outputs.latest }} check-latest: true - name: Build a test release run: | diff --git a/.github/workflows/ci.lint_test.yml b/.github/workflows/ci.lint_test.yml index c03586f..501384f 100644 --- a/.github/workflows/ci.lint_test.yml +++ b/.github/workflows/ci.lint_test.yml @@ -43,13 +43,12 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - version: ${{ fromJSON(needs.go-versions.outputs.latest) }} runs-on: ${{ matrix.os }} steps: - name: Install Go uses: actions/setup-go@v3 with: - go-version: ${{ matrix.version }} + go-version: ${{ needs.go-versions.outputs.latest }} check-latest: true - name: Checkout code uses: actions/checkout@v2 From 0be00a3261eb5e539bbc019136101db25eb3eb8c Mon Sep 17 00:00:00 2001 From: Richard Weston Date: Sat, 11 Jun 2022 12:12:22 +0100 Subject: [PATCH 4/5] ci: Consolidate build steps to simplify routine --- .github/workflows/cd.release.yml | 15 +++------------ .github/workflows/ci.build.yml | 16 +++------------- .github/workflows/ci.lint_test.yml | 15 +++------------ 3 files changed, 9 insertions(+), 37 deletions(-) diff --git a/.github/workflows/cd.release.yml b/.github/workflows/cd.release.yml index 6819b25..99ee156 100644 --- a/.github/workflows/cd.release.yml +++ b/.github/workflows/cd.release.yml @@ -7,30 +7,21 @@ on: - "*" jobs: - go-versions: - name: Lookup go versions - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.versions.outputs.matrix }} - steps: - - uses: actions/checkout@v3 - - uses: arnested/go-version-action@v1 - id: versions - goreleaser: name: "CD: Release" runs-on: ubuntu-latest - needs: go-versions steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 ssh-key: "${{ secrets.DEPLOY_KEY }}" + - uses: arnested/go-version-action@v1 + id: go-version - name: Set up Go uses: actions/setup-go@v3 with: - go-version: ${{ needs.go-versions.outputs.latest }} + go-version: ${{ steps.go-version.outputs.latest }} check-latest: true - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 diff --git a/.github/workflows/ci.build.yml b/.github/workflows/ci.build.yml index e711416..f896e63 100644 --- a/.github/workflows/ci.build.yml +++ b/.github/workflows/ci.build.yml @@ -5,30 +5,20 @@ on: pull_request: jobs: - go-versions: - name: Lookup go versions - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.versions.outputs.matrix }} - steps: - - uses: actions/checkout@v3 - - uses: arnested/go-version-action@v1 - id: versions - goreleaser: name: "CI: Build Test Release" runs-on: ubuntu-latest - needs: go-versions steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 + - uses: arnested/go-version-action@v1 + id: go-version - name: Set up Go uses: actions/setup-go@v3 with: - go-version: ${{ needs.go-versions.outputs.latest }} - check-latest: true + go-version: ${{ steps.go-version.outputs.latest }} - name: Build a test release run: | go build . diff --git a/.github/workflows/ci.lint_test.yml b/.github/workflows/ci.lint_test.yml index 501384f..19e8e29 100644 --- a/.github/workflows/ci.lint_test.yml +++ b/.github/workflows/ci.lint_test.yml @@ -27,28 +27,19 @@ jobs: VALIDATE_GO: true FILTER_REGEX_EXCLUDE: ".*test/.*" - go-versions: - name: Lookup go versions - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.versions.outputs.matrix }} - steps: - - uses: actions/checkout@v3 - - uses: arnested/go-version-action@v1 - id: versions - Test: name: "CI: Go Tests" - needs: go-versions strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: + - uses: arnested/go-version-action@v1 + id: go-version - name: Install Go uses: actions/setup-go@v3 with: - go-version: ${{ needs.go-versions.outputs.latest }} + go-version: ${{ steps.go-version.outputs.latest }} check-latest: true - name: Checkout code uses: actions/checkout@v2 From b26da481b1996def5986f0679ed4b8fcb4590824 Mon Sep 17 00:00:00 2001 From: Richard Weston Date: Sat, 11 Jun 2022 12:28:34 +0100 Subject: [PATCH 5/5] ci: Add a missing checkout stage --- .github/workflows/ci.lint_test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.lint_test.yml b/.github/workflows/ci.lint_test.yml index 19e8e29..ccb83e4 100644 --- a/.github/workflows/ci.lint_test.yml +++ b/.github/workflows/ci.lint_test.yml @@ -34,6 +34,10 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: + - name: Checkout Code + uses: actions/checkout@v2 + with: + fetch-depth: 0 - uses: arnested/go-version-action@v1 id: go-version - name: Install Go