CI: Test CMake builds and test framework with MSYS2.
[xz.git] / .github / workflows / windows-ci.yml
blobf5c58bac5b86787327177fbb9d0d3b3c156f818d
1 #############################################################################
3 # Author: Jia Tan
5 # This file has been put into the public domain.
6 # You can do whatever you want with this file.
8 #############################################################################
10 name: Windows-CI
12 # Only run the Windows CI manually since it takes much longer than the others.
13 on: workflow_dispatch
15 jobs:
16   POSIX:
17     strategy:
18       matrix:
19         # Test different environments since the code may change between
20         # them and we want to ensure that we support all potential users.
21         # clang64 currently fails due to a warning, so support will be
22         # added later.
23         msys2_env: [mingw64, mingw32, ucrt64, clang64, msys]
24         build_system: [autotools, cmake]
26     # Set the shell to be msys2 as a default to avoid setting it for
27     # every individual run command.
28     defaults:
29       run:
30         shell: msys2 {0}
32     runs-on: windows-latest
34     steps:
35       #####################
36       # Setup Environment #
37       #####################
39       # Rely on the msys2 GitHub Action to set up the msys2 environment.
40       - name: Setup MSYS2
41         uses: msys2/setup-msys2@v2
42         with:
43           msystem: ${{ matrix.msys2_env }}
44           update: true
45           install: pactoys
47       - name: Checkout code
48         # Need to explicitly set the shell here since we set the default
49         # shell as msys2 earlier. This avoids an extra msys2 dependency on
50         # git.
51         shell: powershell
52         # Avoid Windows line endings. Otherwise test_scripts.sh will fail
53         # because the expected output is stored in the test framework as a
54         # text file and will not match the output from xzgrep.
55         run: git config --global core.autocrlf false
57       - uses: actions/checkout@v3
60       ########################
61       # Install Dependencies #
62       ########################
64         # The pacman repository has a different naming scheme for default
65         # msys packages than the others. The pacboy tool allows installing
66         # the packages possible in matrix setup without a burdensome amount
67         # of ifs.
68       - name: Install Dependencies
69         if: ${{ matrix.msys2_env == 'msys' && matrix.build_system == 'autotools' }}
70         run: pacman --noconfirm -S --needed autotools base-devel doxygen gettext-devel gcc
72       - name: Install Dependencies
73         if: ${{ matrix.msys2_env != 'msys' && matrix.build_system == 'autotools' }}
74         run: pacboy --noconfirm -S --needed autotools:p gcc:p clang:p make:p doxygen:p
76       - name: Install Dependencies
77         if: ${{ matrix.msys2_env == 'msys' && matrix.build_system == 'cmake' }}
78         run: pacman --noconfirm -S --needed cmake base-devel gcc
80       - name: Install Dependencies
81         if: ${{ matrix.msys2_env != 'msys' && matrix.build_system == 'cmake' }}
82         run: pacboy --noconfirm -S --needed cmake:p gcc:p clang:p make:p
84       ##################
85       # Build and Test #
86       ##################
88       - name: Build with full features
89         run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -p build
90       - name: Test with full features
91         run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -p test -n full_features
93       - name: Build without threads
94         run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d threads,shared -p build
95       - name: Test without threads
96         run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d threads,shared -p test -n no_threads
98       - name: Build without encoders
99         run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d encoders,shared -p build
100       - name: Test without encoders
101         run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d encoders,shared -p test -n no_encoders
103       - name: Build without decoders
104         run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d decoders,shared -p build
105       - name: Test without decoders
106         run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d decoders,shared -p test -n no_decoders
108       - name: Build with only crc32 check
109         run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -c crc32 -d shared,nls -p build
110       - name: Test with only crc32 check
111         run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -c crc32 -d shared,nls -p test -n crc32_only
114       ###############
115       # Upload Logs #
116       ###############
118       # Upload the test logs as artifacts if any step has failed.
119       - uses: actions/upload-artifact@v3
120         if: ${{ failure() }}
121         with:
122           name: ${{ matrix.msys2_env }} ${{ matrix.build_system }} Test Logs
123           path: build-aux/artifacts