From 0fb239a239eadf2a419d3bc633287e54bea1a17b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 9 Nov 2025 23:05:47 +0000 Subject: [PATCH 1/2] feat(ci): add pre-release testing and codecov - Adds a `test-release` target to the `Makefile` to run tests and cross-compile the binaries for all platforms. - Updates the `release.yml` workflow to use the new `test-release` target before the `GoReleaser` action. - Adds a step to the `release.yml` workflow to upload the coverage report to Codecov. - Reorganizes the badges in the `README.md` file. --- .github/workflows/release.yml | 8 ++++++++ Makefile | 4 ++++ README.md | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1284998..75be433 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,6 +38,14 @@ jobs: # npm install # npm run build + - name: Run pre-release tests + run: make test-release + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: diff --git a/Makefile b/Makefile index d1393f1..da9710a 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,10 @@ test: @echo "Running tests..." $(GO) test -v -race -coverprofile=coverage.out ./... +# Run tests and build for all platforms +test-release: test build-all + @echo "Test release successful" + # Run tests with coverage report coverage: test @echo "Generating coverage report..." diff --git a/README.md b/README.md index 973e692..2e1f03b 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ [![Go Version](https://img.shields.io/badge/go-1.24+-blue.svg)](https://golang.org) [![GoDoc](https://pkg.go.dev/badge/github.com/Snider/Mining.svg)](https://pkg.go.dev/github.com/Snider/Mining) [![Go Report Card](https://goreportcard.com/badge/github.com/Snider/Mining)](https://goreportcard.com/report/github.com/Snider/Mining) -[![License: EUPL-1.2](https://img.shields.io/badge/License-EUPL--1.2-blue.svg)](https://opensource.org/license/eupl-1-2) -[![Release](https://img.shields.io/github/release/Snider/Mining.svg)](https://github.com/Snider/Mining/releases) [![codecov](https://codecov.io/gh/Snider/Mining/branch/main/graph/badge.svg)](https://codecov.io/gh/Snider/Mining) +[![Release](https://img.shields.io/github/release/Snider/Mining.svg)](https://github.com/Snider/Mining/releases) +[![License: EUPL-1.2](https://img.shields.io/badge/License-EUPL--1.2-blue.svg)](https://opensource.org/license/eupl-1-2) GoLang Miner management with RESTful control - A modern, modular package for managing cryptocurrency miners. From 30497ac3177242ee3dd4a1331d693df5bd2e667e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 9 Nov 2025 23:11:21 +0000 Subject: [PATCH 2/2] feat(ci): add matrix testing and conditional release - Adds a `test` job to the `release.yml` workflow that runs on a matrix of operating systems (Linux, macOS, Windows). - The `release` job is now dependent on the `test` job. - The workflow is now triggered on every push, but the `release` job only runs on tag pushes. - Adds a `test-release` target to the `Makefile` to run tests and cross-compile the binaries for all platforms. - Updates the `release.yml` workflow to use the new `test-release` target. - Adds a step to the `test` job to upload the coverage report to Codecov. - Reorganizes the badges in the `README.md` file. --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75be433..e6dd8be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,8 @@ name: Release on: push: + branches: + - '**' tags: - 'v*.*.*' @@ -11,11 +13,38 @@ permissions: issues: write id-token: write - jobs: + test: + name: Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + + - name: Run pre-release tests + run: make test-release + + - name: Upload coverage to Codecov + if: matrix.os == 'ubuntu-latest' + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + release: name: Release + needs: test runs-on: ubuntu-latest + if: github.ref_type == 'tag' steps: - name: Checkout uses: actions/checkout@v4 @@ -32,19 +61,11 @@ jobs: with: node-version: '20' -# - name: Build UI -# run: | -# cd ui -# npm install -# npm run build - - - name: Run pre-release tests - run: make test-release - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} + # - name: Build UI + # run: | + # cd ui + # npm install + # npm run build - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6