From c4d078336652a649be71be2c2322ef07338cec27 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sat, 5 Dec 2026 15:09:18 +0300 Subject: [PATCH] ci: add a tag input for manual releases and a Windows job The manual dispatch can now publish a release for a given tag (the packages and the release use it), so existing releases can receive their assets without cutting a new tag. Add a MinGW-w64 + Wine job that cross-builds a Windows target from the debug build and runs its test under Wine. Note that VBS itself still only builds on Linux hosts; Windows is a target platform (Track C). --- .gitea/workflows/ci.yml | 88 +++++++++++++++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 22fbb8c..23915f4 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -29,6 +29,10 @@ on: description: "Create/publish the Gitea release (only for a v* tag ref)" required: false default: "false" + tag: + description: "Release tag to publish (empty: the pushed tag)" + required: false + default: "" permissions: contents: write @@ -106,7 +110,7 @@ jobs: linker_flags: "-fsanitize=undefined" steps: - uses: actions/checkout@v4 - - name: Configure (${{ matrix.name }}, ${{ matrix.build_type }}) + - name: Configure run: | cmake -S . -B "build/${{ matrix.name }}" -G Ninja \ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ @@ -114,9 +118,9 @@ jobs: -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" \ -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.linker_flags }}" \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - - name: Build (${{ matrix.name }}) + - name: Build run: cmake --build "build/${{ matrix.name }}" --parallel 4 - - name: Upload the build (${{ matrix.name }}) + - name: Upload the build uses: actions/upload-artifact@v3 with: name: vbs-build-${{ matrix.name }} @@ -151,14 +155,14 @@ jobs: UBSAN_OPTIONS: print_stacktrace=1 steps: - uses: actions/checkout@v4 - - name: Download the build (${{ matrix.name }}) + - name: Download the build uses: actions/download-artifact@v3 with: name: vbs-build-${{ matrix.name }} path: build/${{ matrix.name }} - name: Make the restored binaries executable run: chmod +x "build/${{ matrix.name }}/bin/"* - - name: Run CTest (${{ matrix.name }}) + - name: Run CTest run: | set -o pipefail if [ -n "${{ matrix.test_regex }}" ]; then @@ -171,7 +175,7 @@ jobs: - name: Benchmark smoke run if: matrix.name == 'debug' run: build/debug/bin/vbs_benchmarks --files 15 - - name: Upload the test log (${{ matrix.name }}) + - name: Upload the test log if: always() uses: actions/upload-artifact@v3 with: @@ -179,6 +183,60 @@ jobs: path: ctest-${{ matrix.name }}.log retention-days: 14 + windows: + name: "3b · Windows (MinGW-w64 + Wine)" + needs: build + runs-on: echoion-release-serial + env: + WINEDEBUG: "-all" + steps: + - uses: actions/checkout@v4 + - name: Download the debug build + uses: actions/download-artifact@v3 + with: + name: vbs-build-debug + path: build/debug + - name: Make the restored binaries executable + run: chmod +x build/debug/bin/* + - name: Install the MinGW-w64 cross toolchain and Wine + run: | + sudo="" + if [ "$(id -u)" -ne 0 ]; then sudo="sudo"; fi + if ! command -v x86_64-w64-mingw32-g++ >/dev/null 2>&1 || + ! command -v wine >/dev/null 2>&1; then + if command -v apt-get >/dev/null 2>&1; then + ${sudo} apt-get update + ${sudo} apt-get install -y mingw-w64 wine64 || + ${sudo} apt-get install -y mingw-w64 wine + fi + fi + if ! command -v x86_64-w64-mingw32-g++ >/dev/null 2>&1; then + echo "x86_64-w64-mingw32-g++ is required for the Windows target build" >&2 + exit 1 + fi + if ! command -v wine >/dev/null 2>&1 && command -v wine64 >/dev/null 2>&1; then + ${sudo} ln -sf "$(command -v wine64)" /usr/local/bin/wine + fi + if ! command -v wine >/dev/null 2>&1; then + echo "wine is required to run the Windows test binaries" >&2 + exit 1 + fi + x86_64-w64-mingw32-g++ --version | head -1 + wine --version + - name: Cross-build a Windows target and run it under Wine + run: | + set -o pipefail + build/debug/bin/vbs_v1_tests --no-color \ + --filter track_c_windows_target_cross_build_and_wine_test \ + 2>&1 | tee ctest-windows.log + - name: Upload the Windows log + if: always() + uses: actions/upload-artifact@v3 + with: + name: vbs-test-windows + path: ctest-windows.log + retention-days: 14 + package: name: "4 · Package" needs: test @@ -195,11 +253,13 @@ jobs: - name: Package the binaries, the SDK and the source run: | set -eu - ref="${GITHUB_REF_NAME}" - case "${ref}" in - v*) label="${ref}" ;; - *) label="dev-$(printf '%s' "${GITHUB_SHA}" | cut -c1-7)" ;; - esac + label="${{ github.event.inputs.tag }}" + if [ -z "${label}" ]; then + case "${GITHUB_REF_NAME}" in + v*) label="${GITHUB_REF_NAME}" ;; + *) label="dev-$(printf '%s' "${GITHUB_SHA}" | cut -c1-7)" ;; + esac + fi stage="$(mktemp -d)" mkdir -p "${stage}/bin" "${stage}/include" "${stage}/lib" dist cp build/relwithdebinfo/bin/vbs build/relwithdebinfo/bin/vbs-registry "${stage}/bin/" @@ -233,7 +293,8 @@ jobs: path: dist - name: Verify the tag matches the project version run: | - tag="${GITHUB_REF_NAME}" + tag="${{ github.event.inputs.tag }}" + if [ -z "${tag}" ]; then tag="${GITHUB_REF_NAME}"; fi version="$(sed -nE 's/^project\(VoidBuildSystem VERSION ([0-9.]+).*/\1/p' CMakeLists.txt)" echo "tag=${tag} project version=${version}" case "${tag}" in @@ -249,7 +310,8 @@ jobs: TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -eu - tag="${GITHUB_REF_NAME}" + tag="${{ github.event.inputs.tag }}" + if [ -z "${tag}" ]; then tag="${GITHUB_REF_NAME}"; fi case "${tag}" in v*) ;; *) echo "not a release tag (${tag}); skipping the release upload" ; exit 0 ;;