go.mod: update x/tools #115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# With thanks to: | |
# https://github.com/rogpeppe/go-internal/blob/master/.github/workflows/test.yml | |
# https://github.com/mvdan/github-actions-golang | |
on: [push, pull_request] | |
name: Test | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: [1.19.x, 1.18.x] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
# juggling $PATH is different in Windows PowerShell, | |
# so let's just use bash on Windows too. | |
shell: bash | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
stable: false | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Test (standalone) | |
run: | | |
go test ./fuzzer/... | |
go test ./gen | |
go test ./... | |
- name: Get date | |
id: get-date | |
run: | | |
# could do +%Y-%U for weekly snapshots | |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")" | |
- name: Cache gotip | |
id: cache-gotip | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/bin/gotip | |
~/go/bin/gotip.exe | |
~/sdk/gotip | |
key: ${{ runner.os }}-gotip-${{ steps.get-date.outputs.date }} | |
- name: Install gotip | |
if: steps.cache-gotip.outputs.cache-hit != 'true' | |
run: | | |
echo "$PATH" | |
go version | |
go install golang.org/dl/gotip@latest | |
gotip download | |
- name: Test (-end2end, with gotip invoked as gotip) | |
run: | | |
gotip version | |
echo "Current date is $(date)" | |
echo "ls -l ~/go/bin/gotip" | |
ls -l ~/go/bin/gotip | |
go test . -end2end | |
test-gotip: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
# juggling $PATH is different in Windows PowerShell, | |
# so let's just use bash on Windows too. | |
shell: bash | |
continue-on-error: true | |
steps: | |
- name: Set PATH | |
run: echo "$HOME/go/bin" >>$GITHUB_PATH | |
- name: Get date | |
id: get-date | |
run: | | |
# could do +%Y-%U for weekly snapshots | |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")" | |
- name: Cache gotip | |
id: cache-gotip | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/bin/gotip | |
~/go/bin/gotip.exe | |
~/sdk/gotip | |
key: ${{ runner.os }}-gotip-${{ steps.get-date.outputs.date }} | |
- name: Install gotip | |
if: steps.cache-gotip.outputs.cache-hit != 'true' | |
run: | | |
echo "$PATH" | |
go version | |
go install golang.org/dl/gotip@latest | |
gotip download | |
- name: Setup gotip as default go | |
run: | | |
gotip version | |
echo "Current date is $(date)" | |
echo "ls -l ~/go/bin/gotip" | |
ls -l ~/go/bin/gotip | |
echo "GOROOT=$(gotip env GOROOT)" >>$GITHUB_ENV | |
echo "$(gotip env GOROOT)/bin" >>$GITHUB_PATH | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build cache and module cache | |
uses: actions/cache@v2 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
# * Build cache (Mac) | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/Library/Caches/go-build | |
$LOCALAPPDATA/go-build | |
%LocalAppData%\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Test using gotip as default go | |
run: | | |
go version | |
go test ./fuzzer/... | |
go test ./gen | |
go test ./... | |
go test . -end2end | |
test-external-repos: | |
strategy: | |
fail-fast: false | |
matrix: | |
external-repo: [tailscale, terraform_chain, terraform_nochain] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
# juggling $PATH is different in Windows PowerShell, | |
# so let's just use bash on Windows too. | |
shell: bash | |
continue-on-error: true | |
steps: | |
- name: Set PATH | |
run: echo "$HOME/go/bin" >>$GITHUB_PATH | |
- name: Get date | |
id: get-date | |
run: | | |
# could do +%Y-%U for weekly snapshots | |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")" | |
- name: Cache gotip | |
id: cache-gotip | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/bin/gotip | |
~/sdk/gotip | |
key: ${{ runner.os }}-gotip-${{ steps.get-date.outputs.date }} | |
- name: Install gotip | |
if: steps.cache-gotip.outputs.cache-hit != 'true' | |
run: | | |
echo "$PATH" | |
go version | |
go install golang.org/dl/gotip@latest | |
gotip download | |
- name: Setup gotip as default go | |
run: | | |
gotip version | |
echo "Current date is $(date)" | |
echo "ls -l ~/go/bin/gotip" | |
ls -l ~/go/bin/gotip | |
echo "GOROOT=$(gotip env GOROOT)" >>$GITHUB_ENV | |
echo "$(gotip env GOROOT)/bin" >>$GITHUB_PATH | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build cache and module cache | |
uses: actions/cache@v2 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
# * Build cache (Mac) | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/Library/Caches/go-build | |
$LOCALAPPDATA/go-build | |
%LocalAppData%\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Test | |
run: | | |
go version | |
go install ./cmd/fzgen | |
go version -m ~/go/bin/fzgen | |
go test . -v -end2end -allexternal -run=TestScripts/external_${{ matrix.external-repo }} |