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 1 commit
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
120 changes: 78 additions & 42 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,33 @@ jobs:
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

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
run: go get gotest.tools/gotestsum@v0.4.0
- name: Run tests
run: |
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
run: docker pull ${GOLANGCI_LINT_CONTAINER}
- name: Run golangci-lint
run: docker run --rm -v $(pwd):/app -w /app ${GOLANGCI_LINT_CONTAINER} golangci-lint run
excludeFmtErrorf:
name: exclude fmt.Errorf
runs-on: ubuntu-latest
Expand All @@ -83,19 +82,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 +104,45 @@ 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
captureRunEnv:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is outdated

name: Capture CI Run Env
runs-on: ubuntu-latest
steps:
- run: printenv
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 }}