Compare commits
3
Commits
b3a7bb4b67
..
V1.2.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
096553e429 | ||
|
|
7b7962c53f | ||
|
|
1903bad336 |
No files matched your search
@@ -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
|
||||
runs-on: linux
|
||||
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
|
||||
JSON
|
||||
@@ -0,0 +1,54 @@
|
||||
# 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: linux
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
# Host-mode runners execute jobs directly on the runner machine, so
|
||||
# detect its package manager instead of hardcoding apt (which only
|
||||
# exists on Debian/Ubuntu hosts).
|
||||
if command -v pacman >/dev/null 2>&1; then
|
||||
sudo pacman -S --noconfirm --needed \
|
||||
git cmake gcc make qt6-base
|
||||
elif command -v apt-get >/dev/null 2>&1; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
git cmake g++ make qt6-base-dev
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
sudo dnf install -y \
|
||||
git cmake gcc-c++ make qt6-qtbase-devel
|
||||
else
|
||||
echo "Unsupported package manager: install git, cmake, a C++ compiler, make and Qt6 manually" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- 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
|
||||
Reference in new issue
Block a user