Skip to content

Merge pull request #116 from mpsonntag/versionUpgrades #87

Merge pull request #116 from mpsonntag/versionUpgrades

Merge pull request #116 from mpsonntag/versionUpgrades #87

name: run-build
on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
jobs:
# go vet and go fmt are mandatory.
# Other linters are optional but should dispay issues.
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup go 1.20
uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Run go vet
run: |
go mod download github.com/mattn/go-isatty
go vet ./...
- name: Run gofmt
run: |
gofmt -s -l .
if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then exit 1; fi
# staticcheck and errcheck should be optional, issues should
# be displayed to raise awareness but not fail the build.
# There is an ongoing discussion whether github actions
# will support such a feature which it currently does not.
# Check https://github.com/actions/toolkit/issues/399
# Until further notice errcheck and temporarily staticcheck
# will be run but will not fail the build on error.
# The "Secondary linter" step icon will show whether errcheck
# or staticcheck were successful or not.
- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
continue-on-error: true
- name: staticcheck warning
if: steps.composer-run.outcome != 'success'
run: echo "- staticcheck encountered issues" >> $GITHUB_STEP_SUMMARY
- name: Run errcheck
run: |
go install github.com/kisielk/errcheck@latest
errcheck ./...
continue-on-error: true
- name: errcheck warning
if: steps.composer-run.outcome != 'success'
run: echo "- errcheck encountered issues" >> $GITHUB_STEP_SUMMARY
- name: Secondary linter success
if: steps.composer-run.outcome == 'success'
run: echo "Run successful"
tests:
runs-on: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Go 1.20
uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Install git annex dependency
run: |
bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
sudo apt-get update -qq
sudo apt-get install git-annex-standalone
git version
git annex version
- name: Show Go version
run: go version
- name: Fetch dependencies
run: go get -d ./...
- name: Run build
run: go build ./cmd/ginvalid
- name: Run tests
run: go test ./...
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup go 1.20
uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Test build binary
run: |
go mod download github.com/mattn/go-isatty
go build ./cmd/ginvalid
run-coverall:
runs-on: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use golang version 1.20
uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Install git annex dependency
run: |
bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
sudo apt-get update -qq
sudo apt-get install git-annex-standalone
git version
git annex version
- name: Fetch dependencies
run: |
go get -d ./...
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Create test coverage
run: go test -covermode atomic -coverprofile=covprofile ./...
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=covprofile -service=github