Refactor bootstrap and CI action to speedup CI

This commit is contained in:
Fabián Heredia Montiel 2021-01-20 14:15:24 -06:00 committed by G. Allais
parent 72229e3232
commit b81b390f20
13 changed files with 319 additions and 254 deletions

View File

@ -1,32 +0,0 @@
name: API
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- master
env:
SCHEME: scheme
IDRIS2_TESTS_CG: chez
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build dependencies
run: |
sudo apt-get install -y chezscheme
echo "::add-path::$HOME/.idris2/bin"
- name: Build from bootstrap
run: make bootstrap && make install && idris2 --clean idris2api.ipkg && make install-api
shell: bash
- name: Test API
run: cd tests/idris2/api001 && ./run idris2
shell: bash

View File

@ -1,36 +0,0 @@
name: Build From Previous Version
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- master
env:
SCHEME: scheme
IDRIS2_TESTS_CG: chez
IDRIS2_VERSION: 0.3.0
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build dependencies
run: |
sudo apt-get install -y chezscheme
echo "::add-path::$HOME/.idris2/bin"
- name : Build previous version
run: |
wget https://www.idris-lang.org/idris2-src/idris2-$IDRIS2_VERSION.tgz
tar zxvf idris2-$IDRIS2_VERSION.tgz
cd Idris2-$IDRIS2_VERSION
make bootstrap-build && make install
cd ..
- name: Build from previous version
run: make all

View File

@ -1,4 +1,4 @@
name: macOS
name: macOS Chez
on:
push:
branches:
@ -8,6 +8,7 @@ on:
pull_request:
branches:
- master
env:
SCHEME: chez
IDRIS2_TESTS_CG: chez
@ -24,9 +25,12 @@ jobs:
brew install chezscheme
brew install coreutils
echo "::add-path::$HOME/.idris2/bin"
- name: Build and test Idris 2 from bootstrap
run: make bootstrap && make install
- name: Build Idris 2 from bootstrap
run: make bootstrap && make install && make clean
shell: bash
- name: Build and test self-hosted
run: make clean && make all && make test INTERACTIVE=''
- name: Build self-hosted
run: make all && make install
shell: bash
- name: Test self-hosted
run: make test INTERACTIVE=''
shell: bash

209
.github/workflows/ci-ubuntu-combined.yml vendored Normal file
View File

