Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Merge pull request #234 from mmoomocow/dependabot/pip/pytest-django-4… #57

Merge pull request #234 from mmoomocow/dependabot/pip/pytest-django-4…

Merge pull request #234 from mmoomocow/dependabot/pip/pytest-django-4… #57

Workflow file for this run

name: Main branch testing
on:
push:
branches: [ main ]
jobs:
django_test:
name: pytest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.10.5, 3.11.2]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
-
name: Run tests
env:
DJANGO_SETTINGS_MODULE: commendationSite.settings_CI
MICROSOFT_AUTH_CLIENT_ID: ${{ secrets.MICROSOFT_AUTH_CLIENT_ID }}
MICROSOFT_AUTH_CLIENT_SECRET: ${{ secrets.MICROSOFT_AUTH_CLIENT_SECRET }}
run: |
python manage.py test --failfast --noinput --verbosity=3
coverage:
name: Check test coverage
runs-on: ubuntu-latest
needs: django_test
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10.5
uses: actions/setup-python@v2
with:
python-version: 3.10.5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
- name: Run tests
env:
DJANGO_SETTINGS_MODULE: commendationSite.settings_CI
run: |
coverage run manage.py test --noinput
coverage combine
- name: Coverage Reports
run: |
coverage report -m
coverage xml
- name: Upload coverage as artifact
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.xml
- name: Report results to DeepSource
continue-on-error: true
run: |
coverage xml
curl https://deepsource.io/cli | sh
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
lint:
# Run isort and black to check for import order and code formatting
name: Lint
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10.5
uses: actions/setup-python@v2
with:
python-version: 3.10.5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
- name: Run isort
run: |
isort .
- name: Run black
run: |
black .
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "style: Format ${{ github.sha }}"
commit_options: '--no-verify --signoff'
# deploy:
# name: Deploy to dev
# runs-on: ubuntu-latest
# needs: [django_test, coverage, lint]
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Create SSH key
# run: |
# mkdir -p ~/.ssh/
# echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
# chmod 600 ~/.ssh/id_ed25519
# ssh-keyscan -t rsa ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
# shell: bash
# - name: Deploy to dev environment
# run: |
# ssh -i ~/.ssh/id_ed25519 ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} -p ${{ secrets.SSH_PORT }} "cd /var/www/ && ./update-DCS.sh"
# shell: bash