ci: improve MSYS2 build on GHA #58
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MSYS2 | |
on: push | |
jobs: | |
msys2_mingw64: | |
runs-on: windows-2022 | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
# Checks-out the repository under $GITHUB_WORKSPACE. | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: mingw64 | |
update: true | |
install: >- | |
git | |
mingw-w64-x86_64-catch | |
mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-gcc | |
mingw-w64-x86_64-glfw | |
mingw-w64-x86_64-libwebp | |
mingw-w64-x86_64-make | |
mingw-w64-x86_64-ninja | |
mingw-w64-x86_64-pkg-config | |
- name: Force-fetch Git tags | |
run: git fetch --force --tags | |
- name: Build | |
run: | | |
export MSYSTEM=MINGW64 | |
export CXX=g++ | |
export CC=gcc | |
cd "$GITHUB_WORKSPACE" | |
mkdir build | |
cd build | |
cmake ../ | |
cmake --build . -j2 | |
- name: Tests | |
run: | | |
export MSYSTEM=MINGW64 | |
cd "$GITHUB_WORKSPACE"/build | |
ctest -V | |
- name: Build with statically linked standard libraries | |
run: | | |
export MSYSTEM=MINGW64 | |
export CXX=g++ | |
export CC=gcc | |
cd "$GITHUB_WORKSPACE" | |
mkdir build_static_std_libs | |
cd build_static_std_libs | |
cmake ../ -DENABLE_LTO=ON -DENABLE_STATIC_STANDARD_LIBRARIES=ON | |
cmake --build . -j2 | |
- name: Tests of build with statically linked standard libraries | |
run: | | |
export MSYSTEM=MINGW64 | |
cd "$GITHUB_WORKSPACE"/build_static_std_libs | |
ctest -V | |
- name: Gather build artifacts | |
run: | | |
export MSYSTEM=MINGW64 | |
cd "$GITHUB_WORKSPACE" | |
mkdir artifacts | |
./ci/copy-dll-dependencies.sh build_static_std_libs/webp-viewer/webp-viewer.exe artifacts/ | |
cp readme.md artifacts/ | |
cp changelog.md artifacts/ | |
cp documentation/third-party.md artifacts/ | |
VERSION=$(git describe --always) | |
mv artifacts webp-viewer_${VERSION} | |
'/c/Program Files/7-Zip/7z.exe' a -r webp-viewer_${VERSION}.zip webp-viewer_${VERSION} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: webp-viewer-windows-msys2 | |
if-no-files-found: error | |
path: | | |
webp-viewer*.zip |