Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support unstable go versions in GitHub Actions workflows #269

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: arnested/go-version-action@v1
id: go-version
- name: Setup Go ${{ steps.go-version.outputs.minimal }}
- name: Setup Go
uses: WillAbides/[email protected]
with:
go-version: ${{ steps.go-version.outputs.minimal }}
go-version-file: go.mod
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/go-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
delete-branch: true
title: Update Go version to ${{ steps.go-version.outputs.latest }}
body: |
Update Go version to ${{ steps.go-version.outputs.latest }}
Update Go version to ${{ steps.go-version.outputs.latest }}.

See [the release history](https://go.dev/doc/devel/release#go${{ steps.go-version.outputs.latest }}).
token: ${{ secrets.PAT_TOKEN }}
Expand All @@ -49,10 +49,11 @@ jobs:
with:
patch-level: true
unstable: true
- uses: arnested/go-version-action@v1
id: go-minor-version
with:
unstable: true
- name: Get draft release notes URL
id: release-notes
run: |
# shellcheck disable=SC2086
echo "URL=https://tip.golang.org/doc/go$(sed -E 's/([0-9]+\.[0-9]+).*/\1/' <<< '${{ steps.go-version.outputs.latest }}')" >> $GITHUB_OUTPUT
- name: Setup Go ${{ steps.go-version.outputs.latest }}
uses: WillAbides/[email protected]
with:
Expand All @@ -66,14 +67,14 @@ jobs:
commit-message: |
Test Go unstable version ${{ steps.go-version.outputs.latest }}

See the draft release notes: https://tip.golang.org/doc/go${{ steps.go-minor-version.outputs.latest }}.
See the draft release notes: ${{ steps.release-notes.outputs.URL }}.
branch: go-version-unstable-test
delete-branch: true
title: Test Go unstable version ${{ steps.go-version.outputs.latest }}
body: |
Test Go unstable version ${{ steps.go-version.outputs.latest }}
Test Go unstable version ${{ steps.go-version.outputs.latest }}.

See [the draft release notes](https://tip.golang.org/doc/go${{ steps.go-minor-version.outputs.latest }}).
See [the draft release notes](${{ steps.release-notes.outputs.URL }}).

This pull request is only intented for getting feedback on compatibility with future Go versions. Don't merge it!
token: ${{ secrets.PAT_TOKEN }}
6 changes: 2 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: arnested/go-version-action@v1
id: go-version
- name: Setup Go ${{ steps.go-version.outputs.minimal }}
- name: Setup Go
uses: WillAbides/[email protected]
with:
go-version: ${{ steps.go-version.outputs.minimal }}
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand Down
42 changes: 7 additions & 35 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,33 @@ name: Build and test
permissions:
contents: write
jobs:
go-version:
name: Lookup go versions
runs-on: ubuntu-22.04
outputs:
minimal: ${{ steps.go-version.outputs.minimal }}
matrix: ${{ steps.go-version.outputs.matrix }}
module: ${{ steps.go-version.outputs.module }}
steps:
- uses: actions/checkout@v4
- uses: arnested/go-version-action@v1
id: go-version
go_generate:
name: Check generated code is up to date
needs: go-version
runs-on: ubuntu-22.04
env:
workdir: go/src/${{ needs.go-version.outputs.module }}
steps:
- uses: actions/checkout@v4
with:
path: ${{env.workdir}}
- name: Setup Go ${{ needs.go-version.outputs.minimal }}
- name: Setup Go
uses: WillAbides/[email protected]
with:
go-version: ${{ needs.go-version.outputs.minimal }}
go-version-file: go.mod
- name: go generate
env:
GO111MODULE: 'on'
GOPATH: ${{ github.workspace }}/go
working-directory: ${{env.workdir}}
run: go generate -x
- name: Diff after go generate
working-directory: ${{env.workdir}}
run: git diff --exit-code
build_and_test:
name: Build and test
needs: go-version
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: ${{ fromJSON(needs.go-version.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go ${{ matrix.go-version }}.x
- name: Setup Go
uses: WillAbides/[email protected]
with:
go-version: ${{ matrix.go-version }}.x
ignore-local: true
go-version-file: go.mod
- name: go version
env:
GO111MODULE: 'on'
Expand All @@ -63,8 +40,6 @@ jobs:
run: go test -v -race -cover -covermode=atomic -coverprofile=coverage.txt ./...
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
flags: go${{ matrix.go-version }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand All @@ -77,18 +52,15 @@ jobs:

license_check:
name: License check
needs: go-version
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ needs.go-version.outputs.minimal }}
- name: Setup Go
uses: WillAbides/[email protected]
with:
go-version: ${{ needs.go-version.outputs.minimal }}
go-version-file: go.mod
- name: Install wwhrd
env:
GO111MODULE: 'off'
run: go get -u github.com/frapposelli/wwhrd
run: go install github.com/frapposelli/wwhrd@latest
- name: go mod vendor
env:
GO111MODULE: 'on'
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: arnested/go-version-action@v1
id: go-version
- name: Bump version and push tag
uses: anothrNick/[email protected]
id: version
Expand All @@ -25,11 +23,10 @@ jobs:
DEFAULT_BUMP: patch
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
RELEASE_BRANCHES: main
- name: Setup Go ${{ steps.go-version.outputs.latest }}.x
- name: Setup Go
uses: WillAbides/[email protected]
with:
go-version: ${{ steps.go-version.outputs.latest }}.x
ignore-local: true
go-version-file: go.mod
- name: go version
env:
GO111MODULE: 'on'
Expand Down Expand Up @@ -57,7 +54,7 @@ jobs:
working-directory: site
- name: apt-ftparchive release
run: |
apt-ftparchive -o APT::FTPArchive::Release::Origin="Arne Jørgensen" -o APT::FTPArchive::Release::Label="${{ steps.go-version.outputs.module }}" release . > Release
apt-ftparchive -o APT::FTPArchive::Release::Origin="Arne Jørgensen" release . > Release
gpg -abs --no-tty --batch --yes -o - Release > Release.gpg
gpg --clearsign --no-tty --batch --yes -o - Release > InRelease
working-directory: site
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ jobs:
name: Govulncheck
runs-on: ubuntu-22.04
steps:
- id: govulncheck
uses: golang/govulncheck-action@master
with:
go-version-file: go.mod
check-latest: true
- uses: actions/checkout@v4
- name: Setup Go
uses: WillAbides/[email protected]
with:
go-version-file: go.mod
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run govulncheck
run: govulncheck ./...
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ linters:
disable:
- depguard
- exhaustruct
- gocritic
- gofumpt

linters-settings:
exhaustive:
Expand Down
Loading