Skip to content

Commit

Permalink
ci: update github actions
Browse files Browse the repository at this point in the history
Update GitHub actions to use the latest versions and add go mod
tidy check.

This bumps go version for tests to 1.20 and 1.21 the currently
supported versions.

Update checks to validate against redis 7.2 and 7.0, removing 5.0 and
4.0 which may still work but haven't been updated since 2020.
  • Loading branch information
stevenh committed Jan 29, 2024
1 parent a60882b commit ca32129
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 40 deletions.
32 changes: 7 additions & 25 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
strategy:
matrix:
go-version:
- '1.19.x'
- '1.20.x'
- '1.20'
- '1.21'
os:
- 'ubuntu-latest'
redis:
- '7.2'
- '7.0'
- '6.2'
- '6.0'
- '5.0'
- '4.0'
name: Test go ${{ matrix.go-version }} redis ${{ matrix.redis }} on ${{ matrix.os }}
steps:
- name: Setup redis
Expand All @@ -29,30 +29,12 @@ jobs:
redis-version: ${{ matrix.redis }}

- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Go Cache Paths
id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- name: Checkout code
uses: actions/checkout@v3

- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

- name: Go Mod Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
uses: actions/checkout@v4

- name: Go Test
run: go test -v ./...
run: go test ./...
31 changes: 16 additions & 15 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.51.2

# Optional: working directory, useful for monorepos
# working-directory: somedir
- name: Checkout code
uses: actions/checkout@v4

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
- name: Setup golang
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false # Handled by golangci-lint.

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
- name: Validate go mod
run: |
go mod tidy
git --no-pager diff && [[ 0 -eq $(git status --porcelain | wc -l) ]]
# Optional: if set to true then the action will use pre-installed Go.
# skip-go-installation: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.2
args: --out-format=colored-line-number

0 comments on commit ca32129

Please sign in to comment.