untrack settings file #88
Workflow file for this run
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
on: | |
push: | |
paths: | |
- '.github/workflows/backend.yaml' | |
- '.github/workflows/init_db.sql' | |
- 'backend/langate/**' | |
- 'backend/requirements.txt' | |
- 'backend/*.sh' | |
- 'backend/locale/**' | |
- 'backend/Dockerfile*' | |
jobs: | |
linting: | |
env: | |
PYLINT_MINSCORE: 8.0 | |
runs-on: ubuntu-22.04 | |
steps: | |
- run: echo "### Linting" >> $GITHUB_STEP_SUMMARY | |
- uses: actions/checkout@v3 | |
# Install Python 3.12 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
# Set the environment up | |
- run: python3 -m venv env | |
working-directory: backend | |
- run: source env/bin/activate | |
working-directory: backend | |
# Install dependencies | |
- name: Install dependencies | |
run: pip3 install -r requirements.txt | |
working-directory: backend | |
- name: Install pylint and pylint-django | |
run: pip3 install pylint==3.0.3 pylint-django | |
working-directory: backend | |
# Run lints | |
- name: Run linter evaluation | |
shell: bash | |
run: | | |
pylint --fail-under ${{ env.PYLINT_MINSCORE }} --load-plugins pylint_django --django-settings-module langate.settings ./langate | tee >(grep "Your code has been" | sed 's/^Your code has been rated at \(.*\)\/10.*/PYLINT_SCORE=\1/' >> "$GITHUB_ENV") | |
working-directory: backend | |
# Summary | |
- name: Summary | |
run: echo ::notice title=Pylint Score::Your \`pylint\` score is ${{ env.PYLINT_SCORE }} | |
- run: echo Your \`pylint\` score is ${{ env.PYLINT_SCORE }} >> "$GITHUB_STEP_SUMMARY" | |
unit-tests: | |
defaults: | |
run: | |
working-directory: backend | |
if: always() | |
needs: [linting] | |
runs-on: ubuntu-22.04 | |
env: | |
DB_NAME: insalan | |
DB_USER: insalan | |
DB_PASS: insalan | |
DB_HOST: "127.0.0.1" | |
DB_PORT: 5432 | |
services: | |
postgresql: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: ${{ env.DB_PASS }} | |
POSTGRES_USER: ${{ env.DB_USER }} | |
POSTGRES_DB: ${{ env.DB_NAME }} | |
ports: | |
- "5432:5432" | |
options: --health-cmd pg_isready --health-interval 1s --health-timeout 5s --health-retries 10 | |
steps: | |
- uses: actions/checkout@v3 | |
# Install Python 3.12 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
# Set the environment up | |
- run: python3 -m venv env | |
- run: source env/bin/activate | |
# Install dependencies | |
- run: pip3 install -r requirements.txt | |
# Initialize the database | |
- run: psql postgresql://${{ env.DB_USER }}:${{ env.DB_PASS }}@${{ env.DB_HOST }}:${{ env.DB_PORT }}/${{ env.DB_NAME }} -f ../.github/workflows/init_db.sql | |
# Prepare database | |
- run: python3 manage.py makemigrations | |
- run: python3 manage.py migrate | |
- run: python3 manage.py test --parallel auto |