diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ab6128ad..ceca08eb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,33 +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 @@ -83,19 +83,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 @@ -105,8 +105,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: + 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 }} \ No newline at end of file