From 7eaa85848ccda6b9578e76c6f8294971e233b0a8 Mon Sep 17 00:00:00 2001 From: Takase <20792268+takase1121@users.noreply.github.com> Date: Sat, 8 Apr 2023 01:25:31 +0800 Subject: [PATCH] Optimizing MSYS2 CI (#1435) * feat(ci): install dependencies on setup * fix(ci): don't update msys2 when setup * fix(ci): download subprojects before patching * doc(ci): document why meson subprojects download is called --- .github/workflows/build.yml | 18 ++++++++++++++---- scripts/build.sh | 15 ++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3cbb2a4..12247bfb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -95,7 +95,9 @@ jobs: runs-on: windows-2019 strategy: matrix: - msystem: [MINGW32, MINGW64] + config: + - {msystem: MINGW32, arch: i686} + - {msystem: MINGW64, arch: x86_64} defaults: run: shell: msys2 {0} @@ -103,12 +105,16 @@ jobs: - uses: actions/checkout@v3 - uses: msys2/setup-msys2@v2 with: - msystem: ${{ matrix.msystem }} - update: true + msystem: ${{ matrix.config.msystem }} install: >- base-devel git zip + mingw-w64-${{ matrix.config.arch }}-gcc + mingw-w64-${{ matrix.config.arch }}-meson + mingw-w64-${{ matrix.config.arch }}-ninja + mingw-w64-${{ matrix.config.arch }}-ca-certificates + mingw-w64-${{ matrix.config.arch }}-ntldd - name: Set Environment Variables run: | echo "$HOME/.local/bin" >> "$GITHUB_PATH" @@ -119,6 +125,7 @@ jobs: echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-windows-i686" >> "$GITHUB_ENV" fi - name: Install Dependencies + if: false run: bash scripts/install-dependencies.sh --debug - name: Build run: | @@ -157,8 +164,11 @@ jobs: "LUA_SUBPROJECT_PATH=subprojects/lua-5.4.4" >> $env:GITHUB_ENV - name: Configure run: | - meson setup --wrap-mode=forcefallback build + # Download the subprojects first so we can patch it before configuring. + # This avoids reconfiguring the subprojects when compiling. + meson subprojects download Get-Content -Path resources/windows/001-lua-unicode.diff -Raw | patch -d $env:LUA_SUBPROJECT_PATH -p1 --forward + meson setup --wrap-mode=forcefallback build - name: Build run: | meson install -C build --destdir="../lite-xl" diff --git a/scripts/build.sh b/scripts/build.sh index 82eb95f0..0cd4e8d8 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -124,6 +124,16 @@ main() { rm -rf "${build_dir}" + if [[ $patch_lua == "true" ]] && [[ ! -z $force_fallback ]]; then + # download the subprojects so we can start patching before configure. + # this will prevent reconfiguring the project. + meson subprojects download + lua_subproject_path=$(echo subprojects/lua-*/) + if [[ -d $lua_subproject_path ]]; then + patch -d $lua_subproject_path -p1 --forward < resources/windows/001-lua-unicode.diff + fi + fi + CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \ --buildtype=$build_type \ --prefix "$prefix" \ @@ -134,11 +144,6 @@ main() { $pgo \ "${build_dir}" - lua_subproject_path=$(echo subprojects/lua-*/) - if [[ $patch_lua == "true" ]] && [[ ! -z $force_fallback ]] && [[ -d $lua_subproject_path ]]; then - patch -d $lua_subproject_path -p1 --forward < resources/windows/001-lua-unicode.diff - fi - meson compile -C "${build_dir}" if [[ $pgo != "" ]]; then