Skip to content

Commit b38d3a2

Browse files
authored
chore: add CI workflow (#46)
1 parent 60bf46b commit b38d3a2

File tree

6 files changed

+290
-184
lines changed

6 files changed

+290
-184
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
2+
name: Full CI
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
pre_checks:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 30
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up python
25+
id: setup-python
26+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
27+
with:
28+
python-version: "3.10"
29+
30+
- name: Install Poetry
31+
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1
32+
with:
33+
virtualenvs-create: true
34+
virtualenvs-in-project: true
35+
installer-parallel: true
36+
37+
- name: Install deps & build base images
38+
run: make setup
39+
40+
- name: Check format
41+
run: make check_format
42+
43+
- name: Check linting
44+
run: make check_linting
45+
46+
- name: Make sure doc is building
47+
run: make doc
48+
49+
test:
50+
runs-on: ubuntu-latest
51+
timeout-minutes: 30
52+
strategy:
53+
fail-fast: false # Do not stop when any job fails
54+
matrix:
55+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Set up python
63+
id: setup-python
64+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
65+
with:
66+
python-version: "${{ matrix.python-version }}"
67+
68+
- name: Install Poetry
69+
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1
70+
with:
71+
virtualenvs-create: true
72+
virtualenvs-in-project: true
73+
installer-parallel: true
74+
75+
- name: Install deps & build base images
76+
run: make setup
77+
78+
- name: Run the tests
79+
run: make test

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ format: ## Format all files inside backend with black & isort
1616

1717
check_linting: ## Verify code with lint tools, like pylint
1818
poetry run pylint ./src/giskard_hub
19+
.PHONY: check_linting
20+
21+
check_format: ## Verify code formatting
22+
poetry run black --check .
23+
poetry run isort -c .
1924
.PHONY: check_format
2025

2126
setup: ## Install dependencies
@@ -33,4 +38,8 @@ quick-doc: ## Build the doc & serve it locally
3338
cp ./README.md ./script-docs/README.md
3439
cd ./script-docs && rm -rf _build && poetry run make html
3540
poetry run python3 -m http.server --directory ./script-docs/_build/html/
36-
.PHONY: quick-doc
41+
.PHONY: quick-doc
42+
43+
test: ## Launch unit tests
44+
poetry run pytest -vvv ./tests
45+
.PHONY: test

examples/example.ipynb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
"from giskard_hub.client import HubClient\n",
1818
"\n",
1919
"# Initialise hub client\n",
20-
"hub = HubClient(\n",
21-
" api_key=\"YOUR_API_KEY\",\n",
22-
" hub_url=\"http://your-hub-instance.com/_api\"\n",
23-
")\n",
20+
"hub = HubClient(api_key=\"YOUR_API_KEY\", hub_url=\"http://your-hub-instance.com/_api\")\n",
2421
"\n",
2522
"# api_key and hub url can also be provided by setting env variable GSK_API_KEY and GSK_HUB_URL"
2623
]

0 commit comments

Comments
 (0)