From 8e9cffcfb04154fec30a9f56a4f98f5caabb1e65 Mon Sep 17 00:00:00 2001 From: Frederik Seiffert Date: Tue, 11 Jan 2022 08:19:59 +0100 Subject: [PATCH] CI: add targets for armv7, aarch64, s390x, ppc64le Also removes installation of libkqueue-dev package as it is not used by libdispatch, updates dependencies from libobjc-9-dev to libobjc-10-dev, and adds -q flag to git clone to prevent progress logs from spamming logs. --- .github/scripts/dependencies.sh | 6 +- .github/workflows/main.yml | 289 +++++++++++++++++++++++--------- 2 files changed, 214 insertions(+), 81 deletions(-) diff --git a/.github/scripts/dependencies.sh b/.github/scripts/dependencies.sh index 582304e2a8..87779b7aa5 100755 --- a/.github/scripts/dependencies.sh +++ b/.github/scripts/dependencies.sh @@ -5,7 +5,7 @@ set -ex install_gnustep_make() { echo "::group::GNUstep Make" cd $DEPS_PATH - git clone https://github.com/gnustep/tools-make.git + git clone -q https://github.com/gnustep/tools-make.git cd tools-make MAKE_OPTS= if [ -n "$HOST" ]; then @@ -25,7 +25,7 @@ install_gnustep_make() { install_libobjc2() { echo "::group::libobjc2" cd $DEPS_PATH - git clone https://github.com/gnustep/libobjc2.git + git clone -q https://github.com/gnustep/libobjc2.git cd libobjc2 git submodule sync git submodule update --init @@ -45,7 +45,7 @@ install_libdispatch() { echo "::group::libdispatch" cd $DEPS_PATH # will reference upstream after https://github.com/apple/swift-corelibs-libdispatch/pull/534 is merged - git clone -b system-blocksruntime https://github.com/ngrewe/swift-corelibs-libdispatch.git libdispatch + git clone -q -b system-blocksruntime https://github.com/ngrewe/swift-corelibs-libdispatch.git libdispatch mkdir libdispatch/build cd libdispatch/build # -Wno-error=void-pointer-to-int-cast to work around build error in queue.c due to -Werror diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3333a6dd7a..0e55f26666 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,10 +2,32 @@ name: CI on: [push, pull_request, workflow_dispatch] +env: + APT_PACKAGES: >- + pkg-config + libgnutls28-dev + libffi-dev + libicu-dev + libxml2-dev + libxslt1-dev + libssl-dev + libavahi-client-dev + zlib1g-dev + gnutls-bin + # packages for GCC Objective-C runtime + APT_PACKAGES_gcc: >- + libobjc-10-dev + libblocksruntime-dev + gobjc + # packages for libobjc2 / libdispatch + APT_PACKAGES_clang: >- + libpthread-workqueue-dev + jobs: - ci: + ########### Linux ########### + linux: name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest # don't run pull requests from local branches twice if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository @@ -13,81 +35,215 @@ jobs: fail-fast: false matrix: include: - - name: Ubuntu GCC - os: ubuntu-latest + - name: Ubuntu x64 GCC library-combo: gnu-gnu-gnu - CC: gcc - CXX: g++ - - name: Ubuntu Clang gnustep-1.9 - os: ubuntu-latest + - name: Ubuntu x64 Clang gnustep-1.9 library-combo: ng-gnu-gnu runtime-version: gnustep-1.9 - CC: clang - CXX: clang++ - - name: Ubuntu Clang gnustep-2.0 - os: ubuntu-latest + - name: Ubuntu x64 Clang gnustep-2.0 library-combo: ng-gnu-gnu runtime-version: gnustep-2.0 - CC: clang - CXX: clang++ - - name: Windows MinGW GCC i686 - allow-test-failures: true - os: windows-latest + env: + SRC_PATH: ${{ github.workspace }}/source + DEPS_PATH: ${{ github.workspace }}/dependencies + INSTALL_PATH: ${{ github.workspace }}/build + CC: ${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang' || 'gcc' }} + CXX: ${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang++' || 'g++' }} + LIBRARY_COMBO: ${{ matrix.library-combo }} + RUNTIME_VERSION: ${{ matrix.runtime-version }} + + defaults: + run: + working-directory: ${{ env.SRC_PATH }} + + steps: + - uses: actions/checkout@v2 + with: + path: ${{ env.SRC_PATH }} + + - name: Install packages + run: | + sudo apt-get -q -y update + sudo apt-get -q -y install $APT_PACKAGES $APT_PACKAGES_${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang' || 'gcc' }} + + # gnustep-2.0 runtime requires ld.gold or lld + if [ "$RUNTIME_VERSION" = "gnustep-2.0" ]; then + sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10 + fi + + - name: Install dependencies + run: ./.github/scripts/dependencies.sh + + - name: Build source + run: | + . $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh + ./configure + make && make install + + - name: Run tests + run: | + . $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh + make check + + - name: Upload logs + uses: actions/upload-artifact@v2 + if: always() + with: + name: Logs - ${{ matrix.name }} + path: | + ${{ env.SRC_PATH }}/config.log + ${{ env.SRC_PATH }}/Tests/tests.log + + + ########### Run on Arch ########### + # https://github.com/marketplace/actions/run-on-architecture + run-on-arch: + name: Ubuntu ${{ matrix.arch }} ${{ matrix.library-combo == 'ng-gnu-gnu' && 'Clang' || 'GCC' }} ${{ matrix.library-combo == 'ng-gnu-gnu' && 'gnustep-2.0' || '' }} + runs-on: ubuntu-latest + # don't run pull requests from local branches twice + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + + strategy: + fail-fast: false + matrix: + arch: [armv7, aarch64, s390x, ppc64le] + library-combo: [gnu-gnu-gnu, ng-gnu-gnu] + exclude: + # CMake bug on armv7: https://gitlab.kitware.com/cmake/cmake/-/issues/20568 + # remove when Ubuntu CMake package is updated from 3.16.3 + - arch: armv7 + library-combo: ng-gnu-gnu + # libdispatch does not build for s390x + # error: function '_dispatch_malloc_continuation_alloc' is not needed and will not be emitted + - arch: s390x + library-combo: ng-gnu-gnu + + env: + SRC_PATH: source + DEPS_PATH: dependencies + INSTALL_PATH: build + + steps: + - uses: actions/checkout@v2 + with: + path: ${{ env.SRC_PATH }} + + - uses: uraimo/run-on-arch-action@v2.1.1 + name: Run on architecture + # allow some architectures to fail for now (remove when fixed): + # - aarch64 Clang: failed test NSRunLoop/thread.m + # - ppc64le: failed test builds + continue-on-error: >- + ${{ + (matrix.arch == 'aarch64' && matrix.library-combo == 'ng-gnu-gnu') || + matrix.arch == 'ppc64le' + }} + with: + arch: ${{ matrix.arch }} + distro: ubuntu20.04 + githubToken: ${{ github.token }} + install: | + echo "::group::Install packages" + apt-get update -q -y + apt-get install -q -y git make cmake \ + ${{ env.APT_PACKAGES }} \ + ${{ matrix.library-combo == 'ng-gnu-gnu' && env.APT_PACKAGES_clang || env.APT_PACKAGES_gcc }} \ + ${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang' || 'gcc' }} + echo "::endgroup::" + dockerRunArgs: --volume "${{github.workspace}}:/workspace" + env: | + SRC_PATH: /workspace/${{ env.SRC_PATH }} + DEPS_PATH: /workspace/${{ env.DEPS_PATH }} + INSTALL_PATH: /workspace/${{ env.INSTALL_PATH }} + CC: ${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang' || 'gcc' }} + CXX: ${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang++' || 'g++' }} + LIBRARY_COMBO: ${{ matrix.library-combo }} + run: | + # gnustep-2.0 runtime requires ld.gold or lld + if [ "${{ matrix.library-combo }}" = "ng-gnu-gnu" ]; then + update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10 + fi + + # allow unbound variables in GNUstep.sh + set +u + + cd $SRC_PATH + ./.github/scripts/dependencies.sh + + echo "::group::Build source" + . $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh + ./configure + make && make install + echo "::endgroup::" + + echo "::group::Run tests" + make check + echo "::endgroup::" + + - name: Upload logs + uses: actions/upload-artifact@v2 + if: always() + with: + name: Logs - Ubuntu ${{ matrix.arch }} ${{ matrix.library-combo == 'ng-gnu-gnu' && 'Clang' || 'GCC' }} ${{ matrix.library-combo == 'ng-gnu-gnu' && 'gnustep-2.0' || '' }} + path: | + ${{ env.SRC_PATH }}/config.log + ${{ env.SRC_PATH }}/Tests/tests.log + + + ########### Windows ########### + windows: + name: ${{ matrix.name }} + runs-on: windows-latest + # don't run pull requests from local branches twice + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + + strategy: + fail-fast: false + matrix: + include: + - name: Windows x86 MinGW GCC arch: i686 msystem: MINGW32 library-combo: gnu-gnu-gnu - CC: gcc - CXX: g++ - - name: Windows MinGW GCC x86_64 - allow-test-failures: true - os: windows-latest + - name: Windows x64 MinGW GCC arch: x86_64 msystem: MINGW64 library-combo: gnu-gnu-gnu - CC: gcc - CXX: g++ - - name: Windows MSVC Clang gnustep-2.0 i686 - allow-test-failures: true - os: windows-latest + - name: Windows x86 MSVC Clang gnustep-2.0 arch: x86 host: i686-pc-windows library-combo: ng-gnu-gnu - runtime-version: gnustep-2.0 configure-opts: --disable-tls - CC: clang -m32 - CXX: clang++ -m32 + CFLAGS: -m32 + CXXFLAGS: -m32 LDFLAGS: -fuse-ld=lld - - name: Windows MSVC Clang gnustep-2.0 x86_64 - allow-test-failures: true - os: windows-latest + - name: Windows x64 MSVC Clang gnustep-2.0 arch: x64 host: x86_64-pc-windows library-combo: ng-gnu-gnu - runtime-version: gnustep-2.0 configure-opts: --disable-tls - CC: clang -m64 - CXX: clang++ -m64 + CFLAGS: -m64 + CXXFLAGS: -m64 LDFLAGS: -fuse-ld=lld env: - SRC_PATH: ${{ github.workspace }}${{ startsWith(matrix.os, 'windows') && '\' || '/' }}source - DEPS_PATH: ${{ github.workspace }}${{ startsWith(matrix.os, 'windows') && '\' || '/' }}dependencies - INSTALL_PATH: ${{ github.workspace }}${{ startsWith(matrix.os, 'windows') && '\' || '/' }}build - IS_WINDOWS_MINGW: ${{ startsWith(matrix.os, 'windows') && startsWith(matrix.msystem, 'MINGW') }} - IS_WINDOWS_MSVC: ${{ startsWith(matrix.os, 'windows') && endsWith(matrix.host, '-pc-windows') }} - CC: ${{ matrix.CC }} - CXX: ${{ matrix.CXX }} + SRC_PATH: ${{ github.workspace }}\source + DEPS_PATH: ${{ github.workspace }}\dependencies + INSTALL_PATH: ${{ github.workspace }}\build + IS_WINDOWS_MSVC: ${{ endsWith(matrix.host, '-pc-windows') }} + CC: ${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang' || 'gcc' }} + CXX: ${{ matrix.library-combo == 'ng-gnu-gnu' && 'clang++' || 'g++' }} LDFLAGS: ${{ matrix.LDFLAGS }} HOST: ${{ matrix.host }} ARCH: ${{ matrix.arch }} LIBRARY_COMBO: ${{ matrix.library-combo }} - RUNTIME_VERSION: ${{ matrix.runtime-version }} + RUNTIME_VERSION: ${{ matrix.library-combo == 'ng-gnu-gnu' && 'gnustep-2.0' || '' }} CONFIGURE_OPTS: ${{ matrix.configure-opts }} # MSYS2: disable conversion to native-form paths when configuring GNUstep Make # https://www.msys2.org/wiki/Porting/#filesystem-namespaces @@ -95,7 +251,7 @@ jobs: defaults: run: - shell: ${{ startsWith(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }} + shell: msys2 {0} working-directory: ${{ env.SRC_PATH }} steps: @@ -103,31 +259,9 @@ jobs: with: path: ${{ env.SRC_PATH }} - - name: Install packages (Linux) - if: runner.os == 'Linux' - run: | - PACKAGES="cmake pkg-config libgnutls28-dev libffi-dev libicu-dev libxml2-dev libxslt1-dev libssl-dev libavahi-client-dev zlib1g-dev gnutls-bin" - case $LIBRARY_COMBO in - gnu-gnu-gnu) - # GCC Objective-C runtime - PACKAGES="$PACKAGES libobjc-9-dev libblocksruntime-dev gobjc" - ;; - ng-gnu-gnu) - # packages for libdispatch - PACKAGES="$PACKAGES libkqueue-dev libpthread-workqueue-dev" - # gnustep-2.0 runtime requires ld.gold or lld - if [ "$RUNTIME_VERSION" = "gnustep-2.0" ]; then - sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10 - fi - ;; - esac - - sudo apt-get update - sudo apt-get install $PACKAGES - - - name: Set up MSYS2 (Windows MinGW) + - name: Set up MSYS2 (MinGW) uses: msys2/setup-msys2@v2 - if: env.IS_WINDOWS_MINGW == 'true' + if: ${{ startsWith(matrix.msystem, 'MINGW') }} with: msystem: ${{ matrix.msystem }} install: > @@ -147,7 +281,7 @@ jobs: mingw-w64-${{matrix.arch}}-gnutls mingw-w64-${{matrix.arch}}-icu - - name: Set up MSYS2 (Windows MSVC) + - name: Set up MSYS2 (MSVC) uses: msys2/setup-msys2@v2 if: env.IS_WINDOWS_MSVC == 'true' with: @@ -156,28 +290,28 @@ jobs: # make Windows packages like Clang available in MSYS path-type: inherit - - name: Delete MinGW gmake (Windows MSVC) + - name: Delete MinGW gmake (MSVC) if: env.IS_WINDOWS_MSVC == 'true' # delete /c/Strawberry/c/bin/gmake built for MinGW that is found on runners, because we must use make built for MSYS run: if GMAKE_PATH=`which gmake`; then rm -f "$GMAKE_PATH"; fi - - name: Install Windows packages (Windows MSVC) + - name: Install Windows packages (MSVC) if: env.IS_WINDOWS_MSVC == 'true' shell: cmd run: choco install ninja - - name: Set up VS Developer Command Prompt (Windows MSVC) + - name: Set up VS Developer Command Prompt (MSVC) if: env.IS_WINDOWS_MSVC == 'true' uses: ilammy/msvc-dev-cmd@v1 with: arch: ${{ matrix.arch }} - - name: Install dependencies (Windows MSVC) + - name: Install dependencies (MSVC) if: env.IS_WINDOWS_MSVC == 'true' shell: cmd run: | mkdir %DEPS_PATH% & cd %DEPS_PATH% - git clone https://github.com/gnustep/tools-windows-msvc.git || exit /b 1 + git clone -q https://github.com/gnustep/tools-windows-msvc.git || exit /b 1 cd tools-windows-msvc :: use msys2.cmd from setup-msys2 as Bash shell, as it doesn't have msys2_shell.cmd used normally by build.bat set "BASH=msys2 -c" @@ -195,8 +329,7 @@ jobs: echo "DEPS_PATH=`cygpath -u $DEPS_PATH`" >> $GITHUB_ENV - name: Install dependencies - run: | - ./.github/scripts/dependencies.sh + run: ./.github/scripts/dependencies.sh - name: Build source run: | @@ -208,7 +341,7 @@ jobs: make && make install - name: Run tests - continue-on-error: ${{ matrix.allow-test-failures || false }} + continue-on-error: true # remove once Windows tests pass run: | . $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh # MSVC: build tests for release to match CRT of DLLs