Skip to content

Commit

Permalink
Migrate Linux-aarch64 CI from Travis to Cirrus CI
Browse files Browse the repository at this point in the history
As Travis seems non-operational, at least since yesterday.
  • Loading branch information
kinke committed Feb 11, 2023
1 parent 703dfba commit 3eef44f
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 244 deletions.
128 changes: 114 additions & 14 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Installs lit, clones the git submodules, builds LDC and the test
# runners and runs the tests.
# Requires env variables CI_OS, EXTRA_CMAKE_FLAGS and PARALLELISM.
# Requires env variables CI_ARCH, CI_OS, EXTRA_CMAKE_FLAGS and PARALLELISM.
common_steps_template: &COMMON_STEPS_TEMPLATE
install_lit_script: |
# Install lit
Expand Down Expand Up @@ -35,6 +35,13 @@ common_steps_template: &COMMON_STEPS_TEMPLATE
ctest --output-on-failure -R ldc2-unittest
run_lit_testsuite_script: |
cd $CIRRUS_WORKING_DIR/../build/tests
if [[ "$CI_OS-$CI_ARCH" == "linux-aarch64" ]]; then
# FIXME: the following tests fail
rm $CIRRUS_WORKING_DIR/tests/debuginfo/nested_gdb.d
rm $CIRRUS_WORKING_DIR/tests/sanitizers/fuzz_basic.d
# the following 2 have regressed with LLVM 13
rm $CIRRUS_WORKING_DIR/tests/sanitizers/msan_{noerror,uninitialized}.d
fi
python3 runlit.py -v -j $PARALLELISM .
run_dmd_testsuite_script: |
cd $CIRRUS_WORKING_DIR/../build
Expand All @@ -43,14 +50,23 @@ common_steps_template: &COMMON_STEPS_TEMPLATE
# Run defaultlib unittests & druntime integration tests
cd $CIRRUS_WORKING_DIR/../build
excludes="dmd-testsuite|ldc2-unittest|lit-tests"
# FIXME: unittest failure for unclear reason
if [ "$CI_OS" == "freebsd" ]; then
if [[ "$CI_OS" == "freebsd" ]]; then
# FIXME: unittest failure for unclear reason
excludes+='|^std.experimental.allocator-shared$'
elif [[ "$CI_OS-$CI_ARCH" == "linux-aarch64" ]]; then
# FIXME: segfaults with enabled optimizations
excludes+='|^core.thread.fiber(-shared)?$'
# FIXME: failing unittest(s)
excludes+='|^std.internal.math.gammafunction'
# FIXME: failing unittest(s) with enabled optimizations
excludes+='|^std.math.exponential(-shared)?$'
# FIXME: failure
excludes+='|^druntime-test-exceptions-debug$'
fi
ctest -j$PARALLELISM --output-on-failure -E "$excludes"
# Performs the extra packaging steps for jobs producing a prebuilt package.
# Requires env variables CI_OS and GITHUB_TOKEN (and CC for FreeBSD).
# Requires env variables CI_ARCH, CI_OS, GITHUB_TOKEN and PARALLELISM (and CC for FreeBSD).
packaging_steps_template: &PACKAGING_STEPS_TEMPLATE
# Install LDC & make portable
install_script: |
Expand All @@ -70,8 +86,8 @@ packaging_steps_template: &PACKAGING_STEPS_TEMPLATE
run_shared_libs_integration_test_script: |
cd $CIRRUS_WORKING_DIR/..
echo 'void main() { import std.stdio; writefln("Hello world, %d bits", size_t.sizeof * 8); }' > hello.d
installed/bin/ldc2 hello.d -m64 -of=hello64 -link-defaultlib-shared
./hello64
installed/bin/ldc2 hello.d -of=hello -link-defaultlib-shared
./hello
# Run hello-world integration test with LTO
run_lto_integration_test_script: |
cd $CIRRUS_WORKING_DIR/..
Expand All @@ -82,7 +98,10 @@ packaging_steps_template: &PACKAGING_STEPS_TEMPLATE
# Run dynamic-compile integration test
run_dynamic_compile_integration_test_script: |
cd $CIRRUS_WORKING_DIR/..
installed/bin/ldc2 -enable-dynamic-compile -run $CIRRUS_WORKING_DIR/tests/dynamiccompile/array.d
# FIXME: disabled since LLVM 12, needs https://github.com/ldc-developers/ldc/pull/3184
if [[ "$CI_OS" == "freebsd" ]]; then
installed/bin/ldc2 -enable-dynamic-compile -run $CIRRUS_WORKING_DIR/tests/dynamiccompile/array.d
fi
# Run ImportC integration test
run_importC_integration_test_script: |
cd $CIRRUS_WORKING_DIR/..
Expand Down Expand Up @@ -127,10 +146,15 @@ packaging_steps_template: &PACKAGING_STEPS_TEMPLATE
else
artifactID=${CIRRUS_CHANGE_IN_REPO:0:8}
fi
artifactName=ldc2-$artifactID-$CI_OS-x86_64
artifactName=ldc2-$artifactID-$CI_OS-$CI_ARCH
mv installed $artifactName
chmod -R go=rX $artifactName
gtar -cf - --owner=0 --group=0 $artifactName | 7z a artifacts/$artifactName.tar.xz -si -txz -mx9
tar=tar
if [[ "$CI_OS" == "freebsd" ]]; then
tar=gtar
fi
$tar -cf - --owner=0 --group=0 $artifactName | 7z a artifacts/$artifactName.tar.xz -si -txz -mx9 -mmt$PARALLELISM
ls -lh artifacts/ldc2-*.tar.xz
# Upload to GitHub release (only for commits on the master branch and tags)
upload_to_github_script: |
cd $CIRRUS_WORKING_DIR
Expand All @@ -141,7 +165,7 @@ packaging_steps_template: &PACKAGING_STEPS_TEMPLATE
fi
# Installs Ubuntu 18.04+ prerequisites.
# Requires env variables HOST_LDC_VERSION, EXTRA_APT_PACKAGES and EXTRA_CMAKE_FLAGS.
# Requires env variables CI_ARCH, HOST_LDC_VERSION, EXTRA_APT_PACKAGES and EXTRA_CMAKE_FLAGS.
install_ubuntu_prerequisites_template: &INSTALL_UBUNTU_PREREQUISITES_TEMPLATE
install_prerequisites_script: |
cd $CIRRUS_WORKING_DIR/..
Expand All @@ -162,7 +186,7 @@ install_ubuntu_prerequisites_template: &INSTALL_UBUNTU_PREREQUISITES_TEMPLATE
$EXTRA_APT_PACKAGES
python3 --version
# Download & extract host LDC
curl -fL --retry 3 --max-time 300 -o ldc2.tar.xz https://github.com/ldc-developers/ldc/releases/download/v$HOST_LDC_VERSION/ldc2-$HOST_LDC_VERSION-linux-x86_64.tar.xz
curl -fL --retry 3 --max-time 300 -o ldc2.tar.xz https://github.com/ldc-developers/ldc/releases/download/v$HOST_LDC_VERSION/ldc2-$HOST_LDC_VERSION-linux-$CI_ARCH.tar.xz
mkdir host-ldc
tar -xf ldc2.tar.xz --strip 1 -C host-ldc
rm ldc2.tar.xz
Expand Down Expand Up @@ -205,6 +229,7 @@ install_macos_prerequisites_template: &INSTALL_MACOS_PREREQUISITES_TEMPLATE
environment:
CIRRUS_CLONE_DEPTH: 50
HOST_LDC_VERSION: 1.24.0
GITHUB_TOKEN: ENCRYPTED[0955bd48c8d4e5391446fc0149d0719ad0b63df27ec9e6c180a5730a5b10dc7f28f09d1383423db158d21380ee2b022a]

