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
This commit is contained in:
Takase 2023-04-08 01:25:31 +08:00 committed by GitHub
parent 1c01d6c296
commit 7eaa85848c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 9 deletions

View File

@ -95,7 +95,9 @@ jobs:
runs-on: windows-2019 runs-on: windows-2019
strategy: strategy:
matrix: matrix:
msystem: [MINGW32, MINGW64] config:
- {msystem: MINGW32, arch: i686}
- {msystem: MINGW64, arch: x86_64}
defaults: defaults:
run: run:
shell: msys2 {0} shell: msys2 {0}
@ -103,12 +105,16 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2 - uses: msys2/setup-msys2@v2
with: with:
msystem: ${{ matrix.msystem }} msystem: ${{ matrix.config.msystem }}
update: true
install: >- install: >-
base-devel base-devel
git git
zip 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 - name: Set Environment Variables
run: | run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH" echo "$HOME/.local/bin" >> "$GITHUB_PATH"
@ -119,6 +125,7 @@ jobs:
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-windows-i686" >> "$GITHUB_ENV" echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-windows-i686" >> "$GITHUB_ENV"
fi fi
- name: Install Dependencies - name: Install Dependencies
if: false
run: bash scripts/install-dependencies.sh --debug run: bash scripts/install-dependencies.sh --debug
- name: Build - name: Build
run: | run: |
@ -157,8 +164,11 @@ jobs:
"LUA_SUBPROJECT_PATH=subprojects/lua-5.4.4" >> $env:GITHUB_ENV "LUA_SUBPROJECT_PATH=subprojects/lua-5.4.4" >> $env:GITHUB_ENV
- name: Configure - name: Configure
run: | 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 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 - name: Build
run: | run: |
meson install -C build --destdir="../lite-xl" meson install -C build --destdir="../lite-xl"

View File

@ -124,6 +124,16 @@ main() {
rm -rf "${build_dir}" 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 \ CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
--buildtype=$build_type \ --buildtype=$build_type \
--prefix "$prefix" \ --prefix "$prefix" \
@ -134,11 +144,6 @@ main() {
$pgo \ $pgo \
"${build_dir}" "${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}" meson compile -C "${build_dir}"
if [[ $pgo != "" ]]; then if [[ $pgo != "" ]]; then