Skip to content

Commit 1c1775f

Browse files
authored
add ci workflow (#77)
* add ci workflow Signed-off-by: kerthcet <kerthcet@gmail.com> * fix workflow Signed-off-by: kerthcet <kerthcet@gmail.com> * fix env error Signed-off-by: kerthcet <kerthcet@gmail.com> * fix test error Signed-off-by: kerthcet <kerthcet@gmail.com> * fix test error Signed-off-by: kerthcet <kerthcet@gmail.com> * change job name in ci Signed-off-by: kerthcet <kerthcet@gmail.com> --------- Signed-off-by: kerthcet <kerthcet@gmail.com>
1 parent 0eadeca commit 1c1775f

24 files changed

Lines changed: 106 additions & 31 deletions

File tree

.github/workflows/ci-test.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI Test
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
jobs:
10+
test-rust-core:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Rust
16+
uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: stable
19+
override: true
20+
21+
- name: Run tests
22+
run: make test
23+
24+
test-python-binding:
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: "3.12"
34+
35+
- name: Install uv
36+
run: pip install uv
37+
38+
- name: Install dependencies
39+
working-directory: bindings/python
40+
run: source start.sh
41+
42+
- name: Run tests
43+
working-directory: bindings/python
44+
run: make test
45+
46+
- name: Install docker-compose
47+
run: |
48+
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
49+
sudo chmod +x /usr/local/bin/docker-compose
50+
docker-compose --version
51+
52+
- name: Run integration tests
53+
working-directory: bindings/python
54+
run: |
55+
make test-integration

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ dist/
1818
# Added by cargo
1919

2020
/target
21+
.ruff_cache/
22+
.venv/

Makefile

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,9 @@
1-
POETRY := poetry
2-
RUFF := .venv/bin/ruff
3-
PYTEST := .venv/bin/pytest
4-
5-
.PHONY: build
6-
build: lint
7-
$(POETRY) build
8-
9-
.PHONY: publish
10-
publish: build
11-
$(POETRY) publish --username=__token__ --password=$(INFTYAI_PYPI_TOKEN)
12-
13-
.PHONY: lint
14-
lint:
15-
$(RUFF) check .
1+
CARGO := cargo
162

173
.PHONY: format
184
format:
19-
$(RUFF) format .
20-
$(RUFF) check --fix .
5+
$(CARGO) fmt
216

227
.PHONY: test
23-
test: lint
24-
$(PYTEST) tests/unit --timeout=15
25-
26-
.PHONY: test-integration
27-
test-integration: lint
28-
$(PYTEST) tests/integration --timeout=30
29-
'
30-
.PHONY: test-all
31-
test-all: test test-integration
8+
test: format
9+
$(CARGO) test

bindings/python/Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
POETRY := poetry
2+
RUFF := .venv/bin/ruff
3+
PYTEST := .venv/bin/pytest
4+
5+
.PHONY: build
6+
build: lint
7+
$(POETRY) build
8+
9+
.PHONY: publish
10+
publish: build
11+
$(POETRY) publish --username=__token__ --password=$(INFTYAI_PYPI_TOKEN)
12+
13+
.PHONY: lint
14+
lint:
15+
$(RUFF) check .
16+
17+
.PHONY: format
18+
format:
19+
$(RUFF) format .
20+
$(RUFF) check --fix .
21+
22+
.PHONY: test
23+
test: lint
24+
$(PYTEST) tests/unit --timeout=15
25+
26+
.PHONY: test-integration
27+
test-integration: lint
28+
$(PYTEST) tests/integration --timeout=30
29+
30+
.PHONY: test-all
31+
test-all: test test-integration

bindings/python/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Python Binding for AMRS

0 commit comments

Comments
 (0)