Skip to content

Commit 83ca606

Browse files
authored
Add gotip to CI (#29)
1 parent 759590c commit 83ca606

File tree

5 files changed

+71
-27
lines changed

5 files changed

+71
-27
lines changed

templates/github/workflows/bench.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@ env:
1616
GO111MODULE: "on"
1717
CACHE_BENCHMARK: "off" # Enables benchmark result reuse between runs, may skew latency results.
1818
RUN_BASE_BENCHMARK: "on" # Runs benchmark for PR base in case benchmark result is missing.
19+
GO_VERSION: 1.17.x
1920
jobs:
2021
bench:
21-
strategy:
22-
matrix:
23-
go-version: [ 1.17.x ]
2422
runs-on: ubuntu-latest
2523
steps:
26-
- name: Install Go
24+
- name: Install Go stable
25+
if: env.GO_VERSION != 'tip'
2726
uses: actions/setup-go@v2
2827
with:
29-
go-version: ${{ matrix.go-version }}
28+
go-version: ${{ env.GO_VERSION }}
29+
- name: Install Go tip
30+
if: env.GO_VERSION == 'tip'
31+
run: |
32+
curl -sL https://storage.googleapis.com/go-build-snap/go/linux-amd64/$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}').tar.gz -o gotip.tar.gz
33+
ls -lah gotip.tar.gz
34+
mkdir -p ~/sdk/gotip
35+
tar -C ~/sdk/gotip -xzf gotip.tar.gz
36+
~/sdk/gotip/bin/go version
37+
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
3038
- name: Checkout code
3139
uses: actions/checkout@v2
3240
with:

templates/github/workflows/gorelease.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,25 @@ name: gorelease
33
on:
44
pull_request:
55
env:
6-
GO111MODULE: "on"
6+
GO_VERSION: 1.17.x
77
jobs:
88
gorelease:
9-
strategy:
10-
matrix:
11-
go-version: [ 1.17.x ]
129
runs-on: ubuntu-latest
1310
steps:
14-
- name: Install Go
11+
- name: Install Go stable
12+
if: env.GO_VERSION != 'tip'
1513
uses: actions/setup-go@v2
1614
with:
17-
go-version: ${{ matrix.go-version }}
15+
go-version: ${{ env.GO_VERSION }}
16+
- name: Install Go tip
17+
if: env.GO_VERSION == 'tip'
18+
run: |
19+
curl -sL https://storage.googleapis.com/go-build-snap/go/linux-amd64/$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}').tar.gz -o gotip.tar.gz
20+
ls -lah gotip.tar.gz
21+
mkdir -p ~/sdk/gotip
22+
tar -C ~/sdk/gotip -xzf gotip.tar.gz
23+
~/sdk/gotip/bin/go version
24+
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
1825
- name: Checkout code
1926
uses: actions/checkout@v2
2027
- name: Gorelease cache

templates/github/workflows/release-assets.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@ on:
88
- created
99
env:
1010
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11-
11+
GO_VERSION: 1.17.x
1212
jobs:
1313
build:
1414
name: Upload Release Assets
15-
strategy:
16-
matrix:
17-
go-version: [ 1.17.x ]
1815
runs-on: ubuntu-latest
1916
steps:
20-
- name: Install Go
17+
- name: Install Go stable
18+
if: env.GO_VERSION != 'tip'
2119
uses: actions/setup-go@v2
2220
with:
23-
go-version: ${{ matrix.go-version }}
21+
go-version: ${{ env.GO_VERSION }}
22+
- name: Install Go tip
23+
if: env.GO_VERSION == 'tip'
24+
run: |
25+
curl -sL https://storage.googleapis.com/go-build-snap/go/linux-amd64/$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}').tar.gz -o gotip.tar.gz
26+
ls -lah gotip.tar.gz
27+
mkdir -p ~/sdk/gotip
28+
tar -C ~/sdk/gotip -xzf gotip.tar.gz
29+
~/sdk/gotip/bin/go version
30+
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
2431
- name: Checkout code
2532
uses: actions/checkout@v2
2633
- name: Build artifacts

templates/github/workflows/test-integration.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,26 @@ on:
99
env:
1010
GO111MODULE: "on"
1111
RUN_BASE_COVERAGE: "on" # Runs test for PR base in case base test coverage is missing.
12-
DOCKER_COMPOSE_FILE: "./docker-compose.yml"
12+
DOCKER_COMPOSE_FILE: ./docker-compose.yml
13+
GO_VERSION: 1.17.x
1314
jobs:
1415
test:
1516
runs-on: ubuntu-latest
1617
steps:
17-
- name: Install Go
18+
- name: Install Go stable
19+
if: env.GO_VERSION != 'tip'
1820
uses: actions/setup-go@v2
1921
with:
20-
go-version: 1.17.x
22+
go-version: ${{ env.GO_VERSION }}
23+
- name: Install Go tip
24+
if: env.GO_VERSION == 'tip'
25+
run: |
26+
curl -sL https://storage.googleapis.com/go-build-snap/go/linux-amd64/$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}').tar.gz -o gotip.tar.gz
27+
ls -lah gotip.tar.gz
28+
mkdir -p ~/sdk/gotip
29+
tar -C ~/sdk/gotip -xzf gotip.tar.gz
30+
~/sdk/gotip/bin/go version
31+
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
2132
- name: Checkout code
2233
uses: actions/checkout@v2
2334
- name: Go cache

templates/github/workflows/test-unit.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,28 @@ on:
99
env:
1010
GO111MODULE: "on"
1111
RUN_BASE_COVERAGE: "on" # Runs test for PR base in case base test coverage is missing.
12+
COV_GO_VERSION: 1.17.x # Version of Go to collect coverage
1213
jobs:
1314
test:
1415
strategy:
1516
matrix:
16-
go-version: [ 1.16.x, 1.17.x ]
17+
go-version: [ 1.16.x, 1.17.x, tip ]
1718
runs-on: ubuntu-latest
1819
steps:
19-
- name: Install Go
20+
- name: Install Go stable
21+
if: matrix.go-version != 'tip'
2022
uses: actions/setup-go@v2
2123
with:
2224
go-version: ${{ matrix.go-version }}
25+
- name: Install Go tip
26+
if: matrix.go-version == 'tip'
27+
run: |
28+
curl -sL https://storage.googleapis.com/go-build-snap/go/linux-amd64/$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}').tar.gz -o gotip.tar.gz
29+
ls -lah gotip.tar.gz
30+
mkdir -p ~/sdk/gotip
31+
tar -C ~/sdk/gotip -xzf gotip.tar.gz
32+
~/sdk/gotip/bin/go version
33+
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
2334
- name: Checkout code
2435
uses: actions/checkout@v2
2536
- name: Go cache
@@ -36,21 +47,21 @@ jobs:
3647
${{ runner.os }}-go-cache
3748
- name: Restore base test coverage
3849
id: base-coverage
39-
if: matrix.go-version == '1.17.x'
50+
if: matrix.go-version == env.COV_GO_VERSION
4051
uses: actions/cache@v2
4152
with:
4253
path: |
4354
unit-base.txt
4455
# Use base sha for PR or new commit hash for master/main push in test result key.
4556
key: ${{ runner.os }}-unit-test-coverage-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }}
4657
- name: Checkout base code
47-
if: matrix.go-version == '1.17.x' && env.RUN_BASE_COVERAGE == 'on' && steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != ''
58+
if: matrix.go-version == env.COV_GO_VERSION && env.RUN_BASE_COVERAGE == 'on' && steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != ''
4859
uses: actions/checkout@v2
4960
with:
5061
ref: ${{ github.event.pull_request.base.sha }}
5162
path: __base
5263
- name: Run test for base code
53-
if: matrix.go-version == '1.17.x' && env.RUN_BASE_COVERAGE == 'on' && steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != ''
64+
if: matrix.go-version == env.COV_GO_VERSION && env.RUN_BASE_COVERAGE == 'on' && steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != ''
5465
run: |
5566
cd __base
5667
make | grep test-unit && (make test-unit && go tool cover -func=./unit.coverprofile | sed -e 's/.go:[0-9]*:\t/.go\t/g' | sed -e 's/\t\t*/\t/g' > ../unit-base.txt) || echo "No test-unit in base"
@@ -71,7 +82,7 @@ jobs:
7182
run: cp unit.txt unit-base.txt
7283
- name: Comment Test Coverage
7384
continue-on-error: true
74-
if: matrix.go-version == '1.17.x'
85+
if: matrix.go-version == env.COV_GO_VERSION
7586
uses: marocchino/sticky-pull-request-comment@v2
7687
with:
7788
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -87,7 +98,7 @@ jobs:
8798
</details>
8899
89100
- name: Upload code coverage
90-
if: matrix.go-version == '1.17.x'
101+
if: matrix.go-version == env.COV_GO_VERSION
91102
uses: codecov/codecov-action@v1
92103
with:
93104
file: ./unit.coverprofile

0 commit comments

Comments
 (0)