Skip to content

ci: major overhaul #285

ci: major overhaul

ci: major overhaul #285

Workflow file for this run

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
env:
PYTHON_VERSION: "3.8"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Cache Python
uses: actions/cache@v4
id: python-cache
with:
path: ${{runner.tool_cache}}/Python/ASAN
key: python-${{env.PYTHON_VERSION}}
- name: Build Python+ASAN
if: steps.python-cache.outputs.cache-hit != 'true'
run: |
export PYTHON_PATH="$RUNNER_TOOL_CACHE/Python/ASAN"
git clone --depth=1 -b $PYTHON_VERSION \
https://github.com/python/cpython "$RUNNER_TEMP/cpython"
cd "$RUNNER_TEMP/cpython"
./configure \
--with-pydebug \
--with-assertions \
--with-address-sanitizer \
--with-undefined-behavior-sanitizer \
--disable-shared \
--prefix="$PYTHON_PATH"
make -j2 && make install
"$PYTHON_PATH/bin/python3" -mensurepip
echo "$PYTHON_PATH/bin" >> "$GITHUB_PATH"
- name: Sanitize
run: pip3 install -e . && python3 -c 'import tree_sitter'
env:
CFLAGS: "-O0 -g"
build:
strategy:
fail-fast: false
matrix:
python: ["3.8", "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 .
- name: Build
run: pip install -e .
env:
CFLAGS: "-O0 -g"
- name: Test
run: python -Wignore:::tree_sitter -munittest