mirror of
https://github.com/Nexoniarz/Finch.git
synced 2026-11-03 08:54:25 +00:00
- fn Struct.method(...) with self by reference, also on C structs
- map[K]V: insertion-ordered hash maps, literals, m[k] += 1, has/get/remove/keys/values
- -> T! / -> !, return error(...), or <value>, or { err }, try; fallible int/float/read_file/write_file/delete_file
- for i, x in list / for k, v in map
- print and str() share one text formatter
- LSP: method and map completion, method signatures; grammar and snippets for VS Code and Kate
- tests: 74 (methods, errors, maps + 11 failure cases); docs at all three levels, en and pl
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
160 lines
5 KiB
YAML
160 lines
5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, "ci/**"]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
|
|
env:
|
|
LLVM_VERSION: 21.1.8
|
|
|
|
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 LLVM 21, libclang, tools
|
|
run: |
|
|
wget -q https://apt.llvm.org/llvm.sh
|
|
sudo bash llvm.sh 21
|
|
sudo apt-get install -y llvm-21-dev libclang-21-dev ninja-build valgrind
|
|
echo "/usr/lib/llvm-21/bin" >> $GITHUB_PATH
|
|
- name: Build
|
|
run: |
|
|
cmake -S . -B build -G Ninja -DLLVM_DIR=/usr/lib/llvm-21/lib/cmake/llvm -DCMAKE_BUILD_TYPE=Release
|
|
ninja -C build
|
|
build/finch version
|
|
- name: Tests
|
|
run: tests/run.sh
|
|
- name: Tests under valgrind
|
|
if: matrix.arch == 'x64'
|
|
run: MEMCHECK=1 tests/run.sh
|
|
- name: Self-hosting
|
|
run: tests/boot.sh
|
|
- name: Language server
|
|
run: python3 tests/lsp_test.py
|
|
- name: Package
|
|
run: |
|
|
mkdir -p dist/finch && cp build/finch README.md LICENSE dist/finch/ && cp -r 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
|
|
|
|
macos:
|
|
runs-on: macos-15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install LLVM 21
|
|
run: |
|
|
brew install llvm@21 ninja
|
|
echo "$(brew --prefix llvm@21)/bin" >> $GITHUB_PATH
|
|
- name: Build
|
|
run: |
|
|
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_DIR="$(brew --prefix llvm@21)/lib/cmake/llvm"
|
|
ninja -C build
|
|
build/finch version
|
|
- name: Tests
|
|
run: CC=/usr/bin/clang tests/run.sh
|
|
- name: Self-hosting
|
|
run: CC=/usr/bin/clang tests/boot.sh
|
|
- name: Language server
|
|
run: python3 tests/lsp_test.py
|
|
- name: Apple frameworks
|
|
run: |
|
|
cat > fw.fch <<'EOF'
|
|
import "CoreFoundation/CoreFoundation.h"
|
|
link "CoreFoundation.framework"
|
|
|
|
fn main() {
|
|
print(CFAbsoluteTimeGetCurrent() > 0.0)
|
|
}
|
|
EOF
|
|
out=$(CC=/usr/bin/clang build/finch run fw.fch)
|
|
echo "$out"
|
|
test "$out" = "true"
|
|
- name: Package
|
|
run: |
|
|
mkdir -p dist/finch && cp build/finch README.md LICENSE dist/finch/ && cp -r examples dist/finch/
|
|
tar -czf finch-macos-arm64.tar.gz -C dist finch
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: finch-macos-arm64
|
|
path: finch-macos-arm64.tar.gz
|
|
|
|
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
|
|
|
|
windows:
|
|
runs-on: windows-2022
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ilammy/msvc-dev-cmd@v1
|
|
- name: Cache LLVM
|
|
id: cache-llvm
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: C:/llvm
|
|
key: llvm-${{ env.LLVM_VERSION }}-x86_64-pc-windows-msvc
|
|
- name: Download LLVM ${{ env.LLVM_VERSION }}
|
|
if: steps.cache-llvm.outputs.cache-hit != 'true'
|
|
run: |
|
|
curl -sSL -o llvm.tar.xz "https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-pc-windows-msvc.tar.xz"
|
|
mkdir -p /c/llvm
|
|
tar -xf llvm.tar.xz -C /c/llvm --strip-components=1
|
|
rm llvm.tar.xz
|
|
- name: Build finch.exe
|
|
run: |
|
|
echo "C:/llvm/bin" >> $GITHUB_PATH
|
|
export PATH="/c/llvm/bin:$PATH"
|
|
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_DIR=C:/llvm/lib/cmake/llvm \
|
|
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
|
|
ninja -C build
|
|
cp /c/llvm/bin/libclang.dll build/
|
|
build/finch.exe version
|
|
- name: Tests
|
|
run: |
|
|
export PATH="/c/llvm/bin:$PATH"
|
|
tests/run.sh
|
|
- name: Language server
|
|
run: python tests/lsp_test.py
|
|
- name: Package
|
|
run: |
|
|
mkdir -p dist/finch
|
|
cp build/finch.exe build/libclang.dll dist/finch/
|
|
cp README.md LICENSE dist/finch/
|
|
cp -r 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
|