Skip to content

first commit

first commit #2

Workflow file for this run

name: ci
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
GOPATH: ${{ github.workspace }}
WORKING_DIR: ./src/github.com/kevherro/bob/
jobs:
test-mac:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ env.WORKING_DIR }}
strategy:
fail-fast: false
matrix:
go: ['1.20', 'tip']
os: ['macos-12']
xcode-version: ['13.1.0', '14.2.0']
steps:
- name: Update Go version using setup-go
uses: actions/setup-go@v4
if: matrix.go != 'tip'
with:
go-version: ${{ matrix.go }}
- name: Update Go version manually
if: matrix.go == 'tip'
working-directory: ${{ github.workspace }}
run: |
git clone https://go.googlesource.com/go $HOME/gotip
cd $HOME/gotip/src
./make.bash
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
echo "RUN_STATICCHECK=false" >> $GITHUB_ENV
echo "RUN_GOLANGCI_LINTER=false" >> $GITHUB_ENV
echo "$HOME/gotip/bin:$PATH" >> $GITHUB_PATH
- name: Checkout the repo
uses: actions/checkout@v3
with:
path: ${{ env.WORKING_DIR }}
- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode-version }}
- name: Fetch dependencies
run: |
# Do not let tools interfere with the main module's go.mod.
cd && go mod init tools
# TODO: Update to a specific version when https://github.com/dominikh/go-tools/issues/1362 is fixed.
go install honnef.co/go/tools/cmd/staticcheck@master
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
# Add PATH for installed tools.
echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH
- name: Run the script
run: |
go version
./test.sh
- name: Check to make sure that tests also work in GOPATH mode
env:
GO111MODULE: off
run: |
go get -d .
go test -v ./...
- name: Code coverage
uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
test-linux:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ env.WORKING_DIR }}
strategy:
fail-fast: false
matrix:
go: ['1.20', 'tip']
os: ['ubuntu-22.04', 'ubuntu-20.04']
steps:
- name: Update Go version using setup-go
uses: actions/setup-go@v4
if: matrix.go != 'tip'
with:
go-version: ${{ matrix.go }}
- name: Update Go version manually
if: matrix.go == 'tip'
working-directory: ${{ github.workspace }}
run: |
git clone https://go.googlesource.com/go $HOME/gotip
cd $HOME/gotip/src
./make.bash
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
echo "RUN_STATICCHECK=false" >> $GITHUB_ENV
echo "RUN_GOLANGCI_LINTER=false" >> $GITHUB_ENV
echo "$HOME/gotip/bin" >> $GITHUB_PATH
- name: Checkout the repo
uses: actions/checkout@v3
with:
path: ${{ env.WORKING_DIR }}
- name: Fetch dependencies
run: |
# Do not let tools interfere with the main module's go.mod.
cd && go mod init tools
# TODO: Update to a specific version when https://github.com/dominikh/go-tools/issues/1362 is fixed.
go install honnef.co/go/tools/cmd/staticcheck@master
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
# Add PATH for installed tools.
echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH
- name: Run the script
run: |
go version
./test.sh
- name: Check to make sure that tests also work in GOPATH mode
env:
GO111MODULE: off
run: |
go get -d .
go test -v ./...
- name: Code coverage
uses: codecov/codecov-action@v3
with:
file: ./coverage.txt