Skip to content

Commit 11eba51

Browse files
committed
ci setup
1 parent d311319 commit 11eba51

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build and Test
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Set up Python
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version: '3.12'
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '18'
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install build twine pytest pytest-cov setuptools setuptools-scm
24+
- name: Build and test
25+
run: |
26+
make ci

Makefile

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@ LIBRARY_NAME="${LIBRARY_NAME:-tree-sitter-cedarscript}"
44
TARGET_DIR="target"
55
GRAMMAR_DIR="src/cedarscript_grammar"
66

7-
ts() ( cd "$TARGET_DIR" && tree-sitter-macos-arm64 "$@" ;)
7+
ts() (
8+
cd "$TARGET_DIR" || exit
9+
if [ -n "$GITHUB_ACTIONS" ] || [ "$(uname)" = "Linux" ]; then
10+
# On GitHub Actions or Linux, install and use tree-sitter from npm
11+
if ! command -v tree-sitter &> /dev/null; then
12+
npm install --global tree-sitter-cli
13+
fi
14+
tree-sitter "$@"
15+
return
16+
fi
17+
# Local development on macOS ARM64
18+
tree-sitter-macos-arm64 "$@"
19+
)
820

921
playground() {
1022
while true; do

0 commit comments

Comments
 (0)