From 79f45eb096630507a58c922b05c3f798b24f5375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Wed, 21 Feb 2024 11:13:18 +0100 Subject: [PATCH] Use the recommended ghactions action to set up msys2 --- .github/build.sh | 1 + .github/force-msys2-bash.sh | 10 --------- .github/prepare.py | 7 ++++++- .github/workflows/build.yaml | 40 ++++++++++++++++++++++++++++++------ 4 files changed, 41 insertions(+), 17 deletions(-) delete mode 100755 .github/force-msys2-bash.sh diff --git a/.github/build.sh b/.github/build.sh index 2fc2bb24e..76a9fa859 100755 --- a/.github/build.sh +++ b/.github/build.sh @@ -76,6 +76,7 @@ if [[ -z ${BSH_NO_PACKAGES-} ]]; then else pacman -S --noconfirm --needed mingw-w64-ucrt-x86_64-{pkgconf,bzip2,luajit,jsoncpp,curl,SDL2,libpng,meson,fftw} fi + export PKG_CONFIG=$(which pkg-config.exe) fi ;; linux) diff --git a/.github/force-msys2-bash.sh b/.github/force-msys2-bash.sh deleted file mode 100755 index c513d8b32..000000000 --- a/.github/force-msys2-bash.sh +++ /dev/null @@ -1,10 +0,0 @@ -set -euo pipefail -IFS=$'\t\n' - -echo 'C:\msys64\ucrt64\bin' >> tmp -echo 'C:\msys64\usr\bin' >> tmp -cat $GITHUB_PATH >> tmp -mv tmp $GITHUB_PATH - -echo "MSYSTEM=UCRT64" >> $GITHUB_ENV -echo "PKG_CONFIG="'C:\msys64\ucrt64\bin\pkg-config.exe' >> $GITHUB_ENV diff --git a/.github/prepare.py b/.github/prepare.py index c48f1b4b1..1778023c3 100755 --- a/.github/prepare.py +++ b/.github/prepare.py @@ -173,6 +173,10 @@ for arch, platform, libc, statdyn, bplatform, runso debug_asset_path = f'{app_name_slug}-{arch}.AppImage.dbg' debug_asset_name = f'{app_name_slug}-{arch}.AppImage.dbg' starcatcher_name = f'powder-{release_name}-{starcatcher}{suffix}' + msys2_bash = (bplatform == 'windows' and libc == 'mingw') + shell = 'bash' + if msys2_bash: + shell = 'msys2 {0}' build_matrix.append({ 'bsh_build_platform': bplatform, # part of the unique portion of the matrix 'bsh_host_arch': arch, # part of the unique portion of the matrix @@ -181,7 +185,7 @@ for arch, platform, libc, statdyn, bplatform, runso 'bsh_static_dynamic': statdyn, # part of the unique portion of the matrix 'bsh_debug_release': dbgrel, # part of the unique portion of the matrix 'runs_on': runson, - 'force_msys2_bash': (bplatform == 'windows' and libc == 'mingw') and 'yes' or 'no', + 'force_msys2_bash': msys2_bash and 'yes' or 'no', 'package_suffix': suffix, 'package_mode': mode, 'publish': publish and 'yes' or 'no', @@ -192,6 +196,7 @@ for arch, platform, libc, statdyn, bplatform, runso 'debug_asset_path': debug_asset_path, 'debug_asset_name': debug_asset_name, 'job_name': job_name, + 'shell': shell, }) if publish: publish_matrix.append({ diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index eabe7a186..31848e308 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -54,17 +54,45 @@ jobs: strategy: fail-fast: false matrix: ${{ fromJSON(needs.prepare.outputs.build_matrix) }} + defaults: + run: + shell: ${{ matrix.shell }} steps: + - if: matrix.force_msys2_bash == 'yes' + uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + update: true + path-type: strict + cache: true + # this list doesn't have to mirror the one in build.sh perfectly + # but the packages listed here get cached properly and take less time to install + install: >- + git + curl + mingw-w64-ucrt-x86_64-gcc + mingw-w64-ucrt-x86_64-pkgconf + mingw-w64-ucrt-x86_64-bzip2 + mingw-w64-ucrt-x86_64-luajit + mingw-w64-ucrt-x86_64-jsoncpp + mingw-w64-ucrt-x86_64-curl + mingw-w64-ucrt-x86_64-SDL2 + mingw-w64-ucrt-x86_64-libpng + mingw-w64-ucrt-x86_64-meson + mingw-w64-ucrt-x86_64-python + mingw-w64-ucrt-x86_64-python-pip + mingw-w64-ucrt-x86_64-fftw + mingw-w64-ucrt-x86_64-cmake + mingw-w64-ucrt-x86_64-7zip + patch - run: git config --global core.autocrlf false - uses: actions/checkout@v4 - - if: matrix.force_msys2_bash == 'yes' - run: bash -c './.github/force-msys2-bash.sh' - - if: matrix.force_msys2_bash == 'yes' - run: bash -c 'pacman -Syu --noconfirm' - - uses: actions/setup-python@v5 + - if: matrix.force_msys2_bash != 'yes' + uses: actions/setup-python@v5 with: python-version: '3.10' - - run: python -m pip install meson==1.2.3 ninja # TODO: go back to using latest meson once https://github.com/mesonbuild/meson/pull/12544 is live + - if: matrix.force_msys2_bash != 'yes' + run: python -m pip install meson==1.2.3 ninja # TODO: go back to using latest meson once https://github.com/mesonbuild/meson/pull/12544 is live - if: matrix.bsh_build_platform == 'darwin' run: brew install bash coreutils - run: bash -c './.github/build.sh'