Skip to content

Commit

Permalink
Update runner to Go 1.22,1.23 (two most recent releases). (#887)
Browse files Browse the repository at this point in the history
* Update runner to Go 1.22,1.23 (two most recent releases).

* Update runner to Go 1.22,1.23 (two most recent releases).

* Update Go mod to 1.22 as well.

* Update staticcheck to 0.5.1 so it works with 1.23 code

* Update golangci-lint to 1.60.3.

v1.51 fails with errors related to old slices package.

* Require Go 1.22 for bootstrapping Go tip

* Github actions do not support else statements

* Another attempt at Workflow syntax

* Another attempt at Workflow syntax

* Fix caching for Go bootstrap compiler

* Fix caching for Go bootstrap compiler

* Fix caching for Go bootstrap compiler

* Fix caching for Go bootstrap compiler

* Fix caching for Go bootstrap compiler

* Fix caching for Go bootstrap compiler

* Fix caching for Go bootstrap compiler

* Add comments saying why we need cache directives
  • Loading branch information
ghemawat authored Aug 27, 2024
1 parent 813a5fb commit fa2c70b
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 24 deletions.
78 changes: 56 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ['1.20', '1.21', 'tip']
go: ['1.22', '1.23', 'tip']
# Supported macOS versions can be found in
# https://github.com/actions/virtual-environments#available-environments.
# TODO: Add macos-13. As of now there are build errors when installing graphviz.
Expand All @@ -28,11 +28,31 @@ jobs:
# - https://github.com/actions/virtual-environments/blob/main/images/macos/macos-13-Readme.md#xcode
xcode-version: ['14.2', '14.1', '14.0.1', '13.4.1', '13.3.1', '13.2.1', '13.1']
steps:
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: ${{ env.WORKING_DIR }}

- name: Update Go version using setup-go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
if: matrix.go != 'tip'
with:
# Include cache directives to allow proper caching. Without them, we
# get setup-go "Restore cache failed" warnings.
go-version: ${{ matrix.go }}
cache: true
cache-dependency-path: '**/go.sum'

- name: Install Go bootstrap compiler
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
if: matrix.go == 'tip'
with:
# Bootstrapping go tip requires 1.22.6
# Include cache directives to allow proper caching. Without them, we
# get setup-go "Restore cache failed" warnings.
go-version: 1.22
cache: true
cache-dependency-path: '**/go.sum'

- name: Update Go version manually
if: matrix.go == 'tip'
Expand All @@ -46,11 +66,6 @@ jobs:
echo "RUN_GOLANGCI_LINTER=false" >> $GITHUB_ENV
echo "$HOME/gotip/bin:$PATH" >> $GITHUB_PATH
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: ${{ env.WORKING_DIR }}

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
Expand All @@ -61,8 +76,8 @@ jobs:
brew install graphviz
# Do not let tools interfere with the main module's go.mod.
cd && go mod init tools
go install honnef.co/go/tools/cmd/staticcheck@v0.4.6
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
go install honnef.co/go/tools/cmd/staticcheck@v0.5.1
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3
# Add PATH for installed tools.
echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH
Expand All @@ -84,14 +99,34 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ['1.20', '1.21', 'tip']
go: ['1.22', '1.23', 'tip']
os: ['ubuntu-22.04', 'ubuntu-20.04']
steps:
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: ${{ env.WORKING_DIR }}

- name: Update Go version using setup-go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
if: matrix.go != 'tip'
with:
# Include cache directives to allow proper caching. Without them, we
# get setup-go "Restore cache failed" warnings.
go-version: ${{ matrix.go }}
cache: true
cache-dependency-path: '**/go.sum'

- name: Install Go bootstrap compiler
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
if: matrix.go == 'tip'
with:
# Bootstrapping go tip requires 1.22.6
# Include cache directives to allow proper caching. Without them, we
# get setup-go "Restore cache failed" warnings.
go-version: 1.22
cache: true
cache-dependency-path: '**/go.sum'

- name: Update Go version manually
if: matrix.go == 'tip'
Expand All @@ -105,11 +140,6 @@ jobs:
echo "RUN_GOLANGCI_LINTER=false" >> $GITHUB_ENV
echo "$HOME/gotip/bin" >> $GITHUB_PATH
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: ${{ env.WORKING_DIR }}

- name: Check chrome for browser tests
run: |
google-chrome --version
Expand All @@ -119,8 +149,8 @@ jobs:
sudo apt-get install graphviz
# Do not let tools interfere with the main module's go.mod.
cd && go mod init tools
go install honnef.co/go/tools/cmd/staticcheck@v0.4.6
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
go install honnef.co/go/tools/cmd/staticcheck@v0.5.1
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3
# Add PATH for installed tools.
echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH
Expand All @@ -139,18 +169,22 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ['1.20', '1.21']
go: ['1.22', '1.23']
steps:
- name: Update Go version using setup-go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ matrix.go }}

- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: ${{ env.WORKING_DIR }}

- name: Update Go version using setup-go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# Include cache directives to allow proper caching. Without them, we
# get setup-go "Restore cache failed" warnings.
go-version: ${{ matrix.go }}
cache: true
cache-dependency-path: '**/go.sum'

- name: Fetch Windows dependency
uses: crazy-max/ghaction-chocolatey@0e015857dd851f84fcb7fb53380eb5c4c8202333 # v3.0.0
with:
Expand Down
2 changes: 1 addition & 1 deletion browsertests/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/google/pprof/browsertests

go 1.19
go 1.22

// Use the version of pprof in this directory tree.
replace github.com/google/pprof => ../
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/google/pprof

go 1.19
go 1.22

require (
github.com/chzyer/readline v1.5.1
Expand Down

0 comments on commit fa2c70b

Please sign in to comment.