Skip to content

fix(ci): manually select Go version #7654

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

Merged
merged 3 commits into from
May 24, 2023
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
16 changes: 9 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- main

pull_request:

workflow_dispatch:

permissions:
Expand All @@ -27,6 +26,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
CODER_GO_VERSION: "~1.20"

jobs:
lint:
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
Expand All @@ -37,7 +39,7 @@ jobs:
# Install Go!
- uses: actions/setup-go@v4
with:
go-version: "~1.20"
go-version: ${{ env.CODER_GO_VERSION }}

# Check for any typos!
- name: Check for typos
Expand Down Expand Up @@ -153,7 +155,7 @@ jobs:
- uses: actions/setup-go@v4
with:
cache: false
go-version: "~1.20"
go-version: ${{ env.CODER_GO_VERSION }}

- name: Echo Go Cache Paths
id: go-cache-paths
Expand Down Expand Up @@ -256,7 +258,7 @@ jobs:
- uses: actions/setup-go@v4
with:
cache: false
go-version: "~1.20"
go-version: ${{ env.CODER_GO_VERSION }}

- name: Echo Go Cache Paths
id: go-cache-paths
Expand Down Expand Up @@ -345,7 +347,7 @@ jobs:
- uses: actions/setup-go@v4
with:
cache: false
go-version: "~1.20"
go-version: ${{ env.CODER_GO_VERSION }}

- name: Echo Go Cache Paths
id: go-cache-paths
Expand Down Expand Up @@ -437,7 +439,7 @@ jobs:
- uses: actions/setup-go@v4
with:
cache: false
go-version: "~1.20"
go-version: ${{ env.CODER_GO_VERSION }}

- name: Echo Go Cache Paths
id: go-cache-paths
Expand Down Expand Up @@ -589,7 +591,7 @@ jobs:
- uses: actions/setup-go@v4
with:
cache: false
go-version: "~1.20"
go-version: ${{ env.CODER_GO_VERSION }}

- uses: hashicorp/setup-terraform@v2
with:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ on:
- "v*"
workflow_dispatch:
inputs:
# For some reason, setup-go won't actually pick up a new patch version if
# it has an old one cached. We need to manually specify the versions so we
# can get the latest release. Never use "~1.xx" here!
go_version:
description: "Go version to use for building."
required: false
default: "1.20.4"
dry_run:
description: Perform a dry-run release (devel). Note that ref must be an annotated tag when run without dry-run.
type: boolean
Expand Down Expand Up @@ -92,7 +99,7 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: "~1.20"
go-version: ${{ inputs.go_version }}

- name: Cache Node
id: cache-node
Expand Down
29 changes: 5 additions & 24 deletions .github/workflows/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-security
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
CODER_GO_VERSION: "1.20.4"

jobs:
codeql:
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
Expand All @@ -32,18 +35,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "~1.20"

- name: Go Cache Paths
id: go-cache-paths
run: |
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT

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

# Workaround to prevent CodeQL from building the dashboard.
- name: Remove Makefile
Expand Down Expand Up @@ -73,18 +65,7 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: "~1.20"

- name: Go Cache Paths
id: go-cache-paths
run: |
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT

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

- name: Cache Node
id: cache-node
Expand Down
2 changes: 1 addition & 1 deletion dogfood/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FROM ubuntu:jammy AS go

RUN apt-get update && apt-get install --yes curl gcc
# Install Go manually, so that we can control the version
ARG GO_VERSION=1.20
ARG GO_VERSION=1.20.4
RUN mkdir --parents /usr/local/go

# Boring Go is needed to build FIPS-compliant binaries.
Expand Down