Skip to content

Commit 159b831

Browse files
etienne-monierfabi1cazenave
authored andcommitted
A basic CI script to execute tests on push and pull request (#73)
authored-by: Etienne Monier <etienne.monier@csgroup.eu>
1 parent e79fbd3 commit 159b831

3 files changed

Lines changed: 60 additions & 2 deletions

File tree

.github/workflows/tests.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- "layouts/**"
7+
- "*.md"
8+
- "*.rst"
9+
10+
pull_request:
11+
paths-ignore:
12+
- "layouts/**"
13+
- "*.md"
14+
- "*.rst"
15+
16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
main:
25+
# We want to run on external PRs, but not on our own internal PRs as they'll be run
26+
# by the push to the branch. Without this if check, checks are duplicated since
27+
# internal PRs match both the push and pull_request events.
28+
if:
29+
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
30+
github.repository
31+
32+
strategy:
33+
matrix:
34+
os: [ubuntu-latest, macos-latest, windows-latest]
35+
python-version: ["3.8", "3.9", "3.10", "3.11"]
36+
37+
runs-on: ${{ matrix.os }}
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Set up Python ${{ matrix.python-version }}
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version: ${{ matrix.python-version }}
46+
47+
- name: Install dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install ".[dev]"
51+
52+
- name: Run tests
53+
run: |
54+
python -m kalamine.cli make layouts/*.toml
55+
pytest

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ dev: ## Install a development environment
99

1010

1111
test: ## Run tests
12-
# python3 -m kalamine.cli make layouts/*.toml
13-
kalamine make layouts/*.toml
12+
python3 -m kalamine.cli make layouts/*.toml
1413
pytest
1514

1615
publish: test ## Publish package

kalamine/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,7 @@ def version():
206206
"""Show version number and exit."""
207207

208208
print(f"kalamine { metadata.version('kalamine') }")
209+
210+
211+
if __name__ == "__main__":
212+
cli()

0 commit comments

Comments
 (0)