Merge pull request #31 from Xpirix/form_resubmission #80
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: pr-test | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- '3.7' | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Checkout | |
uses: actions/checkout@master | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('REQUIREMENTS-dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Python requirements | |
run: pip install -r REQUIREMENTS-dev.txt | |
- name: Run flake8 | |
run: flake8 --config setup.cfg | |
test: | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
defaults: | |
run: | |
working-directory: dockerize | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate the .env file | |
run: cp .env.template .env | |
- name: Run docker-compose build | |
run: docker compose build | |
- name: Run the containers | |
run: docker compose up -d db devweb | |
- name: Wait for the containers to start | |
run: sleep 15 | |
- name: Run test | |
run: | | |
docker compose exec -T devweb bash -c ' | |
set -e # Exit immediately if any command fails | |
python manage.py makemigrations && | |
python manage.py migrate && | |
python manage.py test | |
' |