Skip to content

Merge pull request #105 from LukePeltier/renovate/codecov-codecov-act… #249

Merge pull request #105 from LukePeltier/renovate/codecov-codecov-act…

Merge pull request #105 from LukePeltier/renovate/codecov-codecov-act… #249

Workflow file for this run

name: CI Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.9]
services:
mysql:
image: mariadb:latest
env:
MYSQL_ROOT_PASSWORD: ${{secrets.MYSQLPW}}
MYSQL_DATABASE: tenmansstatistics
ports:
- 3306:3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
env:
DJANGO_SETTINGS_MODULE: LukeWebsite.settings.testing
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Verify MariaDB connection
run: |
docker ps
sudo mysql -h localhost -P 3306 --protocol=tcp -e 'SHOW DATABASES' -uroot --password=${{secrets.MYSQLPW}}
- name: Install Dependencies
working-directory: ./src
run: |
python -m pip install --upgrade pip
pip install pip-tools
pip-sync
- name: Write DB Conf File
working-directory: ./src/LukeWebsite
env:
DB_CONF: ${{ secrets.DB_CONF }}
run: |
mkdir ./privateSettings
echo "$DB_CONF" >> ./privateSettings/db.cnf
- name: Write API Key File
working-directory: ./src/LukeWebsite/tenMans
env:
API_FILE: ${{ secrets.API_KEY }}
run: |
mkdir ./conf
echo "$API_FILE" >> ./conf/api.ini
- name: Build Objects
working-directory: ./src/LukeWebsite
run: |
python manage.py migrate --settings=LukeWebsite.settings.testing
python manage.py collectstatic --noinput --settings=LukeWebsite.settings.testing
- name: Run Tests
working-directory: ./src/LukeWebsite
run: |
pytest
- name: Upload Code Coverage
uses: codecov/[email protected]
with:
file: ./src/LukeWebsite/coverage.xml
flags: unittests # optional
fail_ci_if_error: true
verbose: true