Skip to content

Commit

Permalink
CI: Test GitHub Actions support
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw authored and Reposync Bot committed Nov 13, 2023
1 parent 9365fe2 commit 5ca8003
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 13 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

name: Main
on:
- push # branch or tag

jobs:
linux:
strategy:
fail-fast: false
matrix:
include:
- job_name: ubuntu-x86_64 (testsuite)
target: x86_64-linux-gnu
- job_name: ubuntu-x86_64 (unittests)
target: x86_64-linux-gnu
- job_name: ubuntu-arm
target: arm-linux-gnueabi
#- job_name: ubuntu-armhf
# target: arm-linux-gnueabihf
- job_name: ubuntu-aarch64
target: aarch64-linux-gnu
- job_name: ubuntu-mips
target: mips-linux-gnu
- job_name: ubuntu-mips64el
target: mips64el-linux-gnuabi64
- job_name: ubuntu-mipsel
target: mipsel-linux-gnu
name: ${{ matrix.job_name }}
runs-on: ubuntu-22.04
env:
GCC_CI_TARGET: ${{ matrix.target }}
GCC_CI_BOOTSTRAP: ${{ matrix.bootstrap || false }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Install dependencies
run: ./buildci.sh installdeps
- name: Configure gdc
run: ./buildci.sh configure
- name: Build gdc
run: ./buildci.sh build
- name: Run testsuite
run: ${{ contains(matrix.job_name, 'testsuite') && './buildci.sh testsuite' || 'echo disabled' }}
- name: Run unittests
run: ${{ contains(matrix.job_name, 'unittests') && './buildci.sh unittests' || 'echo disabled' }}
67 changes: 54 additions & 13 deletions buildci.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
#!/bin/bash
# This script is intended to be ran on SemaphoreCI or Buildkite platform.
# Following environmental variables are assumed to be exported on SemaphoreCI.
# This script is intended to be ran on platform on GitHub Action
# Other CI platforms in this script are legacy and only kept around to keep
# the modularity of this script in check.
#
# - SEMAPHORE_PROJECT_DIR
# - SEMAPHORE_CACHE_DIR
# Following environmental variables are assume to be exported on GitHub Actions.
#
# See https://semaphoreci.com/docs/available-environment-variables.html
# - RUNNER_TOOL_CACHE
# - RUNNER_OS
# - GCC_CI_TARGET
# - GCC_CI_BOOTSTRAP
#
# Following environmental variables are assumed to be exported on Buildkite.
#
# - BUILDKITE_CACHE_DIR
# - BUILDKITE_OS
# - BUILDKITE_TARGET
# - BUILDKITE_BOOTSTRAP
#
# See https://buildkite.com/docs/builds/environment-variables
# See https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
#
## Top-level build system configration.
gcc_prereqs="gmp-6.1.0.tar.bz2 mpfr-3.1.6.tar.bz2 mpc-1.0.3.tar.gz isl-0.18.tar.bz2"
Expand Down Expand Up @@ -127,6 +123,21 @@ environment() {
build_target_canonical=${build_host_canonical}
make_flags="-j$(nproc)"
build_bootstrap="disable"
elif [ "${CI}" = "true" ]; then
export CC="gcc"
export CXX="g++"
export GDC="gdc"
gcc_prereqs=""
project_dir=${PWD}
cache_dir=${RUNNER_TOOL_CACHE}
log_dir=${PWD}/logs
mkdir -p ${log_dir}
make_flags="-j$(nproc)"
build_host=$($CC -dumpmachine)
build_host_canonical=$(${project_dir}/config.sub ${build_host})
build_target=${GCC_CI_TARGET}
build_target_canonical=$(${project_dir}/config.sub ${build_target})
build_bootstrap=${GCC_CI_BOOTSTRAP}
else
echo "Unhandled CI environment"
exit 1
Expand Down Expand Up @@ -296,6 +307,36 @@ installdeps() {
echo "Unhandled CI environment"
exit 1
fi
elif [ "${CI}" = "true" ]; then
if [ "${RUNNER_OS}" = "Linux" ]; then
case ${GCC_CI_TARGET} in
arm*-*-*eabi)
install_packages="binutils-arm-linux-gnueabi libc6-dev-armel-cross"
;;
aarch64-*-*)
install_packages="binutils-aarch64-linux-gnu libc6-dev-arm64-cross"
;;
mips-*-*)
install_packages="binutils-mips-linux-gnu libc6-dev-mips-cross"
;;
mips64el-*-*)
install_packages="binutils-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross"
;;
mipsel-*-*)
install_packages="binutils-mipsel-linux-gnu libc6-dev-mipsel-cross"
;;
*)
install_packages="binutils libc6-dev"
;;
esac
sudo apt-get update -qq
sudo apt-get install -qq gcc g++ gdc ${install_packages} \
autogen autoconf automake dejagnu patch \
libcurl4-gnutls-dev libgmp-dev libisl-dev libmpc-dev libmpfr-dev || exit 1
else
echo "Unhandled CI environment"
exit 1
fi
else
echo "Unhandled CI environment"
exit 1
Expand Down

0 comments on commit 5ca8003

Please sign in to comment.