-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ci): add GitHub Actions workflow and act support #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: unc-472-local-tests
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| -P ubuntu-24.04=catthehacker/ubuntu:act-latest |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: Run Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| tests: | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| services: | ||
| postgres: | ||
| image: postgres:16 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Any particular reason for using version 16? |
||
| env: | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_PASSWORD: postgres | ||
| POSTGRES_DB: postgres | ||
| ports: | ||
| - 5432:5432 | ||
| options: >- | ||
| --health-cmd "pg_isready -U postgres" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
Comment on lines
+22
to
+26
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Are the health checks of the postgres image not enough? |
||
|
|
||
| env: | ||
| E2E_PG_HOST: 127.0.0.1 | ||
| E2E_PG_PORT: 5432 | ||
| E2E_PG_USER: postgres | ||
| E2E_PG_PASSWORD: postgres | ||
| E2E_PG_DB: postgres | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y postgresql-client | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install pytest pytest-timeout | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| python -m pytest -vv | ||
|
Comment on lines
+51
to
+53
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: As I mentioned on #13 if we clean up the make command, we could probably reuse |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,4 +63,13 @@ test: ## Start local PostgreSQL container and run all tests | |
| E2E_PG_DB=$(PG_TEST_DB) \ | ||
| $(VENV_DIR)/bin/$(PYTHON_CMD) -m pytest -vv | ||
|
|
||
| .PHONY: usage install install-test install-lint clean publish test lint | ||
| ACT_CMD ?= act | ||
| ACT_WORKFLOW ?= .github/workflows/tests.yml | ||
| ACT_JOB ?= tests | ||
| ACT_PULL ?= false | ||
| ACT_CONTAINER_ARCH ?= linux/arm64 | ||
|
|
||
| test-act: ## Run the CI test workflow locally with act | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚀 |
||
| $(ACT_CMD) -W $(ACT_WORKFLOW) -j $(ACT_JOB) --pull=$(ACT_PULL) --container-architecture $(ACT_CONTAINER_ARCH) | ||
|
|
||
| .PHONY: usage install install-test install-lint clean publish test test-act lint | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also add a linting step?