From ccefb0dc6a9b29d76011b0e5c1326ed42530dfe8 Mon Sep 17 00:00:00 2001 From: Rafael Escobar Date: Sun, 24 Dec 2023 10:19:52 -0300 Subject: [PATCH] Refactor CI --- .github/workflows/ci.yaml | 40 +++++++++++++++++++++++++++++++++++ .github/workflows/gofmt.yaml | 11 ---------- .github/workflows/golint.yaml | 13 ------------ .github/workflows/tests.yaml | 19 ----------------- 4 files changed, 40 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/gofmt.yaml delete mode 100644 .github/workflows/golint.yaml delete mode 100644 .github/workflows/tests.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..0e20492 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,40 @@ +name: CI +on: [push, pull_request] +jobs: + gofmt: + name: Validate gofmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: "1.21" + - run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi + staticcheck: + name: Validate staticcheck + runs-on: ubuntu-latest + container: golang:alpine + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: "1.21" + - run: "go install honnef.co/go/tools/cmd/staticcheck@2022.1.3" + - run: "staticcheck ./..." + test: + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest] + go: ["1.12", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21"] + name: Run tests for go v${{ matrix.go }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go }} + - run: go test ./... + if: matrix.os == 'windows-latest' + - run: go test --race ./... + if: matrix.os == 'ubuntu-latest' diff --git a/.github/workflows/gofmt.yaml b/.github/workflows/gofmt.yaml deleted file mode 100644 index 509c164..0000000 --- a/.github/workflows/gofmt.yaml +++ /dev/null @@ -1,11 +0,0 @@ -name: Format -on: [push, pull_request] -jobs: - format: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.21" - - run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi \ No newline at end of file diff --git a/.github/workflows/golint.yaml b/.github/workflows/golint.yaml deleted file mode 100644 index d1e1db0..0000000 --- a/.github/workflows/golint.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: Lint -on: [push, pull_request] -jobs: - lint: - runs-on: ubuntu-latest - container: golang:alpine - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.21" - - run: "go install honnef.co/go/tools/cmd/staticcheck@2022.1.3" - - run: "staticcheck ./..." \ No newline at end of file diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml deleted file mode 100644 index cf10de4..0000000 --- a/.github/workflows/tests.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: Tests -on: [push, pull_request] -jobs: - test: - strategy: - fail-fast: false - matrix: - os: [windows-latest, ubuntu-latest] - go: ["1.12", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21"] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} - - run: go test ./... - if: matrix.os == 'windows-latest' - - run: go test --race ./... - if: matrix.os == 'ubuntu-latest'