-
Notifications
You must be signed in to change notification settings - Fork 139
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
PMM-7 Remove go tip runs, use go version for CI from go.mod file #2137
Changes from all commits
6ff8e87
0cf7705
1bd87e1
f00b8e9
1c44e8f
0196834
d4427fc
d704b85
26d9bae
4fcfe5a
f4f609a
b332818
2de336f
e0756e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,25 +18,12 @@ on: | |
- "update/**" | ||
- "vmproxy/**" | ||
|
||
workflow_call: | ||
inputs: | ||
go-version: | ||
description: An array of Go versions to be tested against, in a format of json string. | ||
required: false | ||
type: string | ||
default: '["tip"]' | ||
|
||
jobs: | ||
test: | ||
name: Tests | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go-version: ${{ fromJson(inputs.go-version || '["1.20.x"]') }} | ||
|
||
env: | ||
GO_VERSION: ${{ matrix.go-version }} | ||
|
||
defaults: | ||
run: | ||
|
@@ -47,31 +34,29 @@ jobs: | |
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go release | ||
if: env.GO_VERSION != 'tip' | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version-file: ${{ github.workspace }}/go.mod | ||
cache: false | ||
|
||
- name: Set up Go tip | ||
if: env.GO_VERSION == 'tip' | ||
run: | | ||
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip | ||
cd $HOME/gotip/src | ||
./make.bash | ||
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV | ||
echo "$HOME/gotip/bin" >> $GITHUB_PATH | ||
echo "$GOBIN" >> $GITHUB_PATH | ||
- name: Enable Go build cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/go-build | ||
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-build-${{ github.ref }}- | ||
${{ runner.os }}-go-build- | ||
|
||
- name: Enable Go modules cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-modules-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-${{ env.GO_VERSION }}-modules- | ||
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is why we can't use embedded in |
||
restore-keys: ${{ runner.os }}-go-modules- | ||
|
||
- name: Download Go modules | ||
run: go mod download | ||
run: go mod download -x | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enables verbose mode (i.e. it will print what it downloads) |
||
|
||
- name: Build and install | ||
run: make install | ||
|
@@ -100,11 +85,6 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go-version: ${{ fromJson(inputs.go-version || '["1.20.x"]') }} | ||
|
||
env: | ||
GO_VERSION: ${{ matrix.go-version }} | ||
|
||
defaults: | ||
run: | ||
|
@@ -115,31 +95,29 @@ jobs: | |
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go release | ||
if: env.GO_VERSION != 'tip' | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version-file: ${{ github.workspace }}/go.mod | ||
cache: false | ||
|
||
- name: Set up Go tip | ||
if: env.GO_VERSION == 'tip' | ||
run: | | ||
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip | ||
cd $HOME/gotip/src | ||
./make.bash | ||
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV | ||
echo "$HOME/gotip/bin" >> $GITHUB_PATH | ||
echo "$GOBIN" >> $GITHUB_PATH | ||
- name: Enable Go build cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/go-build | ||
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-build-${{ github.ref }}- | ||
${{ runner.os }}-go-build- | ||
|
||
- name: Enable Go modules cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-modules-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-${{ env.GO_VERSION }}-modules- | ||
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go-modules- | ||
|
||
- name: Download Go modules | ||
run: go mod download | ||
run: go mod download -x | ||
|
||
- name: Build and install | ||
run: make -C ../admin install | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,58 +10,44 @@ on: | |
|
||
pull_request: | ||
|
||
workflow_call: | ||
inputs: | ||
go-version: | ||
description: An array of Go versions to be tested against, in a format of json string. | ||
required: false | ||
type: string | ||
default: '["tip"]' | ||
|
||
jobs: | ||
check: | ||
name: Checks | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go-version: ${{ fromJson(inputs.go-version || '["1.20.x"]') }} | ||
may-fail: [ false ] | ||
|
||
env: | ||
GO_VERSION: ${{ matrix.go-version }} | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go release | ||
if: env.GO_VERSION != 'tip' | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version-file: ${{ github.workspace }}/go.mod | ||
cache: false | ||
|
||
- name: Set up Go tip | ||
if: env.GO_VERSION == 'tip' | ||
run: | | ||
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip | ||
cd $HOME/gotip/src | ||
./make.bash | ||
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV | ||
echo "$HOME/gotip/bin" >> $GITHUB_PATH | ||
- name: Enable Go build cache | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Build cache saves almost two minutes in this workflow |
||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/go-build | ||
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-build-${{ github.ref }}- | ||
${{ runner.os }}-go-build- | ||
|
||
- name: Enable Go modules cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-modules-${{ hashFiles('**/go.sum') }} | ||
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-${{ env.GO_VERSION }}-modules- | ||
${{ runner.os }}-go-modules- | ||
|
||
- name: Download Go modules | ||
run: | | ||
pushd tools && go mod download | ||
popd && go mod download | ||
pushd tools && go mod download -x | ||
popd && go mod download -x | ||
|
||
- name: Install development tools | ||
run: make init | ||
|
@@ -98,7 +84,7 @@ jobs: | |
uses: reviewdog/action-golangci-lint@v2 | ||
with: | ||
github_token: ${{ secrets.ROBOT_TOKEN || secrets.GITHUB_TOKEN }} | ||
go_version: ${{ env.GO_VERSION }} | ||
go_version_file: ${{ github.workspace }}/go.mod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to |
||
reporter: github-pr-review | ||
fail_on_error: true | ||
cache: false | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fetches go version directly from go.mod file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great choice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super