From 1903bad3367589af045067a0f6c566cd656613cf Mon Sep 17 00:00:00 2001 From: BlackAngelTV Date: Sat, 29 Aug 2026 20:43:07 +0200 Subject: [PATCH] ci: split tests and release workflows, drop secret requirement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Release no longer runs or depends on the test suite, and uses the built-in automatic GITEA_TOKEN with a contents: write permission so no secret needs to be configured. Tests moved to a dedicated workflow that runs on every push and pull request. 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- .gitea/workflows/release.yml | 63 +++++++++++------------------------- .gitea/workflows/test.yml | 40 +++++++++++++++++++++++ 2 files changed, 58 insertions(+), 45 deletions(-) create mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index a36649d..d2a0343 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,14 +1,15 @@ # Gitea Actions — Release # # Triggered whenever the `version` file at the repository root is bumped. -# It builds the application, runs the full test suite (ctest), and creates a -# Gitea release tagged with the new version — but ONLY if: -# - the version in `version` differs from the latest released tag, and -# - every test passes. +# Creates a Gitea release tagged with the new version — but ONLY if the +# version in `version` differs from the latest released tag. # -# Because the release job `needs: build-test`, it never runs when a test fails: -# Gitea skips dependent jobs after a failure, so a broken suite blocks the -# release automatically. +# No secret is required: `secrets.GITEA_TOKEN` is the built-in automatic +# token provided by Gitea on every run. The `permissions: contents: write` +# block below asks for write access to contents and releases, so the release +# can be created without configuring any secret in the repository settings. +# Tests are deliberately not run here; they live in the separate `tests` +# workflow and do not gate releases. name: release @@ -20,42 +21,14 @@ on: - version workflow_dispatch: +permissions: + contents: write + jobs: - # Build the project and run every test. Fails the run if any test fails, - # which in turn stops the `release` job below. - build-test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y \ - cmake g++ make qt6-base-dev - - - name: Configure - run: | - cmake -B build \ - -DFWS_BUILD_EXAMPLE_PLUGIN=ON \ - -DCMAKE_BUILD_TYPE=Release - - - name: Build - run: | - cmake --build build -j$(nproc) - - - name: Run all tests - run: | - cd build - ctest --output-on-failure - - # Reads the new version and publishes a release + git tag. Only reached when - # build-test succeeded (Gitea `needs` skips the job otherwise) and when the - # version genuinely changed. + # Reads the new version and publishes a release + git tag when the version + # genuinely changed. Runs without any test step. release: runs-on: ubuntu-latest - needs: build-test # guarantees all tests passed before releasing steps: - name: Checkout with full history and tags uses: actions/checkout@v4 @@ -84,16 +57,16 @@ jobs: - name: Create release if: steps.check.outputs.new == 'true' env: - # The token used to create the release. For the automatic one to have - # write access it must be granted the 'repository contents' (write) - # permission on the repo. Otherwise set a GITEA_TOKEN secret. + # Built-in automatic token, no secret to configure. The + # `permissions` block at the top grants it write access to + # contents/releases for this run. GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | VERSION="${{ steps.version.outputs.value }}" TAG="v${VERSION}" BODY=$(cat <<'EOF' Release automatically generated by the `release` workflow when the - `version` file was bumped and all tests passed. + `version` file was bumped. EOF ) curl -sS -X POST "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases" \ @@ -106,4 +79,4 @@ jobs: "name": "v${VERSION}", "body": "${BODY}" } - JSON \ No newline at end of file + JSON diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..15b38bf --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,40 @@ +# Gitea Actions — Tests +# +# Dedicated test workflow: builds the application and runs the full test suite +# (ctest) on every push and pull request. Kept separate from the release +# workflow so a failing test never blocks a release. + +name: tests + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + build-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + cmake g++ make qt6-base-dev + + - name: Configure + run: | + cmake -B build \ + -DFWS_BUILD_EXAMPLE_PLUGIN=ON \ + -DCMAKE_BUILD_TYPE=Release + + - name: Build + run: | + cmake --build build -j$(nproc) + + - name: Run all tests + run: | + cd build + ctest --output-on-failure