update compile error format to match the new parser error format #74
This file contains hidden or 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: "binaries" | |
| on: [push] | |
| env: | |
| # LuaJIT has no releases; pin a commit from the v2.1 branch | |
| LUAJIT_COMMIT: 346ab587cb235b4ef0b5777b4cd29009808d0cc0 | |
| jobs: | |
| generate-headers: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@master | |
| - uses: leafo/gh-actions-lua@master | |
| with: | |
| luaVersion: "5.1" | |
| - uses: leafo/gh-actions-luarocks@master | |
| - name: Install dependencies | |
| run: | | |
| luarocks install argparse | |
| luarocks make | |
| - name: Generate moonscript.h | |
| run: | | |
| bin/splat.moon -x moonscript.parse.slow -x moonscript.parse.grammar moonscript moon > moonscript.lua | |
| xxd -i moonscript.lua > bin/binaries/moonscript.h | |
| - name: Generate moon.h | |
| run: | | |
| awk 'FNR>1' bin/moon > moon.lua | |
| xxd -i moon.lua > bin/binaries/moon.h | |
| - name: Generate argparse.h | |
| run: | | |
| luarocks install argparse --tree=lua_modules | |
| bin/splat.moon --strip-prefix -l argparse $(find lua_modules/share/lua -name "argparse.lua" -exec dirname {} \; | head -1) > bin/binaries/argparse.lua | |
| xxd -i -n argparse_lua bin/binaries/argparse.lua > bin/binaries/argparse.h | |
| - name: Generate moonc.h | |
| run: | | |
| awk 'FNR>1' bin/moonc > moonc.lua | |
| xxd -i moonc.lua > bin/binaries/moonc.h | |
| - name: Upload headers | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: generated-headers | |
| path: bin/binaries/*.h | |
| linux: | |
| runs-on: ${{ matrix.runner }} | |
| needs: generate-headers | |
| strategy: | |
| matrix: | |
| include: | |
| - runner: ubuntu-latest | |
| architecture: x86_64 | |
| artifact_suffix: "" | |
| runtime: puc | |
| lua_version: "5.1.5" | |
| runtime_label: "lua5.1.5" | |
| release_suffix: "" | |
| lua_include: lua-5.1.5/src | |
| lua_lib: lua-5.1.5/src/liblua.a | |
| - runner: ubuntu-latest | |
| architecture: x86_64 | |
| artifact_suffix: "" | |
| runtime: luajit | |
| runtime_label: "luajit2.1" | |
| release_suffix: "-luajit" | |
| lua_include: luajit/src | |
| lua_lib: luajit/src/libluajit.a | |
| - runner: ubuntu-24.04-arm | |
| architecture: arm64 | |
| artifact_suffix: "-arm64" | |
| runtime: puc | |
| lua_version: "5.1.5" | |
| runtime_label: "lua5.1.5" | |
| release_suffix: "" | |
| lua_include: lua-5.1.5/src | |
| lua_lib: lua-5.1.5/src/liblua.a | |
| - runner: ubuntu-24.04-arm | |
| architecture: arm64 | |
| artifact_suffix: "-arm64" | |
| runtime: luajit | |
| runtime_label: "luajit2.1" | |
| release_suffix: "-luajit" | |
| lua_include: luajit/src | |
| lua_lib: luajit/src/libluajit.a | |
| steps: | |
| - uses: actions/checkout@master | |
| - name: Set version suffix | |
| run: | | |
| if [[ "${{ github.ref_type }}" == "tag" ]]; then | |
| echo "VERSION_SUFFIX=${{ github.ref_name }}" >> $GITHUB_ENV | |
| else | |
| echo "VERSION_SUFFIX=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| fi | |
| # commit time, not wall clock, so identical inputs build identical binaries | |
| echo "BUILD_TIME=$(git show -s --format=%cI HEAD)" >> $GITHUB_ENV | |
| - name: Download headers | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: generated-headers | |
| path: bin/binaries/ | |
| - name: Show GCC | |
| run: gcc -v | |
| - name: Setup Lua | |
| if: matrix.runtime == 'puc' | |
| run: | | |
| curl -L -O https://www.lua.org/ftp/lua-${{ matrix.lua_version }}.tar.gz | |
| tar -xzf lua-${{ matrix.lua_version }}.tar.gz | |
| cd lua-${{ matrix.lua_version }}/src && make liblua.a MYCFLAGS=-DLUA_USE_POSIX | |
| - name: Setup LuaJIT | |
| if: matrix.runtime == 'luajit' | |
| run: | | |
| curl -L -o luajit.tar.gz https://github.com/LuaJIT/LuaJIT/archive/$LUAJIT_COMMIT.tar.gz | |
| tar -xzf luajit.tar.gz | |
| mv LuaJIT-* luajit | |
| make -C luajit/src -j$(nproc) amalg BUILDMODE=static | |
| - name: Get LPeg | |
| run: | | |
| curl -L -o lpeg.tar.gz https://www.inf.puc-rio.br/~roberto/lpeg/lpeg-1.0.2.tar.gz | |
| tar -xzf lpeg.tar.gz | |
| - name: Get Luafilesystem | |
| run: | | |
| curl -L -o luafilesystem.tar.gz https://github.com/keplerproject/luafilesystem/archive/v1_8_0.tar.gz | |
| tar -xzf luafilesystem.tar.gz | |
| - name: Build | |
| run: | | |
| mkdir -p dist | |
| gcc -static -o dist/moon \ | |
| -I${{ matrix.lua_include }} \ | |
| -Ilpeg-1.0.2/ \ | |
| -Ibin/binaries/ \ | |
| -DMOON_BUILD_COMMIT="\"${{ env.VERSION_SUFFIX }}\"" \ | |
| -DMOON_BUILD_TIME="\"${{ env.BUILD_TIME }}\"" \ | |
| bin/binaries/moon.c \ | |
| bin/binaries/moonscript.c \ | |
| moonscript/parse/native.c \ | |
| lpeg-1.0.2/lpvm.c \ | |
| lpeg-1.0.2/lpcap.c \ | |
| lpeg-1.0.2/lptree.c \ | |
| lpeg-1.0.2/lpcode.c \ | |
| lpeg-1.0.2/lpprint.c \ | |
| ${{ matrix.lua_lib }} \ | |
| -lm -ldl | |
| gcc -static -o dist/moonc \ | |
| -I${{ matrix.lua_include }} \ | |
| -Ilpeg-1.0.2/ \ | |
| -Ibin/binaries/ \ | |
| -DMOON_BUILD_COMMIT="\"${{ env.VERSION_SUFFIX }}\"" \ | |
| -DMOON_BUILD_TIME="\"${{ env.BUILD_TIME }}\"" \ | |
| bin/binaries/moonc.c \ | |
| bin/binaries/moonscript.c \ | |
| moonscript/parse/native.c \ | |
| lpeg-1.0.2/lpvm.c \ | |
| lpeg-1.0.2/lpcap.c \ | |
| lpeg-1.0.2/lptree.c \ | |
| lpeg-1.0.2/lpcode.c \ | |
| lpeg-1.0.2/lpprint.c \ | |
| luafilesystem-1_8_0/src/lfs.c \ | |
| ${{ matrix.lua_lib }} \ | |
| -lm -ldl | |
| - name: Test run | |
| run: | | |
| dist/moon -h | |
| dist/moon -e 'print "hello world"' | |
| dist/moonc -h | |
| - name: Test JIT | |
| if: matrix.runtime == 'luajit' | |
| run: dist/moon -e 'print jit.version' | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: moonscript-${{ env.VERSION_SUFFIX }}-linux-${{ matrix.runtime_label }}${{ matrix.artifact_suffix }} | |
| path: dist/ | |
| - name: Package for release | |
| if: github.ref_type == 'tag' | |
| run: | | |
| cd dist | |
| tar -czvf ../moonscript-${{ env.VERSION_SUFFIX }}-linux-${{ matrix.architecture }}${{ matrix.release_suffix }}.tar.gz * | |
| - name: Upload to release | |
| if: github.ref_type == 'tag' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: moonscript-${{ env.VERSION_SUFFIX }}-linux-${{ matrix.architecture }}${{ matrix.release_suffix }}.tar.gz | |
| windows: | |
| runs-on: windows-latest | |
| needs: generate-headers | |
| strategy: | |
| matrix: | |
| include: | |
| - runtime: puc | |
| lua_version: "5.1.5" | |
| runtime_label: "lua5.1.5" | |
| release_suffix: "" | |
| msys_install: gcc make curl zip | |
| lua_include: lua-5.1.5/src | |
| lua_lib: lua-5.1.5/src/liblua.a | |
| - runtime: luajit | |
| runtime_label: "luajit2.1" | |
| release_suffix: "-luajit" | |
| msys_install: make curl zip mingw-w64-x86_64-gcc | |
| lua_include: luajit/src | |
| lua_lib: luajit/src/libluajit.a | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - uses: actions/checkout@master | |
| - name: Download headers | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: generated-headers | |
| path: bin/binaries/ | |
| - uses: msys2/setup-msys2@v2 | |
| with: | |
| install: ${{ matrix.msys_install }} | |
| - name: Set version suffix | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.ref_type }}" == "tag" ]]; then | |
| echo "VERSION_SUFFIX=${{ github.ref_name }}" >> $GITHUB_ENV | |
| else | |
| echo "VERSION_SUFFIX=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| fi | |
| # commit time, not wall clock, so identical inputs build identical binaries | |
| echo "BUILD_TIME=$(git show -s --format=%cI HEAD)" >> $GITHUB_ENV | |
| - name: Show GCC | |
| run: gcc -v | |
| - name: Setup Lua | |
| if: matrix.runtime == 'puc' | |
| run: | | |
| curl -L -O https://www.lua.org/ftp/lua-${{ matrix.lua_version }}.tar.gz | |
| tar -xzf lua-${{ matrix.lua_version }}.tar.gz | |
| cd lua-${{ matrix.lua_version }}/src && make liblua.a | |
| - name: Setup LuaJIT | |
| if: matrix.runtime == 'luajit' | |
| run: | | |
| curl -L -o luajit.tar.gz https://github.com/LuaJIT/LuaJIT/archive/$LUAJIT_COMMIT.tar.gz | |
| tar -xzf luajit.tar.gz | |
| mv LuaJIT-* luajit | |
| make -C luajit/src -j$(nproc) amalg BUILDMODE=static | |
| - name: Get LPeg | |
| run: | | |
| curl -L -o lpeg.tar.gz https://www.inf.puc-rio.br/~roberto/lpeg/lpeg-1.0.2.tar.gz | |
| tar -xzf lpeg.tar.gz | |
| - name: Get Luafilesystem | |
| run: | | |
| curl -L -o luafilesystem.tar.gz https://github.com/keplerproject/luafilesystem/archive/v1_8_0.tar.gz | |
| tar -xzf luafilesystem.tar.gz | |
| - name: Build | |
| run: | | |
| mkdir -p dist | |
| gcc -static -o dist/moon.exe \ | |
| -I${{ matrix.lua_include }} \ | |
| -Ilpeg-1.0.2/ \ | |
| -Ibin/binaries/ \ | |
| -DMOON_BUILD_COMMIT="\"${{ env.VERSION_SUFFIX }}\"" \ | |
| -DMOON_BUILD_TIME="\"${{ env.BUILD_TIME }}\"" \ | |
| bin/binaries/moon.c \ | |
| bin/binaries/moonscript.c \ | |
| moonscript/parse/native.c \ | |
| lpeg-1.0.2/lpvm.c \ | |
| lpeg-1.0.2/lpcap.c \ | |
| lpeg-1.0.2/lptree.c \ | |
| lpeg-1.0.2/lpcode.c \ | |
| lpeg-1.0.2/lpprint.c \ | |
| ${{ matrix.lua_lib }} \ | |
| -lm | |
| gcc -static -o dist/moonc.exe \ | |
| -I${{ matrix.lua_include }} \ | |
| -Ilpeg-1.0.2/ \ | |
| -Ibin/binaries/ \ | |
| -DMOON_BUILD_COMMIT="\"${{ env.VERSION_SUFFIX }}\"" \ | |
| -DMOON_BUILD_TIME="\"${{ env.BUILD_TIME }}\"" \ | |
| bin/binaries/moonc.c \ | |
| bin/binaries/moonscript.c \ | |
| moonscript/parse/native.c \ | |
| lpeg-1.0.2/lpvm.c \ | |
| lpeg-1.0.2/lpcap.c \ | |
| lpeg-1.0.2/lptree.c \ | |
| lpeg-1.0.2/lpcode.c \ | |
| lpeg-1.0.2/lpprint.c \ | |
| luafilesystem-1_8_0/src/lfs.c \ | |
| ${{ matrix.lua_lib }} \ | |
| -lm | |
| - name: Test run | |
| run: | | |
| dist/moon.exe -h | |
| dist/moon.exe -e 'print "hello world"' | |
| dist/moonc.exe -h | |
| - name: Test JIT | |
| if: matrix.runtime == 'luajit' | |
| run: dist/moon.exe -e 'print jit.version' | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: moonscript-${{ env.VERSION_SUFFIX }}-windows-${{ matrix.runtime_label }} | |
| path: dist/ | |
| - name: Package for release | |
| if: github.ref_type == 'tag' | |
| run: | | |
| cd dist | |
| zip ../moonscript-${{ env.VERSION_SUFFIX }}-windows-x86_64${{ matrix.release_suffix }}.zip * | |
| - name: Upload to release | |
| if: github.ref_type == 'tag' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: moonscript-${{ env.VERSION_SUFFIX }}-windows-x86_64${{ matrix.release_suffix }}.zip |