@ -0,0 +1,209 @@
name: Ubuntu Combined
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- master
- main
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
IDRIS2_VERSION: 0.3.0 # For previous-version build
SCHEME: scheme
jobs:
#
# Boostrapping and Previous Version Builds
#
build-bootstrap-chez:
runs-on: ubuntu-latest
env:
IDRIS2_CG: chez
IDRIS2_TESTS_CG: chez
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build dependencies
run: |
sudo apt-get install -y chezscheme
echo "::add-path::$HOME/.idris2/bin"
- name: Build from bootstrap
run: make bootstrap && make install
- name: Artifact Bootstrapped Idris2
uses: actions/upload-artifact@v2
with:
name: installed-bootstrapped-idris2-chez
path: ~/.idris2/
build-bootstrap-racket:
runs-on: ubuntu-latest
env:
IDRIS2_CG: racket
IDRIS2_TESTS_CG: racket
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build dependencies
run: |
sudo apt-get install -y racket
echo "::add-path::$HOME/.idris2/bin"
- name: Build from bootstrap
run: make bootstrap-racket && make install
- name: Artifact Bootstrapped Idris2
uses: actions/upload-artifact@v2
with:
name: installed-bootstrapped-idris2-racket
path: ~/.idris2/
build-previous-version:
runs-on: ubuntu-latest
env:
IDRIS2_CG: chez
IDRIS2_TESTS_CG: chez
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build dependencies
run: |
sudo apt-get install -y chezscheme
echo "::add-path::$HOME/.idris2/bin"
- name: Cache Chez Previous Version
id: previous-version-cache
uses: actions/cache@v2
with:
path: Idris2-${{ env.IDRIS2_VERSION }}
key: ${{ runner.os }}-idris2-bootstrapped-${{ env.IDRIS2_VERSION }}
- name : Build previous version
if: steps.previous-version-cache.outputs.cache-hit != 'true'
run: |
wget https://www.idris-lang.org/idris2-src/idris2-$IDRIS2_VERSION.tgz
tar zxvf idris2-$IDRIS2_VERSION.tgz
cd Idris2-$IDRIS2_VERSION
make bootstrap-build
cd ..
- name: Install previous version
run: |
cd Idris2-$IDRIS2_VERSION
make install
cd ..
- name: Artifact Idris2
uses: actions/upload-artifact@v2
with:
name: installed-idris2-${{ env.IDRIS2_VERSION }}-chez
path: ~/.idris2/
#
# Self Hosting and Testing
#
self-host-chez:
needs: build-bootstrap-chez
runs-on: ubuntu-latest
env:
IDRIS2_CG: chez
IDRIS2_TESTS_CG: chez
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Idris2 Artifact
uses: actions/download-artifact@v2
with:
name: installed-bootstrapped-idris2-chez
path: ~/.idris2/
- name: Install build dependencies
run: |
sudo apt-get install -y chezscheme
echo "::add-path::$HOME/.idris2/bin"
chmod +x $HOME/.idris2/bin/idris2 $HOME/.idris2/bin/idris2_app/*
- name: Build self-hosted
run: make all && make install
- name: Test self-hosted
run: make test INTERACTIVE=''
self-host-racket:
needs: build-bootstrap-racket
runs-on: ubuntu-latest
env:
IDRIS2_CG: racket
IDRIS2_TESTS_CG: racket
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Idris2 Artifact
uses: actions/download-artifact@v2
with:
name: installed-bootstrapped-idris2-racket
path: ~/.idris2/
- name: Install build dependencies
run: |
sudo apt-get install -y racket
echo "::add-path::$HOME/.idris2/bin"
chmod +x $HOME/.idris2/bin/idris2 $HOME/.idris2/bin/idris2_app/*
- name: Build self-hosted
run: make all && make install
- name: Test self-hosted
run: make test INTERACTIVE=''
self-host-previous-version:
needs: build-previous-version
runs-on: ubuntu-latest
env:
IDRIS2_CG: chez
IDRIS2_TESTS_CG: chez
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Idris2 Artifact
uses: actions/download-artifact@v2
with:
name: installed-idris2-${{ env.IDRIS2_VERSION }}-chez
path: ~/.idris2/
- name: Install build dependencies
run: |
sudo apt-get install -y chezscheme
echo "::add-path::$HOME/.idris2/bin"
chmod +x $HOME/.idris2/bin/idris2 $HOME/.idris2/bin/idris2_app/*
- name: Build from previous version
run: make all && make install && make clean
- name: Build self-hosted from previous version
run: make all && make install
- name: Test self-hosted from previous version
run: make test INTERACTIVE=''
- name: Artifact Idris2
uses: actions/upload-artifact@v2
with:
name: idris2-nightly
path: ~/.idris2/
build-api:
needs: build-previous-version
runs-on: ubuntu-latest
env:
IDRIS2_CG: chez
IDRIS2_TESTS_CG: chez
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Idris2 Artifact
uses: actions/download-artifact@v2
with:
name: installed-idris2-${{ env.IDRIS2_VERSION }}-chez
path: ~/.idris2/
- name: Install build dependencies
run: |
sudo apt-get install -y chezscheme
echo "::add-path::$HOME/.idris2/bin"
chmod +x $HOME/.idris2/bin/idris2 $HOME/.idris2/bin/idris2_app/*
- name: Build API
run: make install-api
shell: bash
- name: Test API
run: cd tests/idris2/api001 && ./run idris2
shell: bash

View File

@ -1,28 +0,0 @@
name: Ubuntu Racket
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- master
env:
IDRIS2_TESTS_CG: racket
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y racket
- name: Build from bootstrap
run: make bootstrap-racket
shell: bash

View File

@ -1,32 +0,0 @@
name: Ubuntu
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- master
env:
SCHEME: scheme
IDRIS2_TESTS_CG: chez
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build dependencies
run: |
sudo apt-get install -y chezscheme
echo "::add-path::$HOME/.idris2/bin"
- name: Build from bootstrap
run: make bootstrap && make install
shell: bash
- name: Build and test self-hosted
run: make clean && make all && make test INTERACTIVE=''
shell: bash

View File

@ -12,14 +12,13 @@ MAJOR=0
MINOR=3
PATCH=0
GIT_SHA1=
ifeq ($(shell git status >/dev/null 2>&1; echo $$?), 0)
# inside a git repo
ifneq ($(shell git describe --exact-match --tags >/dev/null 2>&1; echo $$?), 0)
# not tagged as a released version, so add sha1 of this build in between releases
GIT_SHA1 := $(shell git rev-parse --short=9 HEAD)
endif
# inside a git repo
ifneq ($(shell git describe --exact-match --tags >/dev/null 2>&1; echo $$?), 0)
# not tagged as a released version, so add sha1 of this build in between releases
GIT_SHA1 := $(shell git rev-parse --short=9 HEAD)
endif
endif
export IDRIS2_VERSION := ${MAJOR}.${MINOR}.${PATCH}
@ -147,24 +146,22 @@ install-libs:
.PHONY: bootstrap bootstrap-build bootstrap-racket bootstrap-racket-build bootstrap-test bootstrap-clean
# Bootstrapping using SCHEME
bootstrap: bootstrap-build bootstrap-test
bootstrap-build: support
bootstrap: support
cp support/c/${IDRIS2_SUPPORT} bootstrap/idris2_app
sed 's/libidris2_support.so/${IDRIS2_SUPPORT}/g; s|__PREFIX__|${IDRIS2_CURDIR}/bootstrap|g' \
bootstrap/idris2_app/idris2.ss \
> bootstrap/idris2_app/idris2-boot.ss
sh ./bootstrap.sh
bootstrap/idris2_app/idris2.ss \
> bootstrap/idris2_app/idris2-boot.ss
sh ./bootstrap-stage1-chez.sh
sh ./bootstrap-stage2.sh IDRIS2_CG="chez"
# Bootstrapping using racket
bootstrap-racket: bootstrap-racket-build bootstrap-test
bootstrap-racket-build: support
bootstrap-racket: support
cp support/c/${IDRIS2_SUPPORT} bootstrap/idris2_app
sed 's|__PREFIX__|${IDRIS2_CURDIR}/bootstrap|g' \
bootstrap/idris2_app/idris2.rkt \
> bootstrap/idris2_app/idris2-boot.rkt
sh ./bootstrap-rkt.sh
bootstrap/idris2_app/idris2.rkt \
> bootstrap/idris2_app/idris2-boot.rkt
sh ./bootstrap-stage1-racket.sh
sh ./bootstrap-stage2.sh IDRIS2_CG="racket"
bootstrap-test:
$(MAKE) test INTERACTIVE='' IDRIS2_PATH=${IDRIS2_BOOT_PATH} IDRIS2_DATA=${IDRIS2_BOOT_TEST_DATA} IDRIS2_LIBS=${IDRIS2_BOOT_TEST_LIBS}

View File

@ -1,47 +0,0 @@
#!/bin/sh
set -e # Exit on any error
echo "bootstrapping IDRIS2_VERSION=$IDRIS2_VERSION"
if [ -z "$IDRIS2_VERSION" ]
then
echo "Required ENV not set."
exit 1
fi
# Compile the bootstrap scheme
cd bootstrap
echo "Building idris2-boot from idris2-boot.rkt"
raco exe idris2_app/idris2-boot.rkt
# Put the result in the usual place where the target goes
mkdir -p ../build/exec
mkdir -p ../build/exec/idris2_app
install idris2-rktboot ../build/exec/idris2
install idris2_app/* ../build/exec/idris2_app
cd ..
PREFIX=${PWD}/bootstrap
if [ ${OS} = "windows" ]; then
# IDRIS_PREFIX is only used to build IDRIS2_BOOT_PATH
IDRIS_PREFIX=$(cygpath -m $PREFIX)
SEP=";"
else
IDRIS_PREFIX=${PREFIX}
SEP=":"
fi
BOOT_PATH_BASE=${IDRIS_PREFIX}/idris2-${IDRIS2_VERSION}
IDRIS2_BOOT_PATH="${BOOT_PATH_BASE}/prelude${SEP}${BOOT_PATH_BASE}/base${SEP}${BOOT_PATH_BASE}/contrib${SEP}${BOOT_PATH_BASE}/network"
# Now rebuild everything properly
# PREFIX must be the "clean" build root, without cygpath -m
# Otherwise, we get 'git: Bad address'
echo ${PREFIX}
DYLIB_PATH="${PREFIX}/lib"
${MAKE} libs IDRIS2_CG=racket PREFIX=${PREFIX} LD_LIBRARY_PATH=${DYLIB_PATH}
${MAKE} install IDRIS2_CG=racket PREFIX=${PREFIX} LD_LIBRARY_PATH=${DYLIB_PATH}
${MAKE} clean IDRIS2_BOOT=${PREFIX}/bin/idris2 LD_LIBRARY_PATH=${DYLIB_PATH}
${MAKE} all IDRIS2_BOOT=${PREFIX}/bin/idris2 IDRIS2_CG=racket IDRIS2_PATH=${IDRIS2_BOOT_PATH} LD_LIBRARY_PATH=${DYLIB_PATH}

24
bootstrap-stage1-chez.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/sh
set -e # Exit on any error
echo "bootstrapping SCHEME=$SCHEME IDRIS2_VERSION=$IDRIS2_VERSION"
if [ -z "$SCHEME" ] || [ -z "$IDRIS2_VERSION" ]; then
echo "Required ENV not set."
if [ -z "$SCHEME" ]; then
echo "Invoke with SCHEME=[name of chez scheme executable]"
fi
exit 1
fi
# Compile the bootstrap scheme
# TODO: Move boot-build to Makefile in bootstrap/Makefile
cd bootstrap
echo "Building idris2-boot from idris2-boot.ss"
${SCHEME} --script compile.ss
# Put the result in the usual place where the target goes
mkdir -p ../build/exec
mkdir -p ../build/exec/idris2_app
install idris2-boot ../build/exec/idris2
install idris2_app/* ../build/exec/idris2_app

View File

@ -0,0 +1,20 @@
#!/bin/sh
set -e # Exit on any error
echo "bootstrapping IDRIS2_VERSION=$IDRIS2_VERSION"
if [ -z "$IDRIS2_VERSION" ]; then
echo "Required ENV not set."
exit 1
fi
# Compile the bootstrap scheme
cd bootstrap
echo "Building idris2-boot from idris2-boot.rkt"
raco exe idris2_app/idris2-boot.rkt
# Put the result in the usual place where the target goes
mkdir -p ../build/exec
mkdir -p ../build/exec/idris2_app
install idris2-rktboot ../build/exec/idris2
install idris2_app/* ../build/exec/idris2_app

35
bootstrap-stage2.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/sh
set -e # Exit on any error
PREFIX=$PWD/bootstrap
if [ "$OS" = "windows" ]; then
# IDRIS_PREFIX is only used to build IDRIS2_BOOT_PATH
IDRIS_PREFIX=$(cygpath -m "$PREFIX")
SEP=";"
else
IDRIS_PREFIX=$PREFIX
SEP=":"
fi
IDRIS2_CG="${IDRIS2_CG-"chez"}"
BOOT_PATH_BASE=$IDRIS_PREFIX/idris2-$IDRIS2_VERSION
IDRIS2_BOOT_PATH="$BOOT_PATH_BASE/prelude$SEP $BOOT_PATH_BASE/base$SEP $BOOT_PATH_BASE/contrib$SEP $BOOT_PATH_BASE/network"
# PREFIX must be the "clean" build root, without cygpath -m
# Otherwise, we get 'git: Bad address'
echo "$PREFIX"
DYLIB_PATH="$PREFIX/lib"
$MAKE libs IDRIS2_CG="$IDRIS2_CG" LD_LIBRARY_PATH="$DYLIB_PATH" \
PREFIX="$PREFIX" SCHEME="$SCHEME"
$MAKE install IDRIS2_CG="$IDRIS2_CG" LD_LIBRARY_PATH="$DYLIB_PATH" \
PREFIX="$PREFIX" SCHEME="$SCHEME"
# Now rebuild everything properly
$MAKE clean-libs IDRIS2_BOOT="$PREFIX/bin/idris2"
$MAKE all IDRIS2_BOOT="$PREFIX/bin/idris2" IDRIS2_CG="$IDRIS2_CG" \
IDRIS2_PATH="$IDRIS2_BOOT_PATH" LD_LIBRARY_PATH="$DYLIB_PATH" \
SCHEME="$SCHEME"

View File

@ -1,52 +0,0 @@
#!/bin/sh
set -e # Exit on any error
echo "bootstrapping SCHEME=$SCHEME IDRIS2_VERSION=$IDRIS2_VERSION"
if [ -z "$SCHEME" ] || [ -z "$IDRIS2_VERSION" ]
then
echo "Required ENV not set."
if [ -z "$SCHEME" ]
then
echo "Invoke with SCHEME=[name of chez scheme executable]"
fi
exit 1
fi
# Compile the bootstrap scheme
# TODO: Move boot-build to Makefile in bootstrap/Makefile
cd bootstrap
echo "Building idris2-boot from idris2-boot.ss"
${SCHEME} --script compile.ss
# Put the result in the usual place where the target goes
mkdir -p ../build/exec
mkdir -p ../build/exec/idris2_app
install idris2-boot ../build/exec/idris2
install idris2_app/* ../build/exec/idris2_app
cd ..
# TODO: Unify with bootstrap-rkt
PREFIX=${PWD}/bootstrap
if [ ${OS} = "windows" ]; then
# IDRIS_PREFIX is only used to build IDRIS2_BOOT_PATH
IDRIS_PREFIX=$(cygpath -m $PREFIX)
SEP=";"
else
IDRIS_PREFIX=${PREFIX}
SEP=":"
fi
BOOT_PATH_BASE=${IDRIS_PREFIX}/idris2-${IDRIS2_VERSION}
IDRIS2_BOOT_PATH="${BOOT_PATH_BASE}/prelude${SEP}${BOOT_PATH_BASE}/base${SEP}${BOOT_PATH_BASE}/contrib${SEP}${BOOT_PATH_BASE}/network"
# Now rebuild everything properly
# PREFIX must be the "clean" build root, without cygpath -m
# Otherwise, we get 'git: Bad address'
echo ${PREFIX}
${MAKE} libs SCHEME=${SCHEME} PREFIX=${PREFIX}
${MAKE} install SCHEME=${SCHEME} PREFIX=${PREFIX}
${MAKE} clean IDRIS2_BOOT=${PREFIX}/bin/idris2
${MAKE} all IDRIS2_BOOT=${PREFIX}/bin/idris2 SCHEME=${SCHEME} IDRIS2_PATH=${IDRIS2_BOOT_PATH}

View File

@ -1,5 +1,8 @@
{ stdenv, fetchFromGitHub, makeWrapper
, clang, chez
{ stdenv
, chez
, clang
, fetchFromGitHub
, makeWrapper
}:
# Uses scheme to bootstrap the build of idris2
@ -21,9 +24,9 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional stdenv.isDarwin "OS=";
# The name of the main executable of pkgs.chez is `scheme`
buildFlags = [ "bootstrap-build" "SCHEME=scheme" ];
buildFlags = [ "bootstrap" "SCHEME=scheme" ];
checkTarget = "bootstrap-test";
checkTarget = "test";
# TODO: Move this into its own derivation, such that this can be changed
# without having to recompile idris2 every time.