diff --git a/.license/README.md b/.ci/license/README.md similarity index 100% rename from .license/README.md rename to .ci/license/README.md diff --git a/.license/template.txt b/.ci/license/template.txt similarity index 100% rename from .license/template.txt rename to .ci/license/template.txt diff --git a/.yamllint.yml b/.ci/yamllint.yml similarity index 100% rename from .yamllint.yml rename to .ci/yamllint.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index be66fb36a..b5d6745b8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,99 +8,38 @@ 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 . - build: - name: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v1 - with: - go-version: 1.13.4 - - run: | - go build -race ./... - build-win: - name: build-win - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v1 + - name: yaml-lint + uses: ibiqlik/action-yamllint@v1 with: - go-version: 1.13.4 - - run: | - go build -race ./... - build-osx: - name: build-osx - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - 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 - 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 ./...) - test-win: - name: test-win - runs-on: windows-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: | - $env:Path += ";$(go env GOPATH)\bin" - mkdir $home/junit - gotestsum --junitfile $home\junit\unit-tests.xml -- -race -short $(go list .\...) - test-osx: - name: test-osx - runs-on: macos-latest + config_file: .ci/yamllint.yml + strict: true + build-and-test: + name: build and test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-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 - - 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 ./...) + - name: Build + run: go build -race ./... + - name: Test + run: go test -race ./... golangci-lint: name: golangci-lint runs-on: ubuntu-latest - env: - GOLANGCI_LINT_CONTAINER: golangci/golangci-lint:v1.28.1 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 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.31 excludeFmtErrorf: name: exclude fmt.Errorf @@ -173,17 +112,11 @@ jobs: run: | grep ^replace go.mod || 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 + - build-and-test if: github.actor == 'nsmbot' && github.base_ref == 'master' && github.event_name == 'pull_request' steps: - name: Check out the code diff --git a/.golangci.yml b/.golangci.yml index 1f40a6ad6..362a1d63f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,7 +6,7 @@ run: tests: true linters-settings: goheader: - template-path: ".license/template.txt" + template-path: ".ci/license/template.txt" values: const: year: 2020