-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get pr_checks_backend.yml working (#756)
* Set up pr_checks_backend.yml to run black formatter * Also run flake8 linting * Check if main docker container builds correctly * Check if postgres container runs correctly * update vscode/settings.json to match formatting + linting
- Loading branch information
Showing
2 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
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,81 @@ | ||
name: PR Checks Backend | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- staging | ||
paths: | ||
- "data/**" | ||
- "Dockerfile-pg" | ||
- "init_pg.sql" | ||
- "docker-compose.yml" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Set up Docker Compose | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11.4" | ||
|
||
- name: Run Black Formatter in Docker | ||
run: | | ||
cd data | ||
docker-compose run --rm formatter | ||
continue-on-error: true | ||
|
||
- name: Run Flake8 | ||
run: | | ||
cd data | ||
pip install flake8 | ||
flake8 . | ||
continue-on-error: true | ||
|
||
- name: Install dependencies and build Docker images | ||
run: | | ||
cd data | ||
docker-compose pull | ||
docker-compose build | ||
- name: Run vacant-lots-proj | ||
run: | | ||
cd data | ||
docker-compose up -d vacant-lots-proj | ||
continue-on-error: true | ||
|
||
- name: Build and check Postgres container | ||
run: | | ||
cd data | ||
docker-compose build postgres | ||
continue-on-error: true | ||
|
||
- name: Check build status | ||
if: failure() | ||
run: | | ||
echo "The vacant-lots-proj or postgres container failed to build and run." | ||
exit 1 | ||
- name: Report success | ||
if: success() | ||
run: echo "The vacant-lots-proj and postgres container built and ran successfully." | ||
|
||
- name: Check formatter and linter status | ||
if: failure() | ||
run: | | ||
echo "Formatting or linting issues found. Please fix the issues." | ||
exit 1 | ||
- name: Formatter and linter success | ||
if: success() | ||
run: echo "Formatting and linting passed successfully." |
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 |
---|---|---|
@@ -1,13 +1,21 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"python.analysis.extraPaths": ["${workspaceFolder}/data/src","${workspaceFolder}/data/src/awkde"], | ||
"python.analysis.extraPaths": [ | ||
"${workspaceFolder}/data/src", | ||
"${workspaceFolder}/data/src/awkde" | ||
], | ||
"python.testing.pytestEnabled": true, | ||
"python.testing.cwd": "${workspaceFolder}/data/src", | ||
"[python]": { | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "explicit" | ||
"source.organizeImports": "explicit" | ||
}, | ||
} | ||
"editor.defaultFormatter": "ms-python.black-formatter" | ||
}, | ||
"python.formatting.provider": "black", | ||
"python.linting.flake8Enabled": true, | ||
"python.linting.enabled": true, | ||
"python.linting.flake8Args": ["--max-line-length=88"] | ||
} |