Skip to content

Commit 3f6dd1e

Browse files
committed
Added GH Action which runs make check
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
1 parent d38f0af commit 3f6dd1e

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

.github/workflows/make-check.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This workflow installs the necessary dependencies, runs make check, and
2+
# checks if there are any edits. It should be very similar to what developers
3+
# are expected to do locally. We want to ensure that all tests pass (make
4+
# check succeeds) and that there is no additional formatting / untracked
5+
# files generated.
6+
#
7+
# Note that make check is a bit special in this repo, it has some things you
8+
# might not expect:
9+
# 1. It doesn't only run tests, it also runs formatters and linters
10+
# 2. It installs the CFEngine CLI, so that shell tests will work
11+
12+
name: Run make check
13+
on:
14+
push:
15+
branches: [main]
16+
pull_request:
17+
branches: [main]
18+
permissions:
19+
contents: read
20+
jobs:
21+
check:
22+
runs-on: ubuntu-24.04
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
python-version: ["3.12"]
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
python -m pip install uv
37+
sudo apt-get install npm
38+
npm install --global prettier
39+
- name: Run make check
40+
run: |
41+
make check
42+
- name: See if there are changes
43+
run: |
44+
git diff --exit-code
45+
git ls-files --other --directory --exclude-standard | sed q1

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
.PHONY: default format lint install check
1+
.PHONY: default format lint install check venv
22

33
default: check
44

5-
format:
5+
venv:
6+
uv venv --clear
7+
uv sync
8+
9+
format: venv
610
uv tool run black .
711
prettier . --write
812

9-
lint:
13+
lint: venv
1014
uv tool run black --check .
1115
uv tool run flake8 src/ --ignore=E203,W503,E722,E731 --max-complexity=100 --max-line-length=160
1216
uv tool run pyflakes src/
@@ -15,7 +19,7 @@ lint:
1519
install:
1620
pipx install --force --editable .
1721

18-
check: format lint install
22+
check: venv format lint install
1923
uv run pytest
2024
bash tests/run-lint-tests.sh
2125
bash tests/run-format-tests.sh

0 commit comments

Comments
 (0)