File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ -P ubuntu-24.04=catthehacker/ubuntu:act-latest
Original file line number Diff line number Diff line change 1+ name : Run Tests
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - master
8+
9+ jobs :
10+ tests :
11+ runs-on : ubuntu-24.04
12+
13+ services :
14+ postgres :
15+ image : postgres:16
16+ env :
17+ POSTGRES_USER : postgres
18+ POSTGRES_PASSWORD : postgres
19+ POSTGRES_DB : postgres
20+ ports :
21+ - 5432:5432
22+ options : >-
23+ --health-cmd "pg_isready -U postgres"
24+ --health-interval 10s
25+ --health-timeout 5s
26+ --health-retries 5
27+
28+ env :
29+ E2E_PG_HOST : 127.0.0.1
30+ E2E_PG_PORT : 5432
31+ E2E_PG_USER : postgres
32+ E2E_PG_PASSWORD : postgres
33+ E2E_PG_DB : postgres
34+
35+ steps :
36+ - uses : actions/checkout@v4
37+
38+ - name : Set up Python
39+ uses : actions/setup-python@v5
40+ with :
41+ python-version : " 3.13"
42+
43+ - name : Install dependencies
44+ run : |
45+ sudo apt-get update
46+ sudo apt-get install -y postgresql-client
47+ python -m pip install --upgrade pip
48+ pip install -r requirements.txt
49+ pip install pytest pytest-timeout
50+
51+ - name : Run tests
52+ run : |
53+ python -m pytest -vv
54+
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ usage: ## Show this help
1717 @fgrep -h " ##" $(MAKEFILE_LIST ) | fgrep -v fgrep | sed -e ' s/\\$$//' | sed -e ' s/##//'
1818
1919install : # # Install dependencies in local virtualenv folder
20- (test ` which virtualenv` || $( PIP_CMD) install virtualenv) && \
20+ (test ` which virtualenv` || $( PIP_CMD) install --user virtualenv) && \
2121 (test -e $( VENV_DIR) || virtualenv $( VENV_OPTS) $( VENV_DIR) ) && \
2222 ($( VENV_RUN) && $( PIP_CMD) install --upgrade pip) && \
2323 (test ! -e requirements.txt || ($( VENV_RUN) ; $( PIP_CMD) install -r requirements.txt))
@@ -63,4 +63,13 @@ test: ## Start local PostgreSQL container and run all tests
6363 E2E_PG_DB=$(PG_TEST_DB ) \
6464 $(VENV_DIR ) /bin/$(PYTHON_CMD ) -m pytest -vv
6565
66- .PHONY : usage install install-test install-lint clean publish test lint
66+ ACT_CMD ?= act
67+ ACT_WORKFLOW ?= .github/workflows/tests.yml
68+ ACT_JOB ?= tests
69+ ACT_PULL ?= false
70+ ACT_CONTAINER_ARCH ?= linux/arm64
71+
72+ test-act : # # Run the CI test workflow locally with act
73+ $(ACT_CMD ) -W $(ACT_WORKFLOW ) -j $(ACT_JOB ) --pull=$(ACT_PULL ) --container-architecture $(ACT_CONTAINER_ARCH )
74+
75+ .PHONY : usage install install-test install-lint clean publish test test-act lint
Original file line number Diff line number Diff line change @@ -148,3 +148,27 @@ python -m pytest tests/test_plugins.py -vv
148148```
149149
150150If PostgreSQL is not reachable, tests fail fast at startup.
151+
152+ #### 3) Run CI locally with ` act `
153+
154+ Run the GitHub Actions test workflow locally with [ ` act ` ] ( https://github.com/nektos/act ) :
155+
156+ On macOS, install ` act ` with Homebrew:
157+
158+ ``` bash
159+ brew install act
160+ ```
161+
162+ ``` bash
163+ make test-act
164+ ```
165+
166+ Useful overrides for local runs:
167+
168+ ``` bash
169+ # Refresh images explicitly when needed
170+ make test-act ACT_PULL=true
171+
172+ # Match GitHub runner architecture on Apple Silicon (slower)
173+ make test-act ACT_CONTAINER_ARCH=linux/amd64
174+ ```
You can’t perform that action at this time.
0 commit comments