mirror of
https://github.com/Nexoniarz/Finch.git
synced 2026-11-03 08:54:25 +00:00
- CI: macOS on Apple Silicon and Intel (macos-15, macos-15-intel); a tag v* attaches every package (Linux x64/ARM64, macOS ARM64/x64, Windows x64, the VS Code extension) to its release - vectors: fma is llvm.fmuladd (llvm.fma was a libm call per lane without FMA hardware: 3.5x slower) - examples/simd.fch: a dot product eight at a time, timed against the plain loop - README and the English guides: installing on Linux, macOS and Windows; vectors (SIMD); --cpu; -g is DWARF on Windows too (lldb from llvm-mingw); no more mention of the C++ compiler - comments left from the C++ compiler (src/target.cpp, src/codegen.cpp, "never frees") brought up to date Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Psc42moPLwP43Cmb9oZqSR
187 lines
6.6 KiB
YAML
187 lines
6.6 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, and tested, on every system it runs on: Linux x86-64 and ARM64, macOS ARM64 and x86-64, Windows x86-64.
|
|
# A tag v* also makes the release: every package below is attached to it.
|
|
|
|
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:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { os: macos-15, arch: arm64 }
|
|
- { os: macos-15-intel, arch: x64 }
|
|
name: macos-${{ matrix.arch }}
|
|
runs-on: ${{ matrix.os }}
|
|
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
|
|
- 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-macos-${{ matrix.arch }}.tar.gz -C dist finch
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: finch-macos-${{ matrix.arch }}
|
|
path: finch-macos-${{ matrix.arch }}.tar.gz
|
|
|
|
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
|
|
- name: Package
|
|
run: |
|
|
mkdir -p dist/finch
|
|
cp build/finch.exe build/libclang.dll README.md LICENSE dist/finch/
|
|
cp -r runtime std examples dist/finch/
|
|
cd dist && 7z a -tzip finch-windows-x64.zip finch > /dev/null
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: finch-windows-x64
|
|
path: dist/finch-windows-x64.zip
|
|
|
|
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
|
|
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
needs: [linux, cross, macos, windows, vscode]
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: dist
|
|
merge-multiple: true
|
|
- name: Attach the packages to the release (made if it isn't there yet)
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: Finch ${{ github.ref_name }}
|
|
generate_release_notes: true
|
|
files: |
|
|
dist/finch-linux-x64.tar.gz
|
|
dist/finch-linux-arm64.tar.gz
|
|
dist/finch-macos-arm64.tar.gz
|
|
dist/finch-macos-x64.tar.gz
|
|
dist/finch-windows-x64.zip
|
|
dist/finch-lang.vsix
|