# 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. Also guards the # `version` file: it must match the latest git tag (if any), otherwise the # self-update check would report a phantom update. name: tests on: push: pull_request: workflow_dispatch: jobs: version-guard: runs-on: linux steps: - name: Checkout with full history and tags uses: actions/checkout@v4 with: fetch-depth: 0 fetch-tags: true - name: Check version file matches latest tag (when tags exist) run: | VERSION=$(tr -d ' \n' < version) echo "version file: ${VERSION}" LATEST=$(git describe --tags --abbrev=0 2>/dev/null || true) if [ -z "${LATEST}" ]; then echo "No tags yet — skipping version guard" exit 0 fi # Tags are like v1.3.1 / V1.3.1 ; the file holds 1.3.1 NORMALIZED=$(echo "${LATEST}" | sed -E 's/^[vV]//') echo "latest tag: ${LATEST} (normalized: ${NORMALIZED})" if [ "${VERSION}" != "${NORMALIZED}" ]; then echo "::error::version file (${VERSION}) does not match latest tag ${LATEST} (expected ${NORMALIZED}). Bump the version file before tagging." exit 1 fi echo "version file matches latest tag" 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 \ -DFWS_BUILD_EXAMPLE_ADDON=ON \ -DCMAKE_BUILD_TYPE=Release - name: Build run: | cmake --build build -j$(nproc) - name: Run all tests run: | cd build ctest --output-on-failure