build #87
Workflow file for this run
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
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: riscv64, alt: riscv } | |
libc: [ gnu, musl ] | |
# exclude: [ { arch: { name: x86_64, alt: amd64 }, libc: gnu } ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ inputs.repo }}/mlton | |
ref: ${{ inputs.ref }} | |
- name: Install qemu | |
run: | | |
sudo apt-get update | |
sudo apt-get install qemu-user-static | |
- name: Install toolchain (musl) | |
if: ${{ matrix.libc == 'musl' }} | |
run: | | |
curl -sOL https://more.musl.cc/x86_64-linux-musl/${{ matrix.arch.name }}-linux-musl-cross.tgz | |
tar -xf ${{ matrix.arch.name }}-linux-musl-cross.tgz | |
sudo cp -fpr ${{ matrix.arch.name }}-linux-musl-cross/* /usr/local/ | |
rm -r ${{ matrix.arch.name }}-linux-musl-cross \ | |
${{ matrix.arch.name }}-linux-musl-cross.tgz | |
- name: Install toolchain (glibc) | |
if: ${{ matrix.libc == 'gnu' && matrix.arch.name != 'x86_64' }} | |
run: | | |
sudo apt-get install gcc-${{ matrix.arch.name }}-linux-gnu \ | |
binutils-${{ matrix.arch.name }}-linux-gnu | |
- name: Link cc to gcc | |
if: ${{ matrix.libc == 'gnu' }} | |
run: | | |
sudo ln -s /usr/bin/${{ matrix.arch.name }}-linux-gnu-gcc \ | |
/usr/bin/${{ matrix.arch.name }}-linux-gnu-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 \ | |
--with-pic \ | |
${{ 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 | |
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 runtime/platform/linux.h /opt/boot/lib/mlton/include/platform/linux.h | |
- 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 }} \ | |
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: | | |
PATH="/opt/boot/bin:$PATH" make \ | |
LDFLAGS=-static BOOTSTRAP_STYLE=0 \ | |
TARGET=${{ matrix.arch.name }}-linux-${{ matrix.libc }} TARGET_ARCH=${{ matrix.arch.alt }} \ | |
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: | | |
PATH="/opt/boot/bin:$PATH" make \ | |
BOOTSTRAP_STYLE=0 \ | |
TARGET=${{ matrix.arch.name }}-linux-${{ matrix.libc }} TARGET_ARCH=${{ matrix.arch.alt }} \ | |
OLD_MLTON_COMPILE_ARGS="-codegen c -cc-opt -I/usr/local/include -link-opt -L/usr/local/lib -link-opt -static" \ | |
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: Test | |
run: | | |
./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: Package | |
run: | | |
mv Makefile.binary build/Makefile | |
mv build mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }} | |
tar czvf mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }}.tgz \ | |
mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }} | |
path: mlton-${{ inputs.ref }}.${{ matrix.arch.name }}-linux-${{ matrix.libc }}.tgz |