From e0c77291f25b8eb6ea68c20d0aa6791905cbf77e Mon Sep 17 00:00:00 2001 From: Maxim Reznik Date: Thu, 19 Oct 2023 16:21:10 +0300 Subject: [PATCH] Strip `PATH=` from `langkit/manage.py setenv` to avoid mixed path separators MSYS2 (Windows). Reuse preinstalled MSYS2 on Windows to speed up. Use GCC 13.2 from Alire. Fixes #1115 --- .github/workflows/build-binaries.yml | 35 ++++++++++++---------------- utils/gh-build-binaries.sh | 8 +++---- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 0370380aa..922462ab9 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -7,11 +7,6 @@ jobs: build: name: Build and deploy - # The only purpose of this workflow is to upload builds, so do not run it - # in contexts when upload is impossible: only the official repository has - # the secrets to upload binaries to Bintray. - if: ${{ github.repository == 'AdaCore/libadalang' }} - strategy: fail-fast: false matrix: # Build debug and/or production @@ -21,15 +16,19 @@ jobs: steps: - run: git config --global core.autocrlf input shell: bash + - name: Force Alire to use preinstalled MSYS2 + if: ${{ runner.os == 'Windows' }} + shell: bash + run: | + mkdir -p ~/.config/alire + echo '[msys2]' >> ~/.config/alire/config.toml + echo 'install_dir = "C:\\msys64"' >> ~/.config/alire/config.toml - name: Install iconv and gmp (Windows only) + run: pacman --noconfirm -S mingw64/mingw-w64-x86_64-libiconv mingw64/mingw-w64-x86_64-gmp if: ${{ runner.os == 'Windows' }} - uses: msys2/setup-msys2@v2 - with: - path-type: inherit - update: true - install: >- - mingw64/mingw-w64-x86_64-libiconv - mingw64/mingw-w64-x86_64-gmp + shell: c:\msys64\usr\bin\bash.exe -l -e -o pipefail {0} + env: + MSYSTEM: MINGW64 - name: Get libadalang uses: actions/checkout@v3 - name: Get gprbuild for libgpr @@ -75,22 +74,18 @@ jobs: - uses: actions/cache@v3 with: path: ./cached_gnat - key: ${{ runner.os }}-alire-2022 + key: ${{ runner.os }}-alire-2023 - name: Get GNAT toolchain with alire uses: alire-project/setup-alire@v2 with: - toolchain: gnat_native^12 gprbuild^22 + toolchain: gnat_native^13 gprbuild^22 toolchain_dir: ./cached_gnat - name: Setup Python 3.10 uses: actions/setup-python@v4 with: python-version: '3.10' - - name: Build Libadalang and its dependencies (Windows) - if: ${{ runner.os == 'Windows' }} - shell: msys2 {0} - run: utils/gh-build-binaries.sh "${{ matrix.debug }}" ${{ runner.os }} - - name: Build Libadalang and its dependencies (non-Windows) - if: ${{ runner.os != 'Windows' }} + - name: Build Libadalang and its dependencies + shell: bash run: utils/gh-build-binaries.sh "${{ matrix.debug }}" ${{ runner.os }} - name: Keep artifacts uses: actions/upload-artifact@v3 diff --git a/utils/gh-build-binaries.sh b/utils/gh-build-binaries.sh index 2ffa23383..cf9bbec70 100755 --- a/utils/gh-build-binaries.sh +++ b/utils/gh-build-binaries.sh @@ -7,9 +7,9 @@ export CPATH=/usr/local/include export LIBRARY_PATH=/usr/local/lib if [ $RUNNER_OS = Windows ]; then export prefix=/opt/ADALIB_DIR - export CPATH=`cygpath -w /mingw64/include` - export LIBRARY_PATH=`cygpath -w /mingw64/lib` - mount `cygpath -w $RUNNER_TEMP|cut -d: -f1`:/opt /opt + export CPATH=`cygpath -w /c/msys64/mingw64/include` + export LIBRARY_PATH=`cygpath -w /c/msys64/mingw64/lib` + mount D:/opt /opt fi export PROCESSORS=0 export GPR_PROJECT_PATH=$prefix/share/gpr @@ -20,7 +20,7 @@ echo PATH=$PATH pip install -r langkit/requirements-github.txt pip install jsonschema pip install langkit/ -eval `langkit/manage.py setenv` +eval `langkit/manage.py setenv | grep -v ^PATH=` alr --non-interactive get xmlada build_archive()