1
0
mirror of https://git.tukaani.org/xz.git synced 2025-04-23 08:00:54 +00:00
xz/.github/workflows/msys2.yml
Lasse Collin ffa9fadecc
CI: Revise MSYS2
Re-enable CLANG64 environment. Add CLANGARM64. Don't add MINGW64
to slightly reduce the number of runner VMs needed.

Install the required packages using the setup-msys2 action instead
of running the commands separately.

Test Autotools and CMake in the same job to reduce the number of VMs.
This doesn't slow it down too much because the msys2-setup step is
needed by both. However, do only the full builds on ARM64 because
those runners seem to be slower.

Test fewer build configurations. The point of testing on MSYS2 is to
catch Windows-related issues. It should be enough that the more unusual
build configurations are tested in ci.yml.

Run the build commands directly instead of using ci_build.bash. This
makes it easier to see what commands are run even if it is a little
more verbose now.

Run the workflow automatically when commit are pushed to master.
With the fewer build variants it's not too slow.
2025-04-22 19:00:19 +03:00

148 lines
4.2 KiB
YAML

# SPDX-License-Identifier: 0BSD
#############################################################################
#
# Authors: Jia Tan
# Lasse Collin
#
#############################################################################
name: Windows-MSYS2
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
permissions: {}
jobs:
MSYS2:
strategy:
fail-fast: false
matrix:
runner: [ windows-latest ]
sys: [ mingw32, ucrt64, clang64, msys ]
include:
- runner: windows-11-arm
sys: clangarm64
# 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: ${{ matrix.runner }}
steps:
- name: Setup MSYS2
if: ${{ matrix.sys == 'msys' }}
uses: msys2/setup-msys2@61f9e5e925871ba6c9e3e8da24ede83ea27fa91f # v2.27.0
with:
msystem: ${{ matrix.sys }}
update: true
install: >
make
ninja
autotools
cmake
base-devel
gettext-devel
gcc
- name: Setup MSYS2
if: ${{ matrix.sys != 'msys' }}
uses: msys2/setup-msys2@61f9e5e925871ba6c9e3e8da24ede83ea27fa91f # v2.27.0
with:
msystem: ${{ matrix.sys }}
update: true
pacboy: >
make:p
ninja:p
autotools:p
cmake:p
toolchain:p
gettext:p
- name: Git configuration
# 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@v4
- name: CMake (full, shared)
run: |
set -e
cmake -G Ninja -B b-cmake-full \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_C_FLAGS='-UNDEBUG -g -O2 -pipe' \
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON \
${{ startsWith(matrix.sys, 'mingw') && '-DXZ_NLS=OFF' || '' }}
ninja -C b-cmake-full
ctest --test-dir b-cmake-full --output-on-failure
- name: CMake (small, static)
if: ${{ matrix.runner == 'windows-latest' }}
run: |
set -e
cmake -G Ninja -B b-cmake-small \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS='-UNDEBUG -g -Os -pipe' \
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON \
-DXZ_SMALL=ON \
-DXZ_THREADS=no \
-DXZ_NLS=OFF
ninja -C b-cmake-small
ctest --test-dir b-cmake-small --output-on-failure
- name: autogen.sh
run: ./autogen.sh --no-po4a
- name: Autotools (full, shared)
run: |
set -e
mkdir b-autotools-full
cd b-autotools-full
../configure \
--enable-debug \
--enable-werror \
--disable-static \
${{ startsWith(matrix.sys, 'mingw') && '--disable-nls' || '' }}
make -j"$(nproc)" check
- name: Autotools (small, static)
if: ${{ matrix.runner == 'windows-latest' }}
run: |
set -e
mkdir b-autotools-small
cd b-autotools-small
../configure \
--enable-debug \
--enable-werror \
--disable-shared \
--enable-small \
--disable-threads \
--disable-nls \
CFLAGS='-g -Os'
make -j"$(nproc)" check
# Upload the test logs as artifacts if any step has failed.
- uses: actions/upload-artifact@v4
if: failure()
with:
name: test-logs-${{ matrix.sys }}
path: |
b-cmake-*/Testing/Temporary/
b-cmake-*/test_*/
b-autotools-*/tests/*.log
b-autotools-*/tests/*output