Skip to content

Commit fa51d0c

Browse files
Merge pull request #2 from pavelacamposp/feature/ci-workflow
Add CI workflow using GitHub Actions
2 parents 197c0bb + 56ed2e8 commit fa51d0c

File tree

7 files changed

+102
-3
lines changed

7 files changed

+102
-3
lines changed

.github/workflows/code_quality.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Code Quality
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
branches: ["main"]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
container: python:3.10-slim
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Install system dependencies
19+
run: |
20+
apt-get update
21+
apt-get install -y git build-essential
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements-dev.txt
27+
28+
- name: Lint with ruff
29+
run: ruff check --output-format=github --line-length 79
30+
31+
- name: Run mypy
32+
run: |
33+
mypy \
34+
--ignore-missing-imports \
35+
--disallow-untyped-defs \
36+
--strict-optional \
37+
--warn-unused-ignores \
38+
--disable-error-code type-arg \
39+
.
40+
41+
- name: YAML Lint
42+
run: yamllint --strict .

.github/workflows/tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Tests
3+
4+
on:
5+
workflow_run:
6+
workflows: ["Code Quality"]
7+
types:
8+
- completed
9+
10+
jobs:
11+
run_tests_if_successful_build:
12+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python:
17+
- version: "3.10"
18+
image: "python:3.10-slim"
19+
- version: "3.11"
20+
image: "python:3.11-slim"
21+
- version: "3.12"
22+
image: "python:3.12-slim"
23+
container:
24+
image: ${{ matrix.python.image }}
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Install system dependencies
31+
run: |
32+
apt-get update
33+
apt-get install -y git build-essential
34+
35+
- name: Install dependencies
36+
run: |
37+
python -m pip install --upgrade pip
38+
pip install -r requirements-dev.txt
39+
40+
- name: Run tests with coverage
41+
run: |
42+
coverage run -m pytest --maxfail=2 --disable-warnings tests/
43+
coverage report

.pre-commit-config.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@ repos:
3030
hooks:
3131
- id: yamllint
3232
args: ["--strict"]
33-
exclude: ^\.github/workflows/
33+
- repo: https://github.com/rhysd/actionlint
34+
rev: v1.7.7
35+
hooks:
36+
- id: actionlint

.yamllint.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
extends: default
3+
4+
ignore: |
5+
.*/*
6+
venv/*

requirements-dev.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
git+https://github.com/pavelacamposp/direct_data_driven_mpc.git
22
genesis_world==0.2.1
3-
numpy==2.2.4
3+
numpy>=1.26.4
44
torch==2.6.0
55
pre-commit
66
ruff
77
mypy
8+
yamllint
9+
pytest
10+
coverage

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
git+https://github.com/pavelacamposp/direct_data_driven_mpc.git
22
genesis_world==0.2.1
3-
numpy==2.2.4
3+
numpy>=1.26.4
44
torch==2.6.0

tests/test_placeholder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def test_placeholder() -> None:
2+
assert True

0 commit comments

Comments
 (0)