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+ --container-architecture linux/arm64
2+ -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 @@ -62,4 +62,13 @@ test: ## Start local PostgreSQL container and run all tests
6262 E2E_PG_DB=$(PG_TEST_DB ) \
6363 $(VENV_DIR ) /bin/$(PYTHON_CMD ) -m pytest -vv
6464
65- .PHONY : usage install install-test install-lint clean publish test lint
65+ ACT_CMD ?= act
66+ ACT_WORKFLOW ?= .github/workflows/tests.yml
67+ ACT_JOB ?= tests
68+ ACT_PULL ?= false
69+ ACT_CONTAINER_ARCH ?= linux/arm64
70+
71+ test-act : # # Run the CI test workflow locally with act
72+ $(ACT_CMD ) -W $(ACT_WORKFLOW ) -j $(ACT_JOB ) --pull=$(ACT_PULL ) --container-architecture $(ACT_CONTAINER_ARCH )
73+
74+ .PHONY : usage install install-test install-lint clean publish test test-act lint
Original file line number Diff line number Diff line change @@ -89,3 +89,25 @@ Run the full local test suite (starts a disposable PostgreSQL container automati
8989``` bash
9090make test
9191```
92+
93+ Run the GitHub Actions test workflow locally with [ ` act ` ] ( https://github.com/nektos/act ) :
94+
95+ On macOS, install ` act ` with Homebrew:
96+
97+ ``` bash
98+ brew install act
99+ ```
100+
101+ ``` bash
102+ make test-act
103+ ```
104+
105+ Useful overrides for local runs:
106+
107+ ``` bash
108+ # Refresh images explicitly when needed
109+ make test-act ACT_PULL=true
110+
111+ # Match GitHub runner architecture on Apple Silicon (slower)
112+ make test-act ACT_CONTAINER_ARCH=linux/amd64
113+ ```
Original file line number Diff line number Diff line change @@ -60,3 +60,19 @@ python -m pytest tests/test_plugins.py -vv
6060```
6161
6262Requires PostgreSQL to be running with the ` E2E_PG_* ` env vars set (see section 2).
63+
64+ ## 4) Run the GitHub workflow locally (` act ` )
65+
66+ ``` bash
67+ make test-act
68+ ```
69+
70+ Useful overrides:
71+
72+ ``` bash
73+ # Refresh workflow images
74+ make test-act ACT_PULL=true
75+
76+ # Match GitHub x86_64 runner architecture (slower on Apple Silicon)
77+ make test-act ACT_CONTAINER_ARCH=linux/amd64
78+ ```
You can’t perform that action at this time.
0 commit comments