-
Notifications
You must be signed in to change notification settings - Fork 2
Github actions to run tests on push and update coverage badge on merge to main #206
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
Conversation
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.
Pull Request Overview
This PR adds a GitHub Actions workflow to automatically run tests on push and pull request events. The workflow sets up a PostgreSQL/PostGIS database service and Django test environment to execute the project's test suite.
- Adds automated CI/CD testing with PostgreSQL database service
- Configures Django environment variables for testing
- Installs required system and Python dependencies before running tests
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| - name: Install system dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install gdal-bin -y |
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.
I tried running sudo apt-get install gcc make uwsgi uwsgi-plugin-python3 gdal-bin python3-gdal python3-dev build-essential -y and determined only gdal is necessary.
|
Looks like with |
.github/workflows/run-tests.yml
Outdated
| runs-on: ubuntu-latest | ||
| services: | ||
| postgres: | ||
| image: postgis/postgis:14-3.1-alpine |
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.
I chose the image version from what is in docker-compose.yml. Happy to adjust if folks prefer a different version.
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.
Is there a postgis/postgis:14-3.2-alpine?
Looking at our demo server, we have PostgreSQL 14 with PostGIS 3.2.0.
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.
Good call on having the tests run using the same db version as the demo server! I updated to use the image for that version.
|
also, the asana github action worked since I linked an asana ticket in the description 🎉 |
|
🚧 I'm going to attempt to get a badge running with the test coverage, so i'll convert this branch to draft 🚧 |
It is possible to submit a PR to a branch that has commits/code that are not available on the 'pushing' branch, so the tests would not be redundant in that case. I would want to know that the tests pass before accepting a PR. I recommend leaving both in place. |
rhodges
left a comment
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.
LGTM - I recommend seeing if we can explicitly run the tests withn PostGIS 3.2, but I'm happy enough with what's here.
| cd TEKDB && coverage run manage.py test TEKDB.tests | ||
| coverage json | ||
|
|
||
| - name: Access Coverage Stat |
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.
got a lot of inspiration on how to make and update the coverage badge from this article
asana task
Includes:
mainto have the badge reflect the coverage on themainbranch.Added this page to the wiki as part of this work: https://github.com/Ecotrust/TEKDB/wiki/Running-tests