-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from mitodl/jkachel/add-ci-actions
Adds some CI actions back in
- Loading branch information
Showing
7 changed files
with
570 additions
and
313 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: CI | ||
on: [push] | ||
jobs: | ||
python-tests: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
# Label used to access the service container | ||
db: | ||
# Docker Hub image | ||
image: postgres:16 | ||
# Set health checks to wait until postgres has started | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres # pragma: allowlist secret | ||
POSTGRES_DB: postgres | ||
ports: | ||
- 5432:5432 | ||
|
||
redis: | ||
image: redis:5.0.14 | ||
ports: | ||
- 6379:6379 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: update apt | ||
run: sudo apt-get update -y | ||
|
||
- name: Apt install | ||
run: cat Aptfile | sudo xargs apt-get install | ||
|
||
- name: Install poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.5.1 | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12.1" | ||
cache: "poetry" | ||
|
||
- name: Validate lockfile | ||
run: poetry lock --check | ||
|
||
- name: Install dependencies | ||
run: poetry install --no-interaction | ||
|
||
- name: Lint | ||
run: poetry run ruff --extend-ignore=D1 $(git ls-files '*.py') | ||
|
||
- name: Tests | ||
run: | | ||
export MEDIA_ROOT="$(mktemp -d)" | ||
./scripts/test/python_tests.sh | ||
env: | ||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres # pragma: allowlist secret | ||
CELERY_TASK_ALWAYS_EAGER: "True" | ||
CELERY_BROKER_URL: redis://localhost:6379/4 | ||
CELERY_RESULT_BACKEND: redis://localhost:6379/4 | ||
MITOL_UE_COOKIE_NAME: "mitolue" | ||
MITOL_UE_COOKIE_DOMAIN: "odl.local" | ||
MITOL_UE_BASE_URL: "http://localhost:8073" | ||
MITOL_UE_HOSTNAME: "ue.odl.local" | ||
MITOL_UE_JWT_SECRET: "" | ||
MITOL_UE_USE_S3: "False" | ||
MITOL_UE_DB_DISABLE_SSL: "True" | ||
|
||
- name: Upload coverage to CodeCov | ||
uses: codecov/[email protected] | ||
with: | ||
file: ./coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.