Finch/.github/workflows/ci.yml
Nexoniarz b53e0910d8 The compiler runs on Windows (and has seeds for macOS)
Windows: the compiler made from bootstrap/windows-x86_64.ll runs under Wine, compiles itself to the same IR, builds an
exe of itself, and every test program passes through it. It needed: Windows-sized unsigned long for libclang's unsaved
file, no 'cross' when Windows builds for Windows, --target passed to libclang (libclang.dll assumes MSVC), the MinGW
triple always in the IR, FINCH_LDFLAGS, .exe names and FINCH_LLVM_INCLUDE in bootstrap/build.sh, winseed.sh/winbuild.sh.
macOS: seeds for arm64 and x86-64 made with the 11.3 SDK; IR is accepted by clang, nothing has run on a Mac yet.
CI gets a windows and a macos job. UNTESTED on real Windows/macOS runners.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015f73FesGZGYPkmDvUcj6QX
2026-10-26 00:37:06 +01:00

138 lines
4.9 KiB
YAML

name: CI
# The compiler is written in Finch. It is built from bootstrap/<system>.ll, its own LLVM IR (see bootstrap/README.md),
# then from itself. Seeds: Linux x86-64 and ARM64 (tested here), Windows x86-64 (tested under Wine, and here),
# macOS ARM64 and x86-64 (made with Apple's headers; only checked as IR until the macos job below passes).
on:
push:
branches: [main, "ci/**"]
tags: ["v*"]
pull_request:
jobs:
linux:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-24.04, arch: x64 }
- { os: ubuntu-24.04-arm, arch: arm64 }
name: linux-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install clang 21, libclang, tools
run: |
wget -q https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 21
sudo apt-get install -y libclang-21-dev pkg-config valgrind
echo "/usr/lib/llvm-21/bin" >> $GITHUB_PATH
- name: Build the compiler (seed, then itself, and the two must agree)
run: |
export FINCH_LIBCLANG="-L/usr/lib/llvm-21/lib -lclang-21"
bootstrap/build.sh
build/finch version
- name: Tests (programs, refusals, -g, a shared library, the language server)
run: tests/run.sh
- name: Tests under valgrind
if: matrix.arch == 'x64'
run: MEMCHECK=1 tests/run.sh
- name: Package
run: |
mkdir -p dist/finch && cp build/finch README.md LICENSE dist/finch/ && cp -r runtime std examples dist/finch/
tar -czf finch-linux-${{ matrix.arch }}.tar.gz -C dist finch
- uses: actions/upload-artifact@v4
with:
name: finch-linux-${{ matrix.arch }}
path: finch-linux-${{ matrix.arch }}.tar.gz
cross:
name: programs for ${{ matrix.target }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
target: [windows, arm64]
steps:
- uses: actions/checkout@v4
- name: Install clang 21, libclang, cross compilers and emulators
run: |
wget -q https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 21
sudo apt-get install -y libclang-21-dev pkg-config gcc-mingw-w64-x86-64 wine64 gcc-aarch64-linux-gnu qemu-user libc6-arm64-cross
echo "/usr/lib/llvm-21/bin" >> $GITHUB_PATH
- name: Build the compiler
run: |
export FINCH_LIBCLANG="-L/usr/lib/llvm-21/lib -lclang-21"
bootstrap/build.sh
- name: Run every test on the other system
run: |
if [ "${{ matrix.target }}" = windows ]; then
FINCH_CC=x86_64-w64-mingw32-gcc tests/cross.sh windows
else
FINCH_CC=aarch64-linux-gnu-gcc QEMU_LD_PREFIX=/usr/aarch64-linux-gnu tests/cross.sh arm64
fi
macos:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Install LLVM 21 (libclang)
run: brew install llvm@21 pkg-config
- name: Build the compiler
run: |
export FINCH_CLANG="$(brew --prefix llvm@21)/bin/clang"
export FINCH_LIBCLANG="-L$(brew --prefix llvm@21)/lib -lclang"
export FINCH_LLVM_INCLUDE="$(brew --prefix llvm@21)/include"
bootstrap/build.sh
build/finch version
- name: Tests
run: tests/run.sh
windows:
runs-on: windows-2022
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Download llvm-mingw (clang with MinGW headers) and LLVM for Windows (libclang.dll)
run: |
curl -sSL -o mingw.zip https://github.com/mstorsjo/llvm-mingw/releases/download/20251216/llvm-mingw-20251216-ucrt-x86_64.zip
7z x -y mingw.zip -o/c/ > /dev/null
curl -sSL -o llvm.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.8/LLVM-21.1.8-win64.exe
7z x -y llvm.exe -o/c/llvm > /dev/null
- name: Build the compiler
run: |
export PATH="/c/llvm-mingw-20251216-ucrt-x86_64/bin:$PATH"
export FINCH_LIBCLANG="C:/llvm/bin/libclang.dll"
export FINCH_LLVM_INCLUDE="C:/llvm/include"
export FINCH_LDFLAGS="-LC:/llvm/bin"
bootstrap/build.sh
build/finch.exe version
- name: Tests
run: |
export PATH="/c/llvm-mingw-20251216-ucrt-x86_64/bin:$PATH"
export FINCH_LDFLAGS="-LC:/llvm/bin"
FINCH=../build/finch.exe tests/run.sh
vscode:
runs-on: ubuntu-24.04
defaults:
run:
working-directory: editors/vscode
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- name: Grammar test
run: npm test
- name: Package
run: npx vsce package --out finch-lang.vsix
- uses: actions/upload-artifact@v4
with:
name: finch-vscode
path: editors/vscode/finch-lang.vsix