From d3dc2f5d71d4daab016ff4f44166894fcb887352 Mon Sep 17 00:00:00 2001 From: Julian Kornberger <jk+github@digineo.de> Date: Wed, 30 Sep 2020 13:02:53 +0200 Subject: [PATCH] Update GitHub Actions Add super-linter --- .github/linters/.golangci.yml | 3 ++ .github/workflows/linter.yml | 53 +++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 16 +++++------ .gitignore | 4 +-- README.md | 2 +- scripts/build_examples.sh | 2 +- scripts/check_gofmt.sh | 10 ------- 7 files changed, 68 insertions(+), 22 deletions(-) create mode 100644 .github/linters/.golangci.yml create mode 100644 .github/workflows/linter.yml delete mode 100755 scripts/check_gofmt.sh diff --git a/.github/linters/.golangci.yml b/.github/linters/.golangci.yml new file mode 100644 index 00000000..e1dee66b --- /dev/null +++ b/.github/linters/.golangci.yml @@ -0,0 +1,3 @@ +run: + skip-dirs: + - net/tcp diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 00000000..d1d9d65c --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,53 @@ +--- + ########################### + ########################### + ## Linter GitHub Actions ## + ########################### + ########################### + name: Lint Code Base + + # + # Documentation: + # https://help.github.com/en/articles/workflow-syntax-for-github-actions + # + + ############################# + # Start the job on all push # + ############################# + on: + push: + branches-ignore: [master] + # Remove the line above to run when pushing to master + pull_request: + branches: [master] + + ############### + # Set the Job # + ############### + jobs: + build: + # Name the Job + name: Lint Code Base + # Set the agent to run on + runs-on: ubuntu-latest + + ################## + # Load all steps # + ################## + steps: + ########################## + # Checkout the code base # + ########################## + - name: Checkout Code + uses: actions/checkout@v2 + + ################################ + # Run Linter against code base # + ################################ + - name: Lint Code Base + uses: github/super-linter@v3 + env: + VALIDATE_ALL_CODEBASE: false + DEFAULT_BRANCH: master + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FILTER_REGEX_EXCLUDE: net/tcp/.* diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 11e5f46e..2c65cfa7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,24 +4,21 @@ jobs: test: strategy: matrix: - go-version: [1.13.x, 1.14.x] - platform: [ubuntu-latest, macos-latest] + go-version: [1.14.x, 1.15.x] + platform: [ubuntu-latest, ubuntu-18.04, macos-latest] runs-on: ${{ matrix.platform }} steps: - name: Install Go uses: actions/setup-go@v1 with: go-version: ${{ matrix.go-version }} + - name: Checkout code uses: actions/checkout@v2 + - name: Test run: go test -v -cover -coverprofile=coverage.txt ./... - - name: Vet - run: go vet ./... - - name: Build examples - run: scripts/build_examples.sh - - name: Build examples - run: scripts/check_gofmt.sh + # Upload Coverage Report - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 @@ -30,3 +27,6 @@ jobs: flags: unittests name: codecov-${{ matrix.platform }}-${{ matrix.go-version }} fail_ci_if_error: true + + - name: Build examples + run: scripts/build_examples.sh diff --git a/.gitignore b/.gitignore index e05f4bd4..bacbc3fe 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,8 @@ # Test binary, build with `go test -c` *.test -# Output of the go coverage tool, specifically when used with LiteIDE -*.out +# Output of the go coverage tool +coverage.txt # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 .glide/ diff --git a/README.md b/README.md index f1b3a350..0ac5325f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A re-implementation of BGP, IS-IS and OSPF in go. We value respect and robustness! -[](https://circleci.com/gh/bio-routing/bio-rd/tree/master) +[](https://github.com/bio-routing/bio-rd/actions) [](https://codecov.io/gh/bio-routing/bio-rd) [](http://goreportcard.com/report/bio-routing/bio-rd) [](https://godoc.org/github.com/bio-routing/bio-rd) diff --git a/scripts/build_examples.sh b/scripts/build_examples.sh index 473b4532..7370c96c 100755 --- a/scripts/build_examples.sh +++ b/scripts/build_examples.sh @@ -2,5 +2,5 @@ for i in examples/*; do echo "building $i" - go install github.com/bio-routing/bio-rd/$i + go install "github.com/bio-routing/bio-rd/$i" done diff --git a/scripts/check_gofmt.sh b/scripts/check_gofmt.sh deleted file mode 100755 index b9c4731e..00000000 --- a/scripts/check_gofmt.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -result="$(gofmt -e -s -l . 2>&1 | grep -v '^vendor/' )" -if [ -n "$result" ]; then - echo "Go code is not formatted, run 'gofmt -e -s -w .'" >&2 - echo "$result" - exit 1 -else - echo "Go code is formatted well" -fi -- GitLab