bbbbbbbbb #140
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
run-name: ${{ inputs.name }} | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: 'name' | |
type: string | |
repo: | |
description: 'repo' | |
required: true | |
default: 'MLton' | |
type: string | |
ref: | |
description: 'git ref' | |
required: true | |
type: string | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- { name: i686, alt: x86 } | |
#- { name: x86_64, alt: amd64 } | |
#- { name: aarch64, alt: arm64 } | |
#- { name: powerpc, alt: powerpc } | |
#- { name: powerpc64, alt: powerpc64 } | |
#- { name: riscv32, alt: riscv } | |
#- { name: riscv64, alt: riscv } | |
#- { name: mips, alt: mips } | |
#- { name: m68k, alt: m68k } | |
libc: [ gnu, musl ] | |
#include: | |
# - { arch: { name: mips64, alt: mips }, libc: gnuabi64 } | |
# - { arch: { name: mips64, alt: mips }, libc: musl } | |
# - { arch: { name: arm, alt: arm }, libc: gnueabihf } | |
# - { arch: { name: armv7l, alt: arm }, libc: musleabihf } | |
#exclude: | |
# - { arch: { name: riscv32, alt: riscv }, libc: gnu } | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout MLton | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ inputs.repo }}/mlton | |
ref: ${{ inputs.ref }} | |
path: mlton | |
- name: Checkout musl-cross-make | |
if: startsWith(matrix.libc, 'musl') && false | |
uses: actions/checkout@v4 | |
with: | |
repository: richfelker/musl-cross-make | |
ref: master | |
path: musl-cross-make | |
- name: Install qemu | |
run: | | |
sudo apt-get update | |
sudo apt-get install qemu-user-static | |
- name: Install toolchain (musl.cc) | |
if: startsWith(matrix.libc, 'musl') | |
run: | | |
curl -sOL https://more.musl.cc/x86_64-linux-musl/${{ matrix.arch.name }}-linux-${{ matrix.libc }}-cross.tgz | |
tar -xf ${{ matrix.arch.name }}-linux-${{ matrix.libc }}-cross.tgz | |
sudo cp -fpr ${{ matrix.arch.name }}-linux-${{ matrix.libc }}-cross/* /usr/local/ | |
rm -r ${{ matrix.arch.name }}-linux-${{ matrix.libc }}-cross \ | |
${{ matrix.arch.name }}-linux-${{ matrix.libc }}-cross.tgz | |
- name: Install toolchain (musl-cross-make) | |
if: startsWith(matrix.libc, 'musl') && false | |
run: | | |
cd musl-cross-make | |
cat <<EOF > config.mak | |
TARGET=${{ matrix.arch.name }}-linux-${{ matrix.libc }} | |
OUTPUT=/usr/local | |
COMMON_CONFIG += --disable-nls | |
GCC_CONFIG += --disable-libquadmath --disable-decimal-float | |
GCC_CONFIG += --disable-libitm | |
GCC_CONFIG += --disable-fixed-point | |
GCC_CONFIG += --disable-lto | |
GCC_CONFIG += --enable-languages=c | |
EOF | |
make | |
sudo make install | |
- name: Install toolchain (crosstool-ng) | |
if: startsWith(matrix.libc, 'musl') && false | |
run: | | |
curl -sOL http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.9.3.tar.bz2 | |
cat <<EOF > checksum | |
699ac002ca24c93b526562b324bd6c039ae2603172e0480d7d0a05a3224249596b06a6d70041527b1b99753311c3878fd93419723150f4e6e0673499516427bf crosstool-ng-1.9.3.tar.bz2 | |
EOF | |
sha512sum -c checksum | |
tar -xf crosstool-ng-1.9.3.tar.bz2 | |
cd crosstool-ng-1.9.3.tar.bz2 | |
./configure --prefix=/usr/local | |
make | |
sudo make install | |
cd .. | |
rm -r crosstool-ng-1.9.3 crosstool-ng-1.9.3.tar.bz2 | |
mkdir cross && cd cross | |
cat <<EOF > .config | |
CT_CONFIG_VERSION="4" | |
CT_ARCH_ARM=y | |
CT_ARCH_ARCH="armv7-a" | |
CT_ARCH_SUFFIX="v7" | |
CT_ARCH_FPU="vfpv3" | |
CT_ARCH_FLOAT="hard" | |
CT_ARCH_FLOAT_HW=y | |
CT_OMIT_TARGET_VENDOR=y | |
CT_KERNEL_LINUX=y | |
CT_BINUTILS_LINKER_LD_GOLD=y | |
CT_BINUTILS_GOLD_THREADS=y | |
CT_BINUTILS_LD_WRAPPER=y | |
CT_BINUTILS_PLUGINS=y | |
CT_CROSS=y | |
CT_LIBC_MUSL=y | |
EOF | |
ct-ng build | |
- name: Install toolchain (glibc) | |
if: startsWith(matrix.libc, 'gnu') && matrix.arch.name != 'x86_64' | |
run: | | |
sudo apt-get install gcc-${{ matrix.arch.name }}-linux-${{ matrix.libc }} \ | |
binutils-${{ matrix.arch.name }}-linux-${{ matrix.libc }} | |
- name: Link cc to gcc | |
if: startsWith(matrix.libc, 'gnu') | |
run: | | |
sudo ln -s /usr/bin/${{ matrix.arch.name }}-linux-${{ matrix.libc }}-gcc \ | |
/usr/bin/${{ matrix.arch.name }}-linux-${{ matrix.libc }}-cc | |
- name: Install gmp | |
run: | | |
curl -sOL https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz | |
tar -xf gmp-6.3.0.tar.xz | |
cd gmp-6.3.0 | |
./configure --disable-shared \ | |
${{ matrix.arch.name == 'i686' && '--with-pic' || '' }} \ | |
${{ matrix.arch.name == 'armv7l' && '--with-pic CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard -O2 -pedantic"' || '' }} \ | |
${{ startsWith(matrix.arch.name, 'powerpc') && '--disable-assembly' || '' }} \ | |
--build=x86_64-linux-gnu \ | |
--host=${{ matrix.arch.name }}-linux-${{ matrix.libc }} | |
make | |
# make check | |
sudo make install | |
cd ${{ github.workspace }} | |
rm -r gmp-6.3.0 gmp-6.3.0.tar.xz | |
- name: Install bootstrap mlton (release) | |
if: false | |
run: | | |
curl -sOL https://github.com/MLton/mlton/releases/download/on-20210117-release/mlton-20210117-1.amd64-linux-glibc2.31.tgz | |
tar -xf mlton-20210117-1.amd64-linux-glibc2.31.tgz --exclude='*/share' | |
rm mlton-20210117-1.amd64-linux-glibc2.31.tgz | |
sudo mv mlton-20210117-1.amd64-linux-glibc2.31 /opt/boot | |
# Backport fixes | |
sudo cp -p mlton/runtime/platform/linux.h /opt/boot/lib/mlton/include/platform/linux.h | |
- name: Install bootstrap mlton (git) | |
if: true | |
run: | | |
curl -sOL https://github.com/ii8/mlton-builds/releases/download/20210117/mlton-20231109.223645-g04d7690-1.amd64-linux.ubuntu-latest_gcc_amd64.tgz | |
tar -xf mlton-20231109.223645-g04d7690-1.amd64-linux.ubuntu-latest_gcc_amd64.tgz | |
rm mlton-20231109.223645-g04d7690-1.amd64-linux.ubuntu-latest_gcc_amd64.tgz | |
sudo mv mlton-20231109.223645-g04d7690-1.amd64-linux.ubuntu-latest_gcc_amd64 /opt/boot | |
- name: Build target runtime (old) | |
if: false | |
run: | | |
curl -sOL https://github.com/MLton/mlton/releases/download/on-20210117-release/mlton-20210117.src.tgz | |
tar xzf mlton-20210117.src.tgz | |
rm mlton-20210117.src.tgz | |
mv mlton-20210117 src | |
cp runtime/platform/linux.h src/runtime/platform/linux.h | |
cd src | |
PATH="/opt/boot/bin:$PATH" make \ | |
LDFLAGS=-static BOOTSTRAP_STYLE=0 \ | |
TARGET=${{ matrix.arch.name }}-linux-${{ matrix.libc }} TARGET_ARCH=${{ matrix.arch.alt }} TARGET_OS=linux \ | |
WITH_GMP_DIR=/usr/local \ | |
dirs runtime | |
sudo cp -fpR src/build/lib/mlton/targets/${{ matrix.arch.name }}-linux-${{ matrix.libc }} /opt/boot/lib/mlton/targets/ | |
- name: Build target runtime (new) | |
if: true | |
run: | | |
cd mlton | |
PATH="/opt/boot/bin:$PATH" make \ | |
LDFLAGS=-static BOOTSTRAP_STYLE=0 \ | |
${{ matrix.arch.name == 'armv7l' && 'CFLAGS="-march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard"' || '' }} \ | |
TARGET=${{ matrix.arch.name }}-linux-${{ matrix.libc }} TARGET_ARCH=${{ matrix.arch.alt }} TARGET_OS=linux \ | |
WITH_GMP_DIR=/usr/local \ | |
dirs runtime | |
sudo cp -fpR build/lib/mlton/targets/${{ matrix.arch.name }}-linux-${{ matrix.libc }} /opt/boot/lib/mlton/targets/ | |
- name: Build MLton | |
run: | | |
cd mlton | |
PATH="/opt/boot/bin:$PATH" make \ | |
BOOTSTRAP_STYLE=0 \ | |
TARGET=${{ matrix.arch.name }}-linux-${{ matrix.libc }} TARGET_ARCH=${{ matrix.arch.alt }} TARGET_OS=linux \ | |
OLD_MLTON_COMPILE_ARGS="-cc-opt -I/usr/local/include -link-opt -L/usr/local/lib -link-opt -static ${{ matrix.arch.name == 'armv7l' && '-cc-opt -march=armv7-a -cc-opt -mfpu=vfpv3 -cc-opt -mfloat-abi=hard' || '' }}" \ | |
dirs runtime compiler script basis-no-check libraries-no-check tools | |
mv build/lib/mlton/targets/${{ matrix.arch.name }}-linux-${{ matrix.libc }} build/lib/mlton/targets/self | |
- name: Status | |
run: | | |
cd mlton | |
ulimit -c unlimited | |
file build/lib/mlton/mlton-compile | |
build/bin/mlton -show path-map | |
- name: Limit tests | |
if: true | |
run: | | |
cd mlton | |
mv regression/real.* . | |
mv regression/real-basic.* . | |
rm -r regression/* | |
mv real.* regression/ | |
mv real-basic.* regression/ | |
mv benchmark/tests/raytrace.sml . | |
rm -r benchmark/tests/* | |
mv raytrace.sml benchmark/tests/ | |
- name: Test | |
run: | | |
cd mlton | |
ulimit -c unlimited | |
./bin/regression -verbose 1 \ | |
-cc ${{ matrix.arch.name }}-linux-${{ matrix.libc }}-gcc \ | |
-cc-opt -I/usr/local/include \ | |
-link-opt -L/usr/local/lib \ | |
-link-opt -static | |
- name: Coredump | |
#if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coredump-${{ matrix.arch.name }}-${{ matrix.libc }} | |
path: mlton/regression/real-basic | |
- name: Package | |
if: ${{ !cancelled() }} | |
run: | | |
cd mlton | |
mv build mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }} | |
tar czvf mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }}.tar.gz \ | |
mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }} | |
sha256sum mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }}.tar.gz \ | |
> mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }}.tar.gz.sha256sum | |
- name: Upload Artifact | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }} | |
path: mlton/mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }}.tar.gz | |
- name: Upload Checksum | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }}.sha256sum | |
path: mlton/mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }}.tar.gz.sha256sum |