Skip to content

Commit d155182

Browse files
authored
Merge pull request #233 from GaneshPatil7517/ci/add-basic-testing-pipeline
ci: add basic CI pipeline for tests and linting
2 parents 0f302de + 3c0201a commit d155182

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master, dev]
6+
pull_request:
7+
branches: [main, master, dev]
8+
9+
jobs:
10+
lint-and-test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.11'
21+
cache: 'pip'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements-ci.txt
27+
# Uses minimal CI requirements (no tensorflow/heavy packages)
28+
29+
- name: Run linter (ruff)
30+
run: |
31+
ruff check . --select=E9,F63,F7,F82 --output-format=github \
32+
--exclude="Dockerfile.*" \
33+
--exclude="linktest/" \
34+
--exclude="measurements/" \
35+
--exclude="0mq/" \
36+
--exclude="ratc/"
37+
# E9: Runtime errors (syntax errors, etc.)
38+
# F63: Invalid print syntax
39+
# F7: Syntax errors in type comments
40+
# F82: Undefined names in __all__
41+
# Excludes: Dockerfiles (not Python), linktest (symlinks),
42+
# measurements/0mq/ratc (config-dependent experimental scripts)
43+
44+
- name: Run tests (pytest)
45+
run: |
46+
set +e
47+
pytest --tb=short -q \
48+
--ignore=measurements/ \
49+
--ignore=0mq/ \
50+
--ignore=ratc/ \
51+
--ignore=linktest/
52+
status=$?
53+
set -e
54+
# Allow success if no tests are collected (pytest exit code 5)
55+
if [ "$status" -ne 0 ] && [ "$status" -ne 5 ]; then
56+
exit "$status"
57+
fi
58+
# Fails on real test failures, passes on no tests collected
59+
60+
docker-build:
61+
runs-on: ubuntu-latest
62+
# Only run when Dockerfile.py or related files change
63+
if: |
64+
github.event_name == 'push' ||
65+
(github.event_name == 'pull_request' &&
66+
contains(github.event.pull_request.changed_files, 'Dockerfile'))
67+
68+
steps:
69+
- name: Checkout repository
70+
uses: actions/checkout@v4
71+
72+
- name: Check if Dockerfile.py changed
73+
uses: dorny/paths-filter@v3
74+
id: filter
75+
with:
76+
filters: |
77+
dockerfile:
78+
- 'Dockerfile.py'
79+
- 'requirements.txt'
80+
81+
- name: Validate Dockerfile build
82+
if: steps.filter.outputs.dockerfile == 'true'
83+
run: |
84+
docker build -f Dockerfile.py -t concore-py-test .
85+
# Validates that Dockerfile.py can be built successfully
86+
# Does not push the image

requirements-ci.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Minimal dependencies for CI (linting and testing)
2+
# Does not include heavyweight packages like tensorflow
3+
pytest
4+
ruff
5+
pyzmq
6+
numpy

0 commit comments

Comments
 (0)