task:
name: Ubuntu 18.04 x64 multilib rtSanitizers
Expand All @@ -214,6 +239,7 @@ task:
memory: 16G
timeout_in: 20m
environment:
CI_ARCH: x86_64
CI_OS: linux
EXTRA_APT_PACKAGES: "llvm-9-dev libclang-common-9-dev"
EXTRA_CMAKE_FLAGS: "-DMULTILIB=ON -DRT_SUPPORT_SANITIZERS=ON -DBUILD_LTO_LIBS=ON"
Expand All @@ -231,6 +257,7 @@ task:
memory: 16G
timeout_in: 15m
environment:
CI_ARCH: x86_64
CI_OS: linux
EXTRA_APT_PACKAGES: "gdmd llvm-dev libclang-common-15-dev"
EXTRA_CMAKE_FLAGS: "-DBUILD_SHARED_LIBS=ON -DBUILD_LTO_LIBS=ON -DD_COMPILER=gdmd -DLDC_LINK_MANUALLY=ON"
Expand All @@ -248,6 +275,7 @@ task:
memory: 16G
timeout_in: 15m
environment:
CI_ARCH: x86_64
CI_OS: linux
HOST_LDC_VERSION: 1.9.0
EXTRA_APT_PACKAGES: "llvm-9-dev libclang-common-9-dev"
Expand Down Expand Up @@ -290,6 +318,75 @@ task:
<< : *INSTALL_MACOS_PREREQUISITES_TEMPLATE
<< : *COMMON_STEPS_TEMPLATE

task:
name: Ubuntu 18.04 aarch64
arm_container:
image: ubuntu:18.04
cpu: 4
memory: 8G
timeout_in: 60m
environment:
CI_ARCH: aarch64
CI_OS: linux
EXTRA_APT_PACKAGES: libxml2-dev p7zip-full
EXTRA_CMAKE_FLAGS: >-
-DBUILD_LTO_LIBS=ON
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
-DEXTRA_CXXFLAGS=-flto=full
-DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++
-DJITRT_EXTRA_LDFLAGS=-static-libstdc++
-DLDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH=aarch64
-DLLVM_ROOT_DIR=$CIRRUS_WORKING_DIR/../llvm
-DD_COMPILER=$CIRRUS_WORKING_DIR/../bootstrap-ldc/bin/ldmd2
PARALLELISM: 4
LLVM_VERSION: 14.0.3
CLANG_VERSION: 14.0.0
CC: $CIRRUS_WORKING_DIR/../clang/bin/clang
CXX: $CIRRUS_WORKING_DIR/../clang/bin/clang++
<< : *INSTALL_UBUNTU_PREREQUISITES_TEMPLATE
# Download & extract LDC-flavoured LLVM
download_prebuilt_llvm_script: |
cd $CIRRUS_WORKING_DIR/..
assertsSuffix=""
if [[ "${CIRRUS_TAG:-}" == "" ]]; then
echo 'Using LLVM with enabled assertions'
assertsSuffix="-withAsserts"
fi
llvm_tag="CI"
if [[ "$LLVM_VERSION" = *.* ]]; then llvm_tag="ldc-v$LLVM_VERSION"; fi
llvm_url="https://github.com/ldc-developers/llvm-project/releases/download/$llvm_tag/llvm-$LLVM_VERSION-linux-$CI_ARCH$assertsSuffix.tar.xz"
curl -fL --retry 3 --max-time 300 -o llvm.tar.xz $llvm_url
mkdir -p llvm
tar -xf llvm.tar.xz --strip 1 -C llvm
rm llvm.tar.xz
# Make lld the default linker (possibly with enabled assertions unfortunately)
ln -sf "$PWD/llvm/bin/ld.lld" /usr/bin/ld
# Download & extract clang
download_prebuilt_clang_script: |
cd $CIRRUS_WORKING_DIR/..
curl -fL --retry 3 --max-time 300 -o clang.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-$CLANG_VERSION/clang+llvm-$CLANG_VERSION-$CI_ARCH-linux-gnu.tar.xz
mkdir clang
tar -xf clang.tar.xz --strip 1 -C clang
rm clang.tar.xz
clone_submodules_early_script: |
cd $CIRRUS_WORKING_DIR
git submodule update --init --depth $CIRRUS_CLONE_DEPTH
# Build a first LDC as host compiler for the actual build
build_bootstrap_ldc_script: |
cd $CIRRUS_WORKING_DIR/..
mkdir bootstrap-ldc
cd bootstrap-ldc
cmake -G Ninja $CIRRUS_WORKING_DIR \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ROOT_DIR=$PWD/../llvm \
-DD_COMPILER=$PWD/../host-ldc/bin/ldmd2 \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_LTO_LIBS=ON
ninja -j$PARALLELISM
bin/ldc2 -version
<< : *COMMON_STEPS_TEMPLATE
<< : *PACKAGING_STEPS_TEMPLATE

task:
name: FreeBSD 12.2 x64
freebsd_instance:
Expand All @@ -298,10 +395,13 @@ task:
memory: 8G
timeout_in: 60m
environment:
CI_ARCH: x86_64
CI_OS: freebsd
EXTRA_CMAKE_FLAGS: -DBUILD_LTO_LIBS=ON -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto" -DEXTRA_CXXFLAGS=-flto=full
EXTRA_CMAKE_FLAGS: >-
-DBUILD_LTO_LIBS=ON
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
-DEXTRA_CXXFLAGS=-flto=full
PARALLELISM: 4
GITHUB_TOKEN: ENCRYPTED[0955bd48c8d4e5391446fc0149d0719ad0b63df27ec9e6c180a5730a5b10dc7f28f09d1383423db158d21380ee2b022a]
# use clang from the `llvm` ports package to be installed, incl. lld support for .deplibs (`pragma(lib, "execinfo")`)
CC: clang90
install_prerequisites_script: |
Expand All @@ -311,7 +411,7 @@ task:
python3 --version
python3 -m ensurepip
# Download & extract host LDC
curl -fL --retry 3 --max-time 300 -o ldc2.tar.xz https://github.com/ldc-developers/ldc/releases/download/v$HOST_LDC_VERSION/ldc2-$HOST_LDC_VERSION-freebsd-x86_64.tar.xz
curl -fL --retry 3 --max-time 300 -o ldc2.tar.xz https://github.com/ldc-developers/ldc/releases/download/v$HOST_LDC_VERSION/ldc2-$HOST_LDC_VERSION-freebsd-$CI_ARCH.tar.xz
mkdir pre-ldc
gtar -xf ldc2.tar.xz --strip 1 -C pre-ldc
clone_submodules_early_script: |
Expand Down
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
*.sh eol=lf

.gitattributes export-ignore
.travis.yml export-ignore
CHANGELOG.md text merge=union
2 changes: 1 addition & 1 deletion .github/actions/upload-to-github/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ runs:
ls -lh
# Extend by existing release artifacts *missing* from GitHub workflow,
# e.g., artifacts published by Travis/Cirrus CI etc.
# e.g., artifacts published by Cirrus CI etc.
# (They will be re-uploaded in the next step.)
if [[ -d ../existing-artifacts ]]; then
mv -n ../existing-artifacts/*.* ./
Expand Down
Loading

0 comments on commit 3eef44f

Please sign in to comment.