(ci) update gh workflow: setup-emsdk version #91
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
# --------------------------------------------------------------------------- | |
# GitHub Action workflow for compiling and packaging Ciao. | |
# | |
# Authors: The Ciao Development Team | |
# --------------------------------------------------------------------------- | |
name: Build | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ${{ matrix.sys.os }} | |
strategy: | |
matrix: | |
sys: | |
# Note: enable only one 'devenv' build (for docs release) | |
- { os: ubuntu-latest, arch: x86_64, inskind: minciao } | |
- { os: ubuntu-latest, arch: x86_64, inskind: devenv } | |
# - { os: ubuntu-latest, arch: i686, inskind: minciao } | |
- { os: macos-latest, arch: x86_64, inskind: minciao } | |
- { os: macos-latest, arch: x86_64, inskind: devenv-nodocs } | |
- { os: windows-2019, arch: x86_64, inskind: minciao } | |
# - { os: windows-2019, arch: i686, inskind: minciao } | |
# compiler: | |
# - { cc: gcc, cxx: g++ } | |
# - { cc: clang, cxx: clang++ } | |
# env: | |
# CC: ${{ matrix.compiler.cc }} | |
# CXX: ${{ matrix.compiler.cxx }} | |
defaults: | |
run: | |
# Select msys2 shell only in windows (weird implementation due to github action limitations ) | |
shell: ${{ fromJSON('["msys2 {0}", "bash"]')[matrix.sys.os != 'windows-2019'] }} | |
steps: | |
# Additional setup for windows | |
- uses: msys2/setup-msys2@v2 | |
if: (matrix.sys.os == 'windows-2019') | |
with: | |
msystem: ${{ fromJSON('["mingw32", "mingw64"]')[matrix.sys.arch != 'i686'] }} | |
update: true | |
install: git base-devel | |
- run: | | |
if [ "${{ matrix.sys.arch }}" == "x86_64" ]; then | |
pacman --noconfirm -S mingw-w64-x86_64-gcc | |
else | |
pacman --noconfirm -S mingw-w64-i686-gcc | |
fi | |
if: (matrix.sys.os == 'windows-2019') | |
# Additional setup for ubuntu | |
- run: | | |
sudo apt-get update && sudo apt-get install gcc-multilib g++-multilib libc6-i386 libc6-dev-i386 | |
if: (matrix.sys.os == 'ubuntu-latest' && matrix.sys.arch == 'i686') | |
# Additional setup for devenv: emacs and documentation generation | |
- run: | | |
sudo apt-get update && sudo apt-get install emacs-nox texlive-latex-base texlive-binaries ghostscript | |
sudo sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml | |
if: (matrix.sys.os == 'ubuntu-latest' && matrix.sys.inskind == 'devenv') | |
# Additional setup for devenv: Emscripten | |
- uses: mymindstorm/setup-emsdk@v14 | |
if: (matrix.sys.os == 'ubuntu-latest' && matrix.sys.inskind == 'devenv') | |
# Checks-out repo under $GITHUB_WORKSPACE | |
- uses: actions/checkout@v2 | |
# Build | |
- name: Build | |
run: | | |
case "${{ matrix.sys.inskind }}" in | |
minciao) EXTRAOPTS=""; DEVENV=no; WASM=no; ;; | |
devenv) EXTRAOPTS="--ciaopp:lite=yes"; DEVENV=yes; WASM=yes; ;; | |
devenv-nodocs) EXTRAOPTS="--with-docs=no --ciaopp:lite=yes"; DEVENV=yes; WASM=no; ;; | |
esac | |
if [ "${{ matrix.sys.arch }}" == "i686" ]; then | |
ARCHOPTS="--core:m32=yes" | |
else | |
ARCHOPTS="" | |
fi | |
# ARCHOPTS="${{ matrix.sys.archopts }} --core:custom_cc=$CC" | |
./ciao-boot.sh boot-build $ARCHOPTS | |
if [ $DEVENV == yes ]; then ./ciao-boot.sh fetch devenv; fi | |
if [ $WASM == yes ]; then ./ciao-boot.sh fetch ciaowasm ciao_playground exfilter website; fi | |
./ciao-boot.sh configure --instype=local $ARCHOPTS $EXTRAOPTS | |
./ciao-boot.sh build | |
./ciao-boot.sh install | |
if [ $WASM == yes ]; then | |
eval "$(build/bin/ciao-env --sh)" # update PATH, etc. | |
ciao_playground/build.sh | |
ciao custom_run website fetch_externals | |
ciao custom_run website dist | |
fi | |
# Release | |
- name: Prepare release assets (bin) | |
if: (startsWith(github.ref, 'refs/tags/v') && matrix.sys.inskind == 'minciao') | |
id: prepare_release_bin | |
run: | | |
./ciao-boot.sh gen_pbundle --kind=bin_tgz | |
VERS=$(cat core/Manifest/GlobalVersion).$(cat core/Manifest/GlobalPatch) | |
cd build/pbundle | |
PBUNDLE=$(echo Ciao-*.tar.gz | sed 's/Ciao-.*-bin/ciao-'$VERS'/') | |
mv Ciao-*.tar.gz $PBUNDLE | |
# (keep pbundle name output) | |
echo "::set-output name=pbundle::$PBUNDLE" | |
- name: Prepare release assets (docs and site) | |
if: (startsWith(github.ref, 'refs/tags/v') && matrix.sys.inskind == 'devenv') | |
id: prepare_release_others | |
run: | | |
VERS=$(cat core/Manifest/GlobalVersion).$(cat core/Manifest/GlobalPatch) | |
cd build | |
mkdir -p pbundle | |
# cleanup doc and pack | |
PBUNDLEDOCS=ciao-"$VERS"-docs.tar.gz | |
mkdir -p doc site | |
rm -rf doc/*.cachedoc | |
tar -czf pbundle/$PBUNDLEDOCS doc | |
# cleanup site and pack | |
PBUNDLESITE=ciao-"$VERS"-site.tar.gz | |
rm -rf site/*.cachedoc | |
rm -f site/ciao/build/doc site/node_modules | |
mkdir -p site/ciao/build/doc site/node_modules site/node_modules/monaco-editor | |
for m in doc/*.html; do [ -e "$m" ] || continue; cp -R "$m" site/ciao/build/doc; done | |
cp -R ../third-party/3rd-npm/node_modules/mathjax site/node_modules | |
cp -R ../third-party/3rd-npm/node_modules/monaco-editor/min site/node_modules/monaco-editor | |
tar -czf pbundle/$PBUNDLESITE site | |
# (keep pbundledocs, pbundlesite name output) | |
echo "::set-output name=pbundledocs::$PBUNDLEDOCS" | |
echo "::set-output name=pbundlesite::$PBUNDLESITE" | |
- name: Release (bin) | |
uses: softprops/action-gh-release@v1 | |
if: (startsWith(github.ref, 'refs/tags/v') && matrix.sys.inskind == 'minciao') | |
with: | |
files: | | |
./build/pbundle/${{ steps.prepare_release_bin.outputs.pbundle }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release (docs and site) | |
uses: softprops/action-gh-release@v1 | |
if: (startsWith(github.ref, 'refs/tags/v') && matrix.sys.inskind == 'devenv') | |
with: | |
files: | | |
./build/pbundle/${{ steps.prepare_release_others.outputs.pbundledocs }} | |
./build/pbundle/${{ steps.prepare_release_others.outputs.pbundlesite }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |