-
Notifications
You must be signed in to change notification settings - Fork 11
110 lines (96 loc) · 3.53 KB
/
continuous-integration.yml
File metadata and controls
110 lines (96 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Based on https://github.com/actions/starter-workflows/blob/main/ci/django.yml
name: Continuous Integration
on:
pull_request:
branches:
- "*"
# The following is needed to run tests upon direct push to dev or master
push:
branches: [dev, master]
env:
PYTHON_TARGET: 3.11
# Django
DJANGO_SETTINGS_MODULE: tcf_core.settings.ci
SECRET_KEY: ${{ secrets.SECRET_KEY }}
DEBUG: 1
# database
DB_NAME: tcf_db # arbitrary string
DB_USER: postgres # default user
DB_PASSWORD: postgres # default password
DB_HOST: localhost # required for GitHub Actions
DB_PORT: 5432 # default port
# social-auth-app-django
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY: ${{ secrets.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY }}
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET: ${{ secrets.SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET }}
# email for account verification
EMAIL_HOST_USER: ${{ secrets.EMAIL_HOST_USER }}
EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }}
# review drive account information
REVIEW_DRIVE_ID: ${{ secrets.REVIEW_DRIVE_ID }}
REVIEW_DRIVE_EMAIL: ${{ secrets.REVIEW_DRIVE_EMAIL }}
REVIEW_DRIVE_PASSWORD: ${{ secrets.REVIEW_DRIVE_PASSWORD }}
jobs:
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_TARGET }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_TARGET }}
- name: Install Python packages, excluding the unnecessary ones
run: |
python -m pip install --upgrade pip
sed -i '/\(coverage\|types\-tqdm\|black\|isort\|gunicorn\|django\-heroku\|uwsgi\)/d' requirements.txt
pip install -r requirements.txt
- name: Run pylint
run: |
export PYTHONPATH="$(pwd)"
pylint --django-settings-module=${{ env.DJANGO_SETTINGS_MODULE }} --jobs=0 --load-plugins pylint_django tcf_website tcf_core
django:
runs-on: ubuntu-latest
outputs:
code-coverage: ${{ steps.coverage.outputs.percentage }}
services:
postgres:
image: postgres:15.4
env:
POSTGRES_USER: ${{ env.DB_USER}}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_DB: ${{ env.DB_NAME }}
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_TARGET }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_TARGET }}
- name: Install Python packages, excluding the unnecessary ones
run: |
python -m pip install --upgrade pip
sed -i '/\(lint\|mypy\|types\-tqdm\|black\|isort\|gunicorn\|django\-heroku\|django\-stubs\|uwsgi\)/d' requirements.txt
pip install -r requirements.txt
- name: Migrations & Tests
run: |
envsubst < .config/.env.example > .env
python manage.py migrate
coverage run manage.py test
- name: Get code coverage
id: coverage
run: |
echo "::set-output name=percentage::$(coverage report | grep -o '[0-9]\+%' | tail -1)"
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 20
- name: Install npm packages
run: npm ci
- name: Run ESLint
run: npx eslint -c .config/.eslintrc.yml tcf_website/static/