From f3a055f762ba5b71b746fc2d44a6ababde2c61b5 Mon Sep 17 00:00:00 2001 From: Jia Tan Date: Sat, 22 Jul 2023 14:55:42 +0800 Subject: [PATCH] CI: Add Windows runner for Autotools builds with MSYS2. Only a subset of the tests run by the Linux and MacOS Autotools builds are run. The most interesting tests are the ones that disable threads, encoders, and decoders. The Windows runner will only be run manually since these tests will likely take much longer than the Linux and MacOS runners. This runner should be used before merging any large features and before releases. Currently the clang64 environment fails to due to a warning and -Werror is enabled for the CI tests. This is still an early version since the CMake build can be done for MSVC and optionally each of the MSYS2 environments. GitHub does not allow manually running the CI tests unless the workflow is checked on the default branch so checking in a minimum version is a good idea. Thanks to Arthur S for the original proposing the original patch. Closes: https://github.com/tukaani-project/xz/pull/34 --- .github/workflows/windows-ci.yml | 119 +++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 .github/workflows/windows-ci.yml diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml new file mode 100644 index 00000000..a8805dc5 --- /dev/null +++ b/.github/workflows/windows-ci.yml @@ -0,0 +1,119 @@ +############################################################################# +# +# Author: Jia Tan +# +# This file has been put into the public domain. +# You can do whatever you want with this file. +# +############################################################################# + +name: Windows-CI + +# Only run the Windows CI manually since it takes much longer than the others. +on: workflow_dispatch + +jobs: + POSIX: + strategy: + matrix: + # Test different environments since the code may change between + # them and we want to ensure that we support all potential users. + # clang64 currently fails due to a warning, so support will be + # added later. + system: + - mingw64 + - mingw32 + - ucrt64 + - msys + + # Set the shell to be msys2 as a default to avoid setting it for + # every individual run command. + defaults: + run: + shell: msys2 {0} + + runs-on: windows-latest + + steps: + ##################### + # Setup Environment # + ##################### + + # Rely on the msys2 GitHub Action to set up the msys2 environment. + - name: Setup MSYS2 + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.system }} + update: true + install: pactoys + + - name: Checkout code + # Need to explicitly set the shell here since we set the default + # shell as msys2 earlier. This avoids an extra msys2 dependency on + # git. + shell: powershell + # Avoid Windows line endings. Otherwise test_scripts.sh will fail + # because the expected output is stored in the test framework as a + # text file and will not match the output from xzgrep. + run: git config --global core.autocrlf false + + - uses: actions/checkout@v3 + + + ######################## + # Install Dependencies # + ######################## + + # The pacman repository has a different naming scheme for default + # msys packages than the others. The pacboy tool allows installing + # the packages possible in matrix setup without a burdensome amount + # of ifs. + - name: Install Dependencies + if: ${{ matrix.system == 'msys' }} + run: pacman --noconfirm -S --needed autotools base-devel doxygen gettext-devel gcc + + - name: Install Dependencies + if: ${{ matrix.system != 'msys' }} + run: pacboy --noconfirm -S --needed autotools:p gcc:p clang:p make:p doxygen:p + + + ################## + # Build and Test # + ################## + + - name: Build with full features + run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -p build + - name: Test with full features + run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -p test -n full_features + + - name: Build without threads + run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d threads,shared -p build + - name: Test without threads + run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d threads,shared -p test -n no_threads + + - name: Build without encoders + run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d encoders,shared -p build + - name: Test without encoders + run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d encoders,shared -p test -n no_encoders + + - name: Build without decoders + run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d decoders,shared -p build + - name: Test without decoders + run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d decoders,shared -p test -n no_decoders + + - name: Build with only crc32 check + run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -c crc32 -d shared,nls -p build + - name: Test with only crc32 check + run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -c crc32 -d shared,nls -p test -n crc32_only + + + ############### + # Upload Logs # + ############### + + # Upload the test logs as artifacts if any step has failed. + - uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: ${{ matrix.os }} ${{ matrix.build_system }} Test Logs + path: build-aux/artifacts