Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI issues #24

Merged
merged 2 commits into from
Oct 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 71 additions & 54 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,42 @@ jobs:
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
- name: Install yamllint
run: pip install --user yamllint
- name: Run yamllint
run: ~/.local/bin/yamllint -c .yamllint.yml --strict .
- name: yaml-lint
uses: ibiqlik/action-yamllint@v1
with:
config_file: .ci/yamllint.yml
strict: true
shellcheck:
name: shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: shellcheck
uses: fkautz/shell-linter@v1.0.1
build:
name: build
build-and-test:
name: build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
- name: Check out code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.13.4
- run: |
go build -race ./...
# test:
# name: test
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v1
# with:
# go-version: 1.13.4
# - name: Install gotestsum
# start: go get gotest.tools/gotestsum@v0.4.0
# - name: Run tests
# start: |
# eval $(go env)
# mkdir -p ~/junit/
# ${GOPATH}/bin/gotestsum --junitfile ~/junit/unit-tests.xml -- -race -short $(go list ./...)
# golangci-lint:
# name: golangci-lint
# runs-on: ubuntu-latest
# env:
# GOLANGCI_LINT_CONTAINER: golangci/golangci-lint:v1.23.2
# steps:
# - name: Check out code into the Go module directory
# uses: actions/checkout@v2
# - name: Pull golangci-lint docker container
# start: docker pull ${GOLANGCI_LINT_CONTAINER}
# - name: Run golangci-lint
# start: docker start --rm -v $(pwd):/app -w /app ${GOLANGCI_LINT_CONTAINER} golangci-lint start

- name: Build
run: go build -race ./...
- name: Test
run: go test -race ./...
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.31
excludeFmtErrorf:
name: exclude fmt.Errorf
runs-on: ubuntu-latest
Expand All @@ -83,19 +68,19 @@ jobs:
exit 1
fi
done
# checkgomod:
# name: check go.mod and go.sum
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v1
# with:
# go-version: 1.13.4
# - start: go mod tidy
# - name: Check for changes in go.mod or go.sum
# start: |
# git diff --name-only --exit-code go.mod || ( echo "Run go tidy" && false )
# git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false )
checkgomod:
name: check go.mod and go.sum
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.13.4
- run: go mod tidy
- name: Check for changes in go.mod or go.sum
run: |
git diff --name-only --exit-code go.mod || ( echo "Run go tidy" && false )
git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false )
license:
name: license header check
runs-on: ubuntu-latest
Expand All @@ -105,8 +90,40 @@ jobs:
with:
go-version: 1.13.4
- name: Install go-header
run: 'go get github.com/denis-tingajkin/go-header@v0.2.1'
run: 'go get github.com/denis-tingajkin/go-header@v0.2.2'
- name: Run go-header
run: |
eval $(go env)
${GOPATH}/bin/go-header
excludereplace:
name: Exclude replace in go.mod
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v2
- name: Exclude replace in go.mod
run: |
grep -v 'replace github.com/satori/go.uuid' go.mod | grep ^replace || exit 0
exit 1
automerge:
name: automerge
runs-on: ubuntu-latest
needs:
- build
- test
if: github.actor == 'nsmbot' && github.base_ref == 'master' && github.event_name == 'pull_request'
steps:
- name: Check out the code
uses: actions/checkout@v2
- name: Fetch master
run: |
git remote -v
git fetch --depth=1 origin master
- name: Only allow go.mod and go.sum changes
run: |
find . -type f ! -name 'go.mod' ! -name 'go.sum' -exec git diff --exit-code origin/master -- {} +
- name: Automerge nsmbot PR
uses: ridedott/merge-me-action@master
with:
GITHUB_LOGIN: nsmbot
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}