CSyntax: Parameterize CharConst by the width #545
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
| on: [push, pull_request] | |
| name: Build / Test / Release | |
| jobs: | |
| prepare-release: | |
| name: Prepare a release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Make a release | |
| run: | | |
| gh release create "${{ github.ref_name }}" --draft | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} | |
| build-and-test: | |
| name: Build and test | |
| needs: [prepare-release] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install mlton lua5.3 luajit | |
| - name: Build | |
| run: make | |
| - name: Test (Lua) | |
| run: make test-lua | |
| - name: Test (LuaJIT) | |
| run: make test-luajit | |
| env: | |
| LUA_INIT_5_3: "" | |
| # LuaJIT: Workaround https://github.com/LuaJIT/LuaJIT/issues/859 | |
| LUA_INIT: "local c=math.ceil;math.ceil=function(x)if-1<x and x<0 then return 0/(-1)else return c(x)end end" | |
| - name: Test (JS) | |
| run: make test-nodejs | |
| - name: Test (JS-CPS) | |
| run: make test-nodejs-cps | |
| - name: Test (Lua-continuations) | |
| run: make test-lua-continuations | |
| - name: Prepare third-party libraries | |
| run: make -C thirdparty install | |
| - name: Compile myself (Lua) | |
| run: | | |
| bin/lunarml compile -o lunarml.lua --default-ann "valDescInComments error" --internal-consistency-check src/lunarml-main.mlb | |
| luac -p lunarml.lua | |
| - name: Compile myself (LuaJIT) | |
| run: | | |
| bin/lunarml compile --luajit -o lunarml-luajit.lua --default-ann "valDescInComments error" --internal-consistency-check src/lunarml-main.mlb | |
| luajit -bl lunarml-luajit.lua > /dev/null | |
| - name: Compile myself (JavaScript) | |
| run: | | |
| bin/lunarml compile --nodejs-cps -o lunarml-nodejs.mjs --default-ann "valDescInComments error" --internal-consistency-check src/lunarml-main.mlb | |
| node --check lunarml-nodejs.mjs | |
| # - name: Compile myself and validate (JavaScript) | |
| # run: make validate-js | |
| # env: | |
| # NODE_OPTIONS: "--max-old-space-size=4096" | |
| - name: Archive | |
| run: make archive | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: archive | |
| path: | | |
| lunarml-*.tar.gz | |
| lunarml-*.zip | |
| - name: Attach tarballs to the release | |
| run: | | |
| gh release upload "${{ github.ref_name }}" lunarml-*.tar.gz lunarml-*.zip | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} | |
| bindist: | |
| name: Build bindist | |
| needs: [prepare-release] | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| runner: [ubuntu-22.04, ubuntu-22.04-arm, macos-15-intel, macos-14] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache MLton | |
| id: cache-mlton | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/mlton-dist | |
| key: ${{ matrix.runner }}-mlton | |
| - name: Install Lua (Linux) | |
| run: | | |
| sudo apt-get install lua5.3 | |
| if: ${{ runner.os == 'Linux' }} | |
| - name: Install Lua (macOS) | |
| run: | | |
| brew install lua@5.4 | |
| if: ${{ runner.os == 'macOS' }} | |
| # Maybe we can just run 'brew install mlton' to install the latest MLton on macOS | |
| - name: Install MLton | |
| run: | | |
| case "$RUNNER_ARCH-$RUNNER_OS" in | |
| X64-Linux) MLTON_URL="https://github.com/MLton/mlton/releases/download/on-20241230-release/mlton-20241230-1.amd64-linux.ubuntu-22.04_glibc2.35.tgz" ;; | |
| ARM64-Linux) MLTON_URL="https://github.com/MLton/mlton/releases/download/on-20241230-release/mlton-20241230-1.arm64-linux.ubuntu-22.04-arm_glibc2.35.tgz" ;; | |
| X64-macOS) MLTON_URL="https://github.com/MLton/mlton/releases/download/on-20241230-release/mlton-20241230-1.amd64-darwin.macos-13_gmp-homebrew.tgz" ;; | |
| ARM64-macOS) MLTON_URL="https://github.com/MLton/mlton/releases/download/on-20241230-release/mlton-20241230-1.arm64-darwin.macos-14_gmp-homebrew.tgz" ;; | |
| esac | |
| curl -Lo mlton-release.tgz "$MLTON_URL" | |
| mkdir -p "$HOME/mlton-dist" | |
| tar -x --strip-components=1 -C "$HOME/mlton-dist" -f mlton-release.tgz | |
| if: ${{ steps.cache-mlton.outputs.cache-hit != 'true' }} | |
| - name: Setup MLton | |
| run: | | |
| echo "$HOME/mlton-dist/bin" >> "$GITHUB_PATH" | |
| - name: Build | |
| run: make | |
| - name: Archive | |
| run: make archive-bindist | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bindist-${{ matrix.runner }} | |
| path: | | |
| lunarml-*.tar.gz | |
| - name: Attach tarballs to the release | |
| run: | | |
| gh release upload "${{ github.ref_name }}" lunarml-*.tar.gz | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} | |
| build-docs: | |
| name: Build docs | |
| needs: [prepare-release] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version-file: 'docs/.python-version' | |
| enable-cache: true | |
| - name: Sync dependencies | |
| run: uv sync | |
| working-directory: ./docs | |
| - name: Build HTML | |
| run: make -C docs SPHINXBUILD="uv run sphinx-build" html | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: html-docs | |
| path: docs/_build/html/ | |
| - name: Attach docs to the release | |
| run: | | |
| mv docs/_build/html "lunarml-docs-${{ github.ref_name }}" | |
| zip -r "lunarml-docs-${{ github.ref_name }}.zip" "lunarml-docs-${{ github.ref_name }}" | |
| gh release upload "${{ github.ref_name }}" "lunarml-docs-${{ github.ref_name }}.zip" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} |