From 2287fd9edb2129ce2b5f9c40f350b868b2bd1d3d Mon Sep 17 00:00:00 2001 From: "G. Allais" Date: Wed, 20 Apr 2022 12:42:58 +0100 Subject: [PATCH] [ ci ] use katla to build html doc of the libs (#2422) --- .github/scripts/katla.sh | 30 +++++++++++ .github/workflows/ci-idris2.yml | 89 +++++++++++++++++++++++++++++++-- libs/test/test.ipkg | 2 + 3 files changed, 118 insertions(+), 3 deletions(-) create mode 100755 .github/scripts/katla.sh diff --git a/.github/scripts/katla.sh b/.github/scripts/katla.sh new file mode 100755 index 000000000..20eff4a0a --- /dev/null +++ b/.github/scripts/katla.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +prefix="../../libs" + +find "$prefix" -name "*.idr" >tmp +while IFS= read -r rawfile; do + file=$(echo "$rawfile" | sed "s|\.\./\.\./libs/\(.*\)|\1|") + libname=$(echo "$file" | sed "s|\([^/]*\)/.*|\1|") + filename=$(echo "$file" | sed "s|[^/]*/\(.*\)\.idr|\1|") + modulename=$(echo "$filename" | sed "s|/|.|g") + htmldir="html/${libname}/source/" + htmlfile="${htmldir}/${modulename}.html" + mkdir -p "$htmldir" + katla html "$rawfile" "${prefix}/${libname}/build/ttc/${filename}.ttm" >"$htmlfile" + sed -i "s||${modulename}|" "$htmlfile" +done tmp +while IFS= read -r libdirectory; do + libname=$(echo "$libdirectory" | sed "s|$prefix/||") + cp -r "$prefix"/"$libname"/build/docs/* html/"$libname" + find html/"$libname"/docs/ -name "*.html" >tmp2 + while IFS= read -r file; do + filename=$(basename "$file" ".html") + sed -i "s|

${filename}

|

${filename}(source)

|" "$file" + done > "$GITHUB_ENV" + fi + + - name: Download Idris2 Artifact + uses: actions/download-artifact@v2 + with: + name: idris2-nightly-chez + path: ~/.idris2/ + - name: Install build dependencies + run: | + echo "deb http://security.ubuntu.com/ubuntu hirsute universe" | sudo tee -a /etc/apt/sources.list + sudo apt-get update + sudo apt-get install -y -t hirsute chezscheme + echo "$HOME/.idris2/bin" >> "$GITHUB_PATH" + chmod +x "$HOME/.idris2/bin/idris2" "$HOME/.idris2/bin/idris2_app/"* + - name: Checkout idris2 + uses: actions/checkout@v2 + - name: Build API + run: make install-api + shell: bash + - name: Checkout collie + uses: actions/checkout@v2 + with: + repository: 'ohad/collie' + - name: Build and install Collie + run: | + make install + - name: Checkout idrall + uses: actions/checkout@v2 + with: + repository: 'alexhumphreys/idrall' + - name: Build and install idrall + run: | + make install + - name: Checkout katla + uses: actions/checkout@v2 + with: + repository: 'idris-community/katla' + - name: Build and install katla + run: | + make + mkdir -p "${HOME}"/.local/bin/ + cp -r build/exec/* "${HOME}"/.local/bin/ + echo "${HOME}/.local/bin" >> "$GITHUB_PATH" + - name: Checkout idris2 + uses: actions/checkout@v2 + - name: Build html doc + run: | + make -C libs/prelude/ install docs IDRIS2=idris2 + make -C libs/base/ install docs IDRIS2=idris2 + make -C libs/contrib/ install docs IDRIS2=idris2 + make -C libs/network/ install docs IDRIS2=idris2 + make -C libs/linear/ install docs IDRIS2=idris2 + make -C libs/test/ install docs IDRIS2=idris2 + make -C libs/papers/ install docs IDRIS2=idris2 + + cd .github/scripts + ./katla.sh + - name: Deploy HTML + uses: JamesIves/github-pages-deploy-action@4.1.3 + if: ${{ success() && env.IDRIS2_DEPLOY }} + + with: + branch: gh-pages + folder: .github/scripts/html/ + git-config-name: Github Actions diff --git a/libs/test/test.ipkg b/libs/test/test.ipkg index 4375a8445..5b9915fd0 100644 --- a/libs/test/test.ipkg +++ b/libs/test/test.ipkg @@ -3,4 +3,6 @@ version = 0.5.1 opts = "--ignore-missing-ipkg" +depends = contrib + modules = Test.Golden