From b74b6a4315378fb2476241425c92f46392b1d0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C4=99pczy=C5=84ski?= Date: Wed, 18 Sep 2024 09:47:15 +0200 Subject: [PATCH 1/4] chore(CI): add golangci-lint for PRs --- .github/workflows/linter.yml | 24 ++++++++++++++++++++++++ .github/workflows/run-unit-tests.yml | 5 ++--- 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..5ea1939 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,24 @@ +name: Go Lint + +on: + push: + branches: + - master + pull_request: + +jobs: + lint: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.22' + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.56.0 + args: --timeout 3m diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index 63028b0..4ee3ee1 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -16,12 +16,11 @@ jobs: runs-on: ${{ matrix.os }} steps: + - uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} - - - uses: actions/checkout@v3 - name: Run Unit Tests run: | - go test + go test -v From 2e3bf1301e427a71e8f49326f5f3ee7a5a6cbbab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C4=99pczy=C5=84ski?= Date: Wed, 18 Sep 2024 10:05:19 +0200 Subject: [PATCH 2/4] chore(CI): use newer version of checkout, setup-go and golangci-lint-action --- .github/workflows/linter.yml | 19 ++++++++----------- .github/workflows/run-unit-tests.yml | 13 ++++++------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 5ea1939..60fb8c4 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,4 +1,4 @@ -name: Go Lint +name: golangci-lint on: push: @@ -7,18 +7,15 @@ on: pull_request: jobs: - lint: - if: github.event_name == 'pull_request' + golangci: + name: lint runs-on: ubuntu-latest - timeout-minutes: 5 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: '1.22' - cache: false + go-version: stable - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: - version: v1.56.0 - args: --timeout 3m + version: v1.60 diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index 4ee3ee1..0d6cff6 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -1,4 +1,4 @@ -name: Tests +name: go test on: push: @@ -7,20 +7,19 @@ on: pull_request: jobs: - test: + run-tests: + name: unit-tests strategy: matrix: go-version: [1.18, 1.22] os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - name: Run Unit Tests run: | - go test -v + go test From 5ecacecd3fe0b52e5b764cc4733a468011a953e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C4=99pczy=C5=84ski?= Date: Wed, 18 Sep 2024 12:39:42 +0200 Subject: [PATCH 3/4] chore(CI): move linter to tests.yml --- .github/workflows/linter.yml | 21 ------------------- .../{run-unit-tests.yml => tests.yml} | 14 ++++++++++++- 2 files changed, 13 insertions(+), 22 deletions(-) delete mode 100644 .github/workflows/linter.yml rename .github/workflows/{run-unit-tests.yml => tests.yml} (59%) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 60fb8c4..0000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: golangci-lint - -on: - push: - branches: - - master - pull_request: - -jobs: - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: stable - - name: golangci-lint - uses: golangci/golangci-lint-action@v6 - with: - version: v1.60 diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/tests.yml similarity index 59% rename from .github/workflows/run-unit-tests.yml rename to .github/workflows/tests.yml index 0d6cff6..9622621 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: go test +name: Lint and Test on: push: @@ -7,6 +7,18 @@ on: pull_request: jobs: + golangci: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: stable + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60 run-tests: name: unit-tests strategy: From 957318bbfcdff7e06678f3dcbce57c42436fb487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C4=99pczy=C5=84ski?= Date: Wed, 18 Sep 2024 12:53:14 +0200 Subject: [PATCH 4/4] chore(CI): merge linter and tests into one job --- .github/workflows/tests.yml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9622621..1569481 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,20 +7,8 @@ on: pull_request: jobs: - golangci: - name: golangci-lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: stable - - name: golangci-lint - uses: golangci/golangci-lint-action@v6 - with: - version: v1.60 run-tests: - name: unit-tests + name: lint-and-test strategy: matrix: go-version: [1.18, 1.22] @@ -32,6 +20,10 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60 - name: Run Unit Tests - run: | + run: | go test