-
Notifications
You must be signed in to change notification settings - Fork 106
92 lines (88 loc) · 2.43 KB
/
ci.yml
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
83
84
85
86
87
88
89
90
91
92
name: CI
on:
push:
branches: [master]
paths:
- tree_sitter/**
- tests/**
pull_request:
paths:
- tree_sitter/**
- tests/**
workflow_dispatch:
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
jobs:
build_asan:
runs-on: ubuntu-latest
timeout-minutes: 15
continue-on-error: true
env:
PYTHON_VERSION: "3.11"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Set Python path
run: echo "PYTHON_PATH=$RUNNER_TOOL_CACHE/Python/ASAN" >> "$GITHUB_ENV"
- name: Cache Python
uses: actions/cache@v4
id: python-cache
with:
path: ${{env.PYTHON_PATH}}
key: python-${{env.PYTHON_VERSION}}
- name: Build Python+ASAN
if: steps.python-cache.outputs.cache-hit != 'true'
run: |
git clone --depth=1 -b $PYTHON_VERSION \
https://github.com/python/cpython "$PYTHON_PATH/src"
cd "$PYTHON_PATH/src"
./configure \
--with-pydebug \
--with-assertions \
--with-address-sanitizer \
--with-undefined-behavior-sanitizer \
--disable-test-modules \
--disable-shared \
--prefix="$PYTHON_PATH"
make && make install
"$PYTHON_PATH/bin/python3" -mensurepip
- name: Sanitize
run: |-
"$PYTHON_PATH/bin/pip3" install -e .
"$PYTHON_PATH/bin/python3" -c 'import tree_sitter'
env:
CFLAGS: "-O0 -g"
build:
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-13, windows-latest]
runs-on: ${{matrix.os}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{matrix.python}}
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python}}
- name: Lint
run: pipx run ruff check .
- name: Build
run: pip install -e .
env:
CFLAGS: "-O0 -g"
- name: Test
shell: python
# run: python -Wignore:::tree_sitter -munittest
run: |-
import tree_sitter as ts
try:
ts.Language(1, "foo")
except RuntimeError as err:
print(err)