Merge pull request #165 from gnustep/ci-improvements

CI: update scripts to mirror libs-base setup
This commit is contained in:
Fred Kiefer 2023-01-06 20:57:39 +01:00 committed by GitHub
commit e573b5ce09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 181 additions and 134 deletions

View file

@ -1,65 +0,0 @@
#! /usr/bin/env sh
set -ex
echo "Building..."
sudo apt-get -qq update
sudo apt-get install -y cmake pkg-config libgnutls28-dev libgmp-dev libffi-dev libicu-dev \
libxml2-dev libxslt1-dev libssl-dev libavahi-client-dev zlib1g-dev gnutls-bin \
libcairo2-dev
if [ $LIBRARY_COMBO = 'gnu-gnu-gnu' ];
then
if [ $CC = 'gcc' ];
then
sudo apt-get install -y gobjc;
fi;
sudo apt-get install -y libobjc-10-dev libblocksruntime-dev;
else
curl -s -o - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -;
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" && sudo apt-get update -qq;
sudo apt-get install -y clang-9 libkqueue-dev libpthread-workqueue-dev;
# sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 10 \
# --slave /usr/bin/clang++ clang++ /usr/bin/clang++-9;
export PATH=$(echo "$PATH" | sed -e 's/:\/usr\/local\/clang-7.0.0\/bin//');
if [ "$RUNTIME_VERSION" = "gnustep-2.0" ];
then
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10;
fi;
fi;
if [ $LIBRARY_COMBO = 'ng-gnu-gnu' ];
then
curl -LO https://cmake.org/files/v3.15/cmake-3.15.5-Linux-x86_64.tar.gz;
tar xf cmake-3.15.5-Linux-x86_64.tar.gz;
mv cmake-3.15.5-Linux-x86_64 $HOME/cmake;
export PATH=$HOME/cmake/:$HOME/cmake/bin:$PATH
fi;
# build dependencies...
./.github/scripts/dependencies.sh
export LIBRARY_PATH=$HOME/staging/lib:$HOME/staging/lib64:$LIBRARY_PATH;
export LD_LIBRARY_PATH=$HOME/staging/lib:$HOME/staging/lib64:$LD_LIBRARY_PATH;
if [ $LIBRARY_COMBO = 'ng-gnu-gnu' ];
then
export CPATH=$HOME/staging/include;
else
export CPATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/include;
fi;
export PATH=$HOME/staging/bin:$PATH;
export GNUSTEP_MAKEFILES=$HOME/staging/share/GNUstep/Makefiles;
. $HOME/staging/share/GNUstep/Makefiles/GNUstep.sh;
# Build gui
./configure $BASE_ABI || (cat config.log && false);
make && make install
# Build back, it's needed by some tests...
#cd ..
#git clone https://github.com/gnustep/libs-back.git
#cd libs-back
#./configure
#make && make install

View file

@ -2,72 +2,83 @@
set -ex
DEP_SRC=$HOME/dependency_source/
DEP_ROOT=$HOME/staging
install_gnustep_make() {
cd $DEP_SRC
git clone https://github.com/gnustep/tools-make.git
echo "::group::GNUstep Make"
cd $DEPS_PATH
git clone -q -b ${TOOLS_MAKE_BRANCH:-master} https://github.com/gnustep/tools-make.git
cd tools-make
if [ -n "$RUNTIME_VERSION" ]
then
WITH_RUNTIME_ABI="--with-runtime-abi=${RUNTIME_VERSION}"
else
WITH_RUNTIME_ABI=""
MAKE_OPTS=
if [ -n "$HOST" ]; then
MAKE_OPTS="$MAKE_OPTS --host=$HOST"
fi
./configure --prefix=$DEP_ROOT --with-library-combo=$LIBRARY_COMBO $WITH_RUNTIME_ABI
if [ -n "$RUNTIME_VERSION" ]; then
MAKE_OPTS="$MAKE_OPTS --with-runtime-abi=$RUNTIME_VERSION"
fi
./configure --prefix=$INSTALL_PATH --with-library-combo=$LIBRARY_COMBO $MAKE_OPTS || cat config.log
make install
echo Objective-C build flags: `$HOME/staging/bin/gnustep-config --objc-flags`
echo Objective-C build flags:
$INSTALL_PATH/bin/gnustep-config --objc-flags
echo "::endgroup::"
}
install_ng_runtime() {
cd $DEP_SRC
git clone https://github.com/gnustep/libobjc2.git
install_libobjc2() {
echo "::group::libobjc2"
cd $DEPS_PATH
git clone -q https://github.com/gnustep/libobjc2.git
cd libobjc2
git submodule init
git submodule sync
git submodule update
cd ..
mkdir libobjc2/build
cd libobjc2/build
export CC="clang"
export CXX="clang++"
export CXXFLAGS="-std=c++11"
cmake -DTESTS=off -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGNUSTEP_INSTALL_TYPE=NONE -DCMAKE_INSTALL_PREFIX:PATH=$DEP_ROOT ../
git submodule update --init
mkdir build
cd build
cmake \
-DTESTS=off \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DGNUSTEP_INSTALL_TYPE=NONE \
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PATH \
../
make install
echo "::endgroup::"
}
install_libdispatch() {
cd $DEP_SRC
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
mkdir swift-corelibs-libdispatch/build
cd swift-corelibs-libdispatch/build
export CC="clang"
export CXX="clang++"
export LIBRARY_PATH=$DEP_ROOT/lib;
export LD_LIBRARY_PATH=$DEP_ROOT/lib:$LD_LIBRARY_PATH;
export CPATH=$DEP_ROOT/include;
cmake -DBUILD_TESTING=off -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=$HOME/staging -DINSTALL_PRIVATE_HEADERS=1 -DBlocksRuntime_INCLUDE_DIR=$DEP_ROOT/include -DBlocksRuntime_LIBRARIES=$DEP_ROOT/lib/libobjc.so ../
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
cmake \
-DBUILD_TESTING=off \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PATH \
-DCMAKE_C_FLAGS="-Wno-error=void-pointer-to-int-cast" \
-DINSTALL_PRIVATE_HEADERS=1 \
-DBlocksRuntime_INCLUDE_DIR=$INSTALL_PATH/include \
-DBlocksRuntime_LIBRARIES=$INSTALL_PATH/lib/libobjc.so \
../
make install
echo "::endgroup::"
}
install_gnustep_base() {
export GNUSTEP_MAKEFILES=$HOME/staging/share/GNUstep/Makefiles
. $HOME/staging/share/GNUstep/Makefiles/GNUstep.sh
cd $DEP_SRC
git clone https://github.com/gnustep/libs-base.git
echo "::group::GNUstep Base"
cd $DEPS_PATH
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
git clone -q -b ${LIBS_BASE_BRANCH:-master} https://github.com/gnustep/libs-base.git
cd libs-base
./configure
make
make install
echo "::endgroup::"
}
mkdir -p $DEP_SRC
if [ "$LIBRARY_COMBO" = 'ng-gnu-gnu' ]
then
install_ng_runtime
mkdir -p $DEPS_PATH
# Windows MSVC toolchain uses tools-windows-msvc scripts to install non-GNUstep dependencies
if [ "$LIBRARY_COMBO" = "ng-gnu-gnu" -a "$IS_WINDOWS_MSVC" != "true" ]; then
install_libobjc2
install_libdispatch
fi

View file

@ -1,8 +0,0 @@
#! /usr/bin/env sh
set -ex
echo "Running unit tests"
. $HOME/staging/share/GNUstep/Makefiles/GNUstep.sh;
make check || (cat Tests/tests.log && false);

View file

@ -1,29 +1,138 @@
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on: push
on:
push:
pull_request:
workflow_dispatch:
inputs:
tools_make_branch:
description: "tools-make branch"
default: "master"
required: true
libs_base_branch:
description: "libs-base branch"
default: "master"
required: true
libs_back_branch:
description: "libs-back branch"
default: "master"
required: true
env:
APT_PACKAGES: >-
pkg-config
libgnutls28-dev
libffi-dev
libicu-dev
libxml2-dev
libxslt1-dev
libssl-dev
libavahi-client-dev
zlib1g-dev
gnutls-bin
libcurl4-gnutls-dev
libgmp-dev
libcairo2-dev
# 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
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
########### Linux ###########
linux:
name: ${{ matrix.name }}
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:
include:
- name: Ubuntu x64 GCC
library-combo: gnu-gnu-gnu
CC: gcc
CXX: g++
- name: Ubuntu x64 Clang gnustep-1.9
library-combo: ng-gnu-gnu
runtime-version: gnustep-1.9
CC: clang
CXX: clang++
- name: Ubuntu x64 Clang gnustep-2.0
library-combo: ng-gnu-gnu
runtime-version: gnustep-2.0
CC: clang
CXX: clang++
env:
LIBRARY_COMBO: gnu-gnu-gnu
CC: gcc
# Steps represent a sequence of tasks that will be executed as part of the job
SRC_PATH: ${{ github.workspace }}/source
DEPS_PATH: ${{ github.workspace }}/dependencies
INSTALL_PATH: ${{ github.workspace }}/build
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
LIBRARY_COMBO: ${{ matrix.library-combo }}
RUNTIME_VERSION: ${{ matrix.runtime-version }}
defaults:
run:
working-directory: ${{ env.SRC_PATH }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3
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
env:
TOOLS_MAKE_BRANCH: ${{github.event.inputs.tools_make_branch}}
LIBS_BASE_BRANCH: ${{github.event.inputs.libs_base_branch}}
run: ./.github/scripts/dependencies.sh
# Runs a single command using the runners shell
- name: Build source
run: ./.github/scripts/build.sh
run: |
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
./configure
make && make install
### Building libs-back is disabled due to various test failures. Re-enable when fixed.
# - name: Build libs-back # required by some tests
# working-directory: ${{env.DEPS_PATH}}
# run: |
# . $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
# git clone -q -b ${LIBS_BACK_BRANCH:-master} https://github.com/gnustep/libs-back.git
# cd libs-back
# ./configure
# make && make install
# Runs a single command using the runners shell
- name: Run tests
run: ./.github/scripts/test.sh
run: |
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
make check
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: Logs - ${{ matrix.name }}
path: |
${{ env.SRC_PATH }}/config.log
${{ env.SRC_PATH }}/Tests/tests.log