From fa2c70bbbfe53334fe0fd4c80336583970707379 Mon Sep 17 00:00:00 2001 From: Sanjay Ghemawat <sanjay@google.com> Date: Tue, 27 Aug 2024 10:19:23 -0700 Subject: [PATCH] Update runner to Go 1.22,1.23 (two most recent releases). (#887) * 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 --- .github/workflows/ci.yaml | 78 ++++++++++++++++++++++++++++----------- browsertests/go.mod | 2 +- go.mod | 2 +- 3 files changed, 58 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 42e93cf6..61ab05ae 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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. @@ -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' @@ -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: @@ -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 @@ -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' @@ -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 @@ -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 @@ -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: diff --git a/browsertests/go.mod b/browsertests/go.mod index 947ece64..2d571a03 100644 --- a/browsertests/go.mod +++ b/browsertests/go.mod @@ -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 => ../ diff --git a/go.mod b/go.mod index f294479b..ea9ed8e6 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/google/pprof -go 1.19 +go 1.22 require ( github.com/chzyer/readline v1.5.1