-
Notifications
You must be signed in to change notification settings - Fork 21
147 lines (144 loc) · 6.41 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# ---------------------------------------------------------------------------
# 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@v11
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 }}