-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (53 loc) · 1.76 KB
/
ci.yml
File metadata and controls
66 lines (53 loc) · 1.76 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# Run weekly on Mondays at midnight UTC to catch upstream changes
- cron: '0 0 * * 1'
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y swig gcc python3-dev
- name: Install Python dependencies
run: |
pip install --upgrade pip setuptools pytest
- name: Clone upstream libinjection
run: |
git clone --depth=1 https://github.com/libinjection/libinjection.git upstream
- name: Copy upstream source files
run: |
cp -f upstream/src/libinjection*.h upstream/src/libinjection*.c libinjection/
- name: Create tests symlink for test_driver.py
# test_driver.py resolves test files relative to ../tests from the repo root
run: |
ln -s "$(realpath upstream/tests)" "$(realpath ..)/tests"
- name: Generate words.py from upstream data
run: |
python json2python.py < upstream/src/sqlparse_data.json > words.py
- name: Generate SWIG wrapper
run: |
swig -python -builtin -Wall -Wextra libinjection/libinjection.i
- name: Build C extension in-place
run: |
python setup.py build_ext --inplace
- name: Run tests
run: |
pytest test_driver.py -v