Build windows target for release #165
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 windows target for release' | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to release ( ex: v0.0.1 )' | |
required: true | |
env: | |
node-version: 14.x | |
jobs: | |
release: | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout madlib | |
uses: actions/checkout@v2 | |
# - name: Install Haskell tools | |
# run: | | |
# choco install ghc --version 8.10.7 -m -r | |
# choco install haskell-stack --version 2.7.3 -m -r | |
# choco install cabal --version 3.6.2.0 -m -r | |
- uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: "8.10.7" | |
cabal-version: "3.4.0.0" | |
stack-version: "2.7.3" | |
enable-stack: true | |
- name: Configure stack | |
run: stack config set system-ghc --global true | |
- name: Use Node.js ${{ env.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ env.node-version }} | |
- name: Install rollup | |
run: npm i -g [email protected] | |
- name: Setup MSYS2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: false | |
install: >- | |
git | |
mingw-w64-x86_64-curl | |
mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-ninja | |
mingw-w64-x86_64-toolchain | |
mingw-w64-x86_64-openssl | |
mingw-w64-x86_64-zlib | |
mingw-w64-x86_64-nasm | |
base-devel | |
msys2-devel | |
unzip | |
tar | |
- name: Install LLVM 12 | |
run: | | |
echo "download archive" | |
curl -L https://github.com/madlib-lang/llvm-build-actions/releases/download/v0.0.2/llvm12-mingw64.zip --output LLVM.zip | |
echo "create folder" | |
mkdir LLVM | |
echo "move to folder" | |
cd LLVM | |
echo "unzip archive" | |
unzip ../LLVM.zip | |
echo "exit folder" | |
cd .. | |
echo "clean up LLVM folder" | |
rm -rf "/c/Program Files/LLVM" | |
echo "move LLVM folder" | |
mv LLVM "/c/Program Files/" | |
ls -l "/c/Program Files/LLVM" | |
shell: msys2 {0} | |
- name: Update paths | |
run: | |
echo "PATH=c:\Program Files\LLVM\bin;D:\a\_temp\msys64\mingw64\bin;C:\npm\prefix;c:\Program Files\nodejs;c:\ProgramData\chocolatey\bin;c:\Users\runneradmin\AppData\Roaming\local\bin;c:\Users\runneradmin\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\bin;$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
# echo "PATH=c:\Program Files\LLVM\bin;D:\a\_temp\msys64\mingw64\bin;C:\npm\prefix;$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Install happy and alex | |
run: stack install alex happy | |
- name: Build madlib | |
run: stack build -v --flag madlib:static | |
# - name: Build madlib | |
# shell: msys2 {0} | |
# run: PATH="/c/Program Files/LLVM/bin:/mingw64/bin:/c/npm/prefix:/c/Program Files/nodejs:/c/ProgramData/chocolatey/bin:/c/Users/runneradmin/AppData/Roaming/local/bin:/c/Users/runneradmin/AppData/Local/Programs/stack/x86_64-windows/ghc-8.10.7/bin:$PATH" stack build -v --flag madlib:static | |
- name: Path info | |
shell: msys2 {0} | |
run: | | |
export PATH="/c/hostedtoolcache/windows/stack/2.7.3/x64:/c/tools/ghc-8.10.7/bin:/c/Users/runneradmin/AppData/Roaming/cabal/bin:/c/npm/prefix:/c/Program Files/nodejs:/c/ProgramData/chocolatey/bin:/c/Users/runneradmin/AppData/Local/Programs/stack/x86_64-windows/ghc-8.10.7/bin:$PATH" | |
pwd | |
ls -la | |
ls -l "$(stack path --dist-dir)" | |
ls -l "$(stack path --dist-dir)/build/" | |
ls -l "$(stack path --dist-dir)/build/madlib/" | |
- name: Build tools | |
shell: msys2 {0} | |
run: | | |
export PATH="/c/hostedtoolcache/windows/stack/2.7.3/x64:/c/tools/ghc-8.10.7/bin:/c/Users/runneradmin/AppData/Roaming/cabal/bin:/c/npm/prefix:/c/Program Files/nodejs:/c/ProgramData/chocolatey/bin:/c/Users/runneradmin/AppData/Local/Programs/stack/x86_64-windows/ghc-8.10.7/bin:$PATH" | |
export ESBUILD_PATH="/c/npm/prefix/esbuild.cmd" | |
"$(stack path --dist-dir)/build/madlib/madlib" compile -i tools/package-installer/src/Main.mad -o ./tools/package-installer/dist/package-installer.js --bundle | |
- name: Override LLVM path | |
run: echo "PATH=D:\a\_temp\msys64\mingw64\bin;$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Build runtime | |
shell: msys2 {0} | |
run: | | |
pacman --noconfirm -S mingw-w64-x86_64-llvm mingw-w64-x86_64-clang mingw-w64-x86_64-gcc mingw-w64-x86_64-libc++ mingw-w64-x86_64-libc++abi | |
TARGET="WIN_X64" ./scripts/build-runtime-libs | |
TARGET="WIN_X64" CXX="g++" ./scripts/build-runtime | |
- name: Bundle archive | |
shell: msys2 {0} | |
run: | | |
export PATH="/c/hostedtoolcache/windows/stack/2.7.3/x64:/c/tools/ghc-8.10.7/bin:/c/Users/runneradmin/AppData/Roaming/cabal/bin:/c/npm/prefix:/c/Program Files/nodejs:/c/ProgramData/chocolatey/bin:/c/Users/runneradmin/AppData/Local/Programs/stack/x86_64-windows/ghc-8.10.7/bin:$PATH" | |
mkdir madlib-x86_64-pc-windows-mingw32 | |
cp "$(stack path --dist-dir)/build/madlib/madlib.exe" ./madlib-x86_64-pc-windows-mingw32/ | |
cp -R runtime ./madlib-x86_64-pc-windows-mingw32/ | |
cp -R prelude ./madlib-x86_64-pc-windows-mingw32/ | |
cp ./tools/package-installer/dist/package-installer.js ./madlib-x86_64-pc-windows-mingw32/ | |
tar -czvf madlib-x86_64-pc-windows-mingw32.tar.gz madlib-x86_64-pc-windows-mingw32 | |
- uses: pdamianik/[email protected] | |
id: release_upload_url | |
with: | |
tag: ${{ github.event.inputs.version }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload build | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release_upload_url.outputs.uploadUrl }} | |
asset_path: ./madlib-x86_64-pc-windows-mingw32.tar.gz | |
asset_name: madlib-x86_64-pc-windows-mingw32.tar.gz | |
asset_content_type: application/tar+gzip |