Merge pull request #37 from jackleland/master #5
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
name: Continuous Integration | |
on: [push, pull_request] | |
jobs: | |
linting: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flake8 | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
testing-docker: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build test containers | |
run: | | |
# Copy the sample environment file and build the containers | |
cp .env.sample .env | |
# In the future we can populate the .env file with secrets, none needed for now | |
docker compose build | |
- name: Start db container | |
run: docker compose up db | |
- name: Start test container | |
run: | | |
docker compose up tests --exit-code-from tests | |
- name: Stop containers | |
if: always() | |
run: docker compose down | |
testing-pip: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y apache2 apache2-dev | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install . | |
- name: Set initial environment | |
run: | | |
# Copy the sample environment file | |
cp .env.sample .env | |
- name: Run tests | |
run: | | |
python psat_server_web/atlas/manage.py makemigrations --noinput | |
python psat_server_web/atlas/manage.py test --noinput |