forked from tree-sitter/csharp-tree-sitter
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (72 loc) · 2.83 KB
/
Copy pathci.yml
File metadata and controls
82 lines (72 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: CI
on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:
# Cancel superseded runs on the same ref to save CI minutes.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
name: build & test (${{ matrix.rid }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rid: linux-x64
- os: macos-14 # Apple Silicon runner -> osx-arm64
rid: osx-arm64
steps:
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
# tree-sitter/tree-sitter (and tree-sitter-cpp) are submodules; the native
# build needs the core runtime sources.
submodules: recursive
- name: Set up .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Build native runtime + test grammars
shell: bash
run: |
# Builds libtree-sitter (from the submodule) plus every grammar the test
# suite uses, into native/<rid>/. On macOS, build-native.sh ad-hoc codesigns
# each .dylib (mandatory: unsigned dylibs are SIGKILLed on load on arm64).
chmod +x build/build-native.sh scripts/fetch-test-grammars.sh
scripts/fetch-test-grammars.sh
- name: List native artifacts
shell: bash
run: ls -l "native/${{ matrix.rid }}"
- name: Build solution (Release)
run: dotnet build TreeSitter.slnx -c Release
- name: Test with coverage (Debug)
shell: bash
env:
# Belt-and-braces: the test module initializer also sets this, but exporting
# it here makes resolution robust regardless of working directory.
TREE_SITTER_NATIVE_PATH: ${{ github.workspace }}/native/${{ matrix.rid }}
run: |
# Coverage is collected against the Debug configuration: JIT optimizations in
# Release distort line/branch mapping, and the coverlet data collector's IL
# instrumentation does not mix well with optimized [UnmanagedCallersOnly]
# interop thunks. The Release build above validates the optimized compile;
# this step produces the coverage report.
dotnet test TreeSitter.slnx -c Debug \
--collect:"XPlat Code Coverage" \
--settings tests/TreeSitter.Tests/coverage.runsettings \
--results-directory ./TestResults \
--logger "trx;LogFileName=test-results.trx"
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.rid }}
path: |
./TestResults/**/coverage.cobertura.xml
./TestResults/**/*.trx
if-no-files-found: warn