From dc8a9eabc08949211145640ea83fa5825e1a329f Mon Sep 17 00:00:00 2001 From: slashformotion Date: Mon, 22 Dec 2025 19:19:03 +0100 Subject: [PATCH 1/8] update ci to use mise --- .github/workflows/ci.yaml | 165 +++++++++++++++++++++----------------- Makefile | 3 +- mise.toml | 3 + 3 files changed, 98 insertions(+), 73 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index db674f8..0b59283 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,11 +9,49 @@ on: - main jobs: + preflight: + runs-on: ubuntu-latest + outputs: + gopath: ${{ steps.gopath.outputs.value }} + go-mods-cache-key: ${{ steps.cache-keys.outputs.go-mods-cache-key }} + go-bins-cache-key: ${{ steps.cache-keys.outputs.go-bins-cache-key }} + steps: + - uses: actions/checkout@v4 + with: + submodules: "false" + + - uses: jdx/mise-action@v3 + with: + cache: true + reshim: true + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get Go path + id: gopath + run: echo "value=$(go env GOPATH)" >> $GITHUB_OUTPUT + + - name: Cache keys + id: cache-keys + run: | + echo "go-mods-cache-key=go-mods-${{ runner.os }}-${{ hashFiles('**/go.sum') }}" >> $GITHUB_OUTPUT + + - name: Cache Go mods + id: go-mods-cache + uses: actions/cache@v4 + with: + lookup-only: true + path: ${{ steps.gopath.outputs.value }}/pkg/mod + key: ${{ steps.cache-keys.outputs.go-mods-cache-key }} + + - name: 📥 Download dependencies + if: steps.go-mods-cache.outputs.cache-hit != 'true' + run: go mod download + + + test: runs-on: ubuntu-latest - strategy: - matrix: - go-version: [oldstable, stable] + needs: preflight services: postgres: image: postgres:17.4 @@ -27,31 +65,30 @@ jobs: env: POSTGRES_PASSWORD: password steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: jdx/mise-action@v3 with: - go-version: ${{ matrix.go-version }} - - name: Cache Go modules - uses: actions/cache@v3 + cache: true + reshim: true + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: 💾 Cache Go mods + uses: actions/cache@v4 with: - path: | - ~/.cache/go-build - /go/pkg/mod - key: go-mod-v4-${{ hashFiles('**/go.sum') }} - - name: Install Dependencies - run: go mod download - - name: Run tests + path: ${{ needs.preflight.outputs.gopath }}/pkg/mod + key: ${{ needs.preflight.outputs.go-mods-cache-key }} + fail-on-cache-miss: true + - name: Run tests units run: | mkdir -p /tmp/test-reports - # gotestsum hash is version version v1.12.3 - go run gotest.tools/gotestsum@ddd0b05a6878e2e8257a2abe6e7df66cebc53d0e --junitfile /tmp/test-reports/unit-tests.xml - make test-examples + gotestsum --junitfile /tmp/test-reports/unit-tests.xml - uses: actions/upload-artifact@v4 name: Upload test results with: name: test-reports-${{ matrix.go-version }} path: /tmp/test-reports + - name: Run Examples + run: make test-examples + - name: Update coverage report uses: ncruces/go-coverage-report@v0.3.0 with: @@ -64,77 +101,61 @@ jobs: test-race: runs-on: ubuntu-latest - strategy: - matrix: - go-version: [oldstable, stable] + needs: preflight steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: jdx/mise-action@v3 with: - go-version: ${{ matrix.go-version }} - - name: Cache Go modules - uses: actions/cache@v3 + cache: true + reshim: true + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: 💾 Cache Go mods + uses: actions/cache@v4 with: - path: | - ~/.cache/go-build - /go/pkg/mod - key: go-mod-v4-${{ hashFiles('**/go.sum') }} - - name: Install Dependencies - run: go mod download + path: ${{ needs.preflight.outputs.gopath }}/pkg/mod + key: ${{ needs.preflight.outputs.go-mods-cache-key }} + fail-on-cache-miss: true - name: Run tests with race detector run: make test-race lint: runs-on: ubuntu-latest - strategy: - matrix: - go-version: [oldstable, stable] + needs: preflight steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: jdx/mise-action@v3 with: - go-version: ${{ matrix.go-version }} - - name: Cache Go modules - uses: actions/cache@v3 + cache: true + reshim: true + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: 💾 Cache Go mods + uses: actions/cache@v4 with: - path: | - ~/.cache/go-build - /go/pkg/mod - key: go-mod-v4-${{ hashFiles('**/go.sum') }} - - name: Install Dependencies - run: go mod download - - name: Install tooling - run: make tooling + path: ${{ needs.preflight.outputs.gopath }}/pkg/mod + key: ${{ needs.preflight.outputs.go-mods-cache-key }} + fail-on-cache-miss: true - name: Linting - run: make lint + run: mise vet staticcheck - name: Running vulncheck - run: make vuln-check + run: mise vuln fmt: runs-on: ubuntu-latest - strategy: - matrix: - go-version: [oldstable, stable] + needs: preflight steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: jdx/mise-action@v3 with: - go-version: ${{ matrix.go-version }} - - name: Cache Go modules - uses: actions/cache@v3 + cache: true + reshim: true + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: 💾 Cache Go mods + uses: actions/cache@v4 with: - path: | - ~/.cache/go-build - /go/pkg/mod - key: go-mod-v4-${{ hashFiles('**/go.sum') }} - - name: Install Dependencies - run: go mod download - - name: Install tooling - run: make tooling + path: ${{ needs.preflight.outputs.gopath }}/pkg/mod + key: ${{ needs.preflight.outputs.go-mods-cache-key }} + fail-on-cache-miss: true - name: Running formatting run: | - make fmt - make has-changes + mise fmt + mise has-changes \ No newline at end of file diff --git a/Makefile b/Makefile index 49680cb..6fedad0 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,8 @@ lint: staticcheck -checks=all ./... fmt: - go list -f '{{.Dir}}' ./... | xargs -I {} goimports -local $(BASE_PACKAGE) -w {} + go fmt ./... + goimports -l -w . vuln-check: govulncheck ./... diff --git a/mise.toml b/mise.toml index 7719eb2..157bdcf 100644 --- a/mise.toml +++ b/mise.toml @@ -10,9 +10,12 @@ go = "1.25.1" "go:honnef.co/go/tools/cmd/staticcheck" = { version = "v0.6.1" } "go:golang.org/x/vuln/cmd/govulncheck" = { version = "v1.1.4" } "go:golang.org/x/tools/cmd/goimports" = { version = "v0.20.0" } +"go;gotest.tools/gotestsum" = { version = "ddd0b05a6878e2e8257a2abe6e7df66cebc53d0e" } [tasks] test = "go test ./..." vet = "go vet ./..." static = "staticcheck -checks=all ./..." vuln = "govulncheck ./..." +fmt = "go fmt ./... && goimports -l -w ." +has-changes = "git diff --exit-code --quiet HEAD --" \ No newline at end of file From 3f75f27e214883d1da826d25d60e84ab1fe654bf Mon Sep 17 00:00:00 2001 From: slashformotion Date: Mon, 22 Dec 2025 19:22:02 +0100 Subject: [PATCH 2/8] dumb --- mise.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mise.toml b/mise.toml index 157bdcf..b898a8f 100644 --- a/mise.toml +++ b/mise.toml @@ -10,7 +10,7 @@ go = "1.25.1" "go:honnef.co/go/tools/cmd/staticcheck" = { version = "v0.6.1" } "go:golang.org/x/vuln/cmd/govulncheck" = { version = "v1.1.4" } "go:golang.org/x/tools/cmd/goimports" = { version = "v0.20.0" } -"go;gotest.tools/gotestsum" = { version = "ddd0b05a6878e2e8257a2abe6e7df66cebc53d0e" } +"go:gotest.tools/gotestsum" = { version = "ddd0b05a6878e2e8257a2abe6e7df66cebc53d0e" } [tasks] test = "go test ./..." From 8f437fb4594dc889de30c14c35160cd15824b56b Mon Sep 17 00:00:00 2001 From: slashformotion Date: Mon, 22 Dec 2025 19:26:31 +0100 Subject: [PATCH 3/8] qsdqsdqsd --- .github/workflows/ci.yaml | 6 ++++-- mise.toml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0b59283..9170ae3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -134,8 +134,10 @@ jobs: path: ${{ needs.preflight.outputs.gopath }}/pkg/mod key: ${{ needs.preflight.outputs.go-mods-cache-key }} fail-on-cache-miss: true - - name: Linting - run: mise vet staticcheck + - name: go vet + run: mise vet + - name: Running staticcheck + run: mise staticcheck - name: Running vulncheck run: mise vuln diff --git a/mise.toml b/mise.toml index b898a8f..07514d3 100644 --- a/mise.toml +++ b/mise.toml @@ -18,4 +18,4 @@ vet = "go vet ./..." static = "staticcheck -checks=all ./..." vuln = "govulncheck ./..." fmt = "go fmt ./... && goimports -l -w ." -has-changes = "git diff --exit-code --quiet HEAD --" \ No newline at end of file +has-changes = "git diff --exit-code --quiet HEAD --" From 6522efed4b902a9c5a8eb73d0d1873f5557a8a22 Mon Sep 17 00:00:00 2001 From: slashformotion Date: Mon, 22 Dec 2025 19:28:54 +0100 Subject: [PATCH 4/8] fix --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9170ae3..815f32b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -137,7 +137,7 @@ jobs: - name: go vet run: mise vet - name: Running staticcheck - run: mise staticcheck + run: mise static - name: Running vulncheck run: mise vuln From 307ad86e54d51215c2c18bf3e296d5498e860280 Mon Sep 17 00:00:00 2001 From: slashformotion Date: Mon, 22 Dec 2025 20:44:11 +0100 Subject: [PATCH 5/8] crazy --- .github/workflows/ci.yaml | 156 ++------------------------- .github/workflows/lint-tests.yaml | 172 ++++++++++++++++++++++++++++++ 2 files changed, 179 insertions(+), 149 deletions(-) create mode 100644 .github/workflows/lint-tests.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 815f32b..418b22e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,155 +9,13 @@ on: - main jobs: - preflight: + test-lint: runs-on: ubuntu-latest - outputs: - gopath: ${{ steps.gopath.outputs.value }} - go-mods-cache-key: ${{ steps.cache-keys.outputs.go-mods-cache-key }} - go-bins-cache-key: ${{ steps.cache-keys.outputs.go-bins-cache-key }} + strategy: + matrix: + go-version: [ "1.25", "1.24" ] steps: - - uses: actions/checkout@v4 + - name: Run test and lint on ${{ matrix.go-version }} + uses: ./.github/workflows/lint-test.yaml with: - submodules: "false" - - - uses: jdx/mise-action@v3 - with: - cache: true - reshim: true - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get Go path - id: gopath - run: echo "value=$(go env GOPATH)" >> $GITHUB_OUTPUT - - - name: Cache keys - id: cache-keys - run: | - echo "go-mods-cache-key=go-mods-${{ runner.os }}-${{ hashFiles('**/go.sum') }}" >> $GITHUB_OUTPUT - - - name: Cache Go mods - id: go-mods-cache - uses: actions/cache@v4 - with: - lookup-only: true - path: ${{ steps.gopath.outputs.value }}/pkg/mod - key: ${{ steps.cache-keys.outputs.go-mods-cache-key }} - - - name: 📥 Download dependencies - if: steps.go-mods-cache.outputs.cache-hit != 'true' - run: go mod download - - - - test: - runs-on: ubuntu-latest - needs: preflight - services: - postgres: - image: postgres:17.4 - ports: - - 5444:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - POSTGRES_PASSWORD: password - steps: - - uses: actions/checkout@v4 - - uses: jdx/mise-action@v3 - with: - cache: true - reshim: true - github_token: ${{ secrets.GITHUB_TOKEN }} - - name: 💾 Cache Go mods - uses: actions/cache@v4 - with: - path: ${{ needs.preflight.outputs.gopath }}/pkg/mod - key: ${{ needs.preflight.outputs.go-mods-cache-key }} - fail-on-cache-miss: true - - name: Run tests units - run: | - mkdir -p /tmp/test-reports - gotestsum --junitfile /tmp/test-reports/unit-tests.xml - - uses: actions/upload-artifact@v4 - name: Upload test results - with: - name: test-reports-${{ matrix.go-version }} - path: /tmp/test-reports - - name: Run Examples - run: make test-examples - - - name: Update coverage report - uses: ncruces/go-coverage-report@v0.3.0 - with: - report: true - chart: true - amend: true - if: | - matrix.go-version == 'stable' - continue-on-error: true - - test-race: - runs-on: ubuntu-latest - needs: preflight - steps: - - uses: actions/checkout@v4 - - uses: jdx/mise-action@v3 - with: - cache: true - reshim: true - github_token: ${{ secrets.GITHUB_TOKEN }} - - name: 💾 Cache Go mods - uses: actions/cache@v4 - with: - path: ${{ needs.preflight.outputs.gopath }}/pkg/mod - key: ${{ needs.preflight.outputs.go-mods-cache-key }} - fail-on-cache-miss: true - - name: Run tests with race detector - run: make test-race - - lint: - runs-on: ubuntu-latest - needs: preflight - steps: - - uses: actions/checkout@v4 - - uses: jdx/mise-action@v3 - with: - cache: true - reshim: true - github_token: ${{ secrets.GITHUB_TOKEN }} - - name: 💾 Cache Go mods - uses: actions/cache@v4 - with: - path: ${{ needs.preflight.outputs.gopath }}/pkg/mod - key: ${{ needs.preflight.outputs.go-mods-cache-key }} - fail-on-cache-miss: true - - name: go vet - run: mise vet - - name: Running staticcheck - run: mise static - - name: Running vulncheck - run: mise vuln - - fmt: - runs-on: ubuntu-latest - needs: preflight - steps: - - uses: actions/checkout@v4 - - uses: jdx/mise-action@v3 - with: - cache: true - reshim: true - github_token: ${{ secrets.GITHUB_TOKEN }} - - name: 💾 Cache Go mods - uses: actions/cache@v4 - with: - path: ${{ needs.preflight.outputs.gopath }}/pkg/mod - key: ${{ needs.preflight.outputs.go-mods-cache-key }} - fail-on-cache-miss: true - - name: Running formatting - run: | - mise fmt - mise has-changes \ No newline at end of file + go-version: ${{ matrix.go-version }} \ No newline at end of file diff --git a/.github/workflows/lint-tests.yaml b/.github/workflows/lint-tests.yaml new file mode 100644 index 0000000..915113d --- /dev/null +++ b/.github/workflows/lint-tests.yaml @@ -0,0 +1,172 @@ +name: CI + +on: + workflow_call: + inputs: + go-version: + type: string + required: true + +jobs: + preflight: + runs-on: ubuntu-latest + outputs: + gopath: ${{ steps.gopath.outputs.value }} + go-mods-cache-key: ${{ steps.cache-keys.outputs.go-mods-cache-key }} + go-bins-cache-key: ${{ steps.cache-keys.outputs.go-bins-cache-key }} + steps: + - uses: actions/checkout@v4 + with: + submodules: "false" + + - uses: jdx/mise-action@v3 + with: + cache: true + reshim: true + tool_versions: | + go ${{ inputs.go-version }} + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get Go path + id: gopath + run: echo "value=$(go env GOPATH)" >> $GITHUB_OUTPUT + + - name: Cache keys + id: cache-keys + run: | + echo "go-mods-cache-key=go-mods-${{ runner.os }}-${{ hashFiles('**/go.sum') }}" >> $GITHUB_OUTPUT + + - name: Cache Go mods + id: go-mods-cache + uses: actions/cache@v4 + with: + lookup-only: true + path: ${{ steps.gopath.outputs.value }}/pkg/mod + key: ${{ steps.cache-keys.outputs.go-mods-cache-key }} + + - name: 📥 Download dependencies + if: steps.go-mods-cache.outputs.cache-hit != 'true' + run: go mod download + + + + test: + runs-on: ubuntu-latest + needs: preflight + services: + postgres: + image: postgres:17.4 + ports: + - 5444:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_PASSWORD: password + steps: + - uses: actions/checkout@v4 + - uses: jdx/mise-action@v3 + with: + cache: true + reshim: true + tool_versions: | + go ${{ inputs.go-version }} + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: 💾 Cache Go mods + uses: actions/cache@v4 + with: + path: ${{ needs.preflight.outputs.gopath }}/pkg/mod + key: ${{ needs.preflight.outputs.go-mods-cache-key }} + fail-on-cache-miss: true + - name: Run tests units + run: | + mkdir -p /tmp/test-reports + gotestsum --junitfile /tmp/test-reports/unit-tests.xml + - uses: actions/upload-artifact@v4 + name: Upload test results + with: + name: test-reports-${{ matrix.go-version }} + path: /tmp/test-reports + - name: Run Examples + run: make test-examples + + - name: Update coverage report + uses: ncruces/go-coverage-report@v0.3.0 + with: + report: true + chart: true + amend: true + if: | + matrix.go-version == 'stable' + continue-on-error: true + + test-race: + runs-on: ubuntu-latest + needs: preflight + steps: + - uses: actions/checkout@v4 + - uses: jdx/mise-action@v3 + with: + cache: true + reshim: true + tool_versions: | + go ${{ inputs.go-version }} + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: 💾 Cache Go mods + uses: actions/cache@v4 + with: + path: ${{ needs.preflight.outputs.gopath }}/pkg/mod + key: ${{ needs.preflight.outputs.go-mods-cache-key }} + fail-on-cache-miss: true + - name: Run tests with race detector + run: make test-race + + lint: + runs-on: ubuntu-latest + needs: preflight + steps: + - uses: actions/checkout@v4 + - uses: jdx/mise-action@v3 + with: + cache: true + reshim: true + tool_versions: | + go ${{ inputs.go-version }} + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: 💾 Cache Go mods + uses: actions/cache@v4 + with: + path: ${{ needs.preflight.outputs.gopath }}/pkg/mod + key: ${{ needs.preflight.outputs.go-mods-cache-key }} + fail-on-cache-miss: true + - name: go vet + run: mise vet + - name: Running staticcheck + run: mise static + - name: Running vulncheck + run: mise vuln + + fmt: + runs-on: ubuntu-latest + needs: preflight + steps: + - uses: actions/checkout@v4 + - uses: jdx/mise-action@v3 + with: + cache: true + reshim: true + tool_versions: | + go ${{ inputs.go-version }} + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: 💾 Cache Go mods + uses: actions/cache@v4 + with: + path: ${{ needs.preflight.outputs.gopath }}/pkg/mod + key: ${{ needs.preflight.outputs.go-mods-cache-key }} + fail-on-cache-miss: true + - name: Running formatting + run: | + mise fmt + mise has-changes \ No newline at end of file From 71ea5ca4b24fdc7acaf77d0b92d4a6b6640c2674 Mon Sep 17 00:00:00 2001 From: slashformotion Date: Mon, 22 Dec 2025 20:45:37 +0100 Subject: [PATCH 6/8] dfdfdf --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 418b22e..648938a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,6 +15,7 @@ jobs: matrix: go-version: [ "1.25", "1.24" ] steps: + - uses: actions/checkout@v4 - name: Run test and lint on ${{ matrix.go-version }} uses: ./.github/workflows/lint-test.yaml with: From 00a12df63af3d13c0f2824c75fdcc344a63fd498 Mon Sep 17 00:00:00 2001 From: slashformotion Date: Mon, 22 Dec 2025 20:46:39 +0100 Subject: [PATCH 7/8] ssd --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 648938a..d050c23 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run test and lint on ${{ matrix.go-version }} - uses: ./.github/workflows/lint-test.yaml + uses: ./.github/workflows/lint-tests.yaml with: go-version: ${{ matrix.go-version }} \ No newline at end of file From 8c575c77ac12d6ff48d42950f9e9d2fc8280786f Mon Sep 17 00:00:00 2001 From: slashformotion Date: Tue, 23 Dec 2025 10:05:57 +0100 Subject: [PATCH 8/8] remove --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d050c23..ec92942 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,6 +16,7 @@ jobs: go-version: [ "1.25", "1.24" ] steps: - uses: actions/checkout@v4 + - run: ls -la ./.github/workflows/ - name: Run test and lint on ${{ matrix.go-version }} uses: ./.github/workflows/lint-tests.yaml with: