Add Docker image build #37
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: test | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
jobs: | |
test-ubuntu: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
env: | |
DJANGO_DEBUG: "False" | |
DJANGO_SECRET_KEY: "random garbage" | |
DJANGO_ALLOWED_HOSTS: "localhost 127.0.0.1" | |
POSTGRES_DATABASE: main-db | |
POSTGRES_TEST_DATABASE: test-db | |
POSTGRES_USER: test | |
POSTGRES_PASSWORD: test | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- uses: huaxk/postgis-action@v1 | |
with: | |
postgresql version: '11' # See https://hub.docker.com/r/mdillon/postgis for available versions, if it is not specified, use the default value 'latest' | |
postgresql password: 'test' # This environment variable sets the superuser password for PostgreSQL, maybe string or secrets, the default superuser is defined by the input environment variable: postgresql user. | |
postgresql user: 'test' # This optional environment variable is used in conjunction with postgresql password to set a user and its password. This variable will create the specified user with superuser power and a database with the same name. If it is not specified, then the default user of 'postgres' will be used. | |
postgresql db: 'test-db' # This optional environment variable can be used to define a different name for the default database that is created when the image is first started. If it is not specified, then the value of postgresql user will be used. | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install libpq-dev libgdal-dev libproj-dev libgeos-dev | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m venv env | |
source env/bin/activate | |
pip install -r requirements.txt | |
pip install -r web/scrapers/ParkAPI2_sources/requirements.txt | |
- name: Run tests | |
run: | | |
source env/bin/activate | |
cd web | |
# make sure importing all scraper modules works | |
./manage.py pa_scrape list -v 2 | |
./manage.py test --keepdb | |