2020-12-18 02:52:27 +03:00
|
|
|
name: Continuous Integration
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-11-29 21:24:25 +03:00
|
|
|
branches: ["main"]
|
2021-01-15 23:05:31 +03:00
|
|
|
paths-ignore:
|
|
|
|
- maintenance/**/*.*
|
2020-12-18 02:52:27 +03:00
|
|
|
pull_request:
|
2021-01-15 23:05:31 +03:00
|
|
|
paths-ignore:
|
|
|
|
- maintenance/**/*.*
|
2020-12-18 02:52:27 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test_node:
|
|
|
|
name: Node CI
|
2022-11-23 21:02:54 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-18 02:52:27 +03:00
|
|
|
env:
|
2021-04-07 21:08:09 +03:00
|
|
|
ALLOWED_HOSTS: localhost,mozfest.localhost,default-site.com,secondary-site.com
|
2020-12-18 02:52:27 +03:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
NETWORK_SITE_URL: https://foundation.mozilla.org
|
|
|
|
PULSE_API_DOMAIN: https://network-pulse-api-production.herokuapp.com
|
|
|
|
PULSE_DOMAIN: https://www.mozillapulse.org
|
|
|
|
steps:
|
2023-01-14 09:07:12 +03:00
|
|
|
- uses: actions/checkout@v3
|
2023-01-14 04:02:14 +03:00
|
|
|
- uses: actions/setup-node@v3
|
2022-01-28 04:08:36 +03:00
|
|
|
with:
|
2024-01-31 17:22:25 +03:00
|
|
|
node-version: 20
|
2022-01-28 04:08:36 +03:00
|
|
|
cache: "npm"
|
|
|
|
- name: Install Node Dependencies
|
|
|
|
run: npm ci
|
2022-11-11 23:13:07 +03:00
|
|
|
- name: Run linting
|
|
|
|
run: npm run lint
|
2020-12-18 02:52:27 +03:00
|
|
|
|
|
|
|
test_wagtail:
|
|
|
|
name: Wagtail CI
|
2022-11-23 21:02:54 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-18 02:52:27 +03:00
|
|
|
services:
|
|
|
|
postgres:
|
2024-01-25 17:44:46 +03:00
|
|
|
image: postgres:15
|
2020-12-18 02:52:27 +03:00
|
|
|
env:
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: network
|
|
|
|
ports:
|
2022-01-28 04:08:36 +03:00
|
|
|
- 5432:5432
|
2020-12-18 02:52:27 +03:00
|
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
env:
|
|
|
|
ALLOWED_HOSTS: localhost,mozfest.localhost,default-site.com,secondary-site.com
|
2023-10-27 03:38:06 +03:00
|
|
|
BASKET_URL: https://basket-dev.allizom.org
|
2020-12-18 02:52:27 +03:00
|
|
|
CONTENT_TYPE_NO_SNIFF: True
|
|
|
|
CORS_ALLOWED_ORIGINS: "*"
|
2020-12-23 02:04:04 +03:00
|
|
|
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
2020-12-18 02:52:27 +03:00
|
|
|
DATABASE_URL: postgres://postgres:postgres@localhost:5432/network
|
|
|
|
DEBUG: True
|
|
|
|
DJANGO_SECRET_KEY: secret
|
|
|
|
DOMAIN_REDIRECT_MIDDLEWARE_ENABLED: False
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2023-11-29 21:51:22 +03:00
|
|
|
NETWORK_SITE_URL: http://localhost:8000
|
2020-12-18 02:52:27 +03:00
|
|
|
PIPENV_VERBOSITY: -1
|
|
|
|
PULSE_API_DOMAIN: https://network-pulse-api-production.herokuapp.com
|
|
|
|
PULSE_DOMAIN: https://www.mozillapulse.org
|
|
|
|
RANDOM_SEED: 530910203
|
|
|
|
SET_HSTS: False
|
|
|
|
SSL_REDIRECT: False
|
|
|
|
TARGET_DOMAINS: foundation.mozilla.org
|
|
|
|
USE_S3: False
|
|
|
|
X_FRAME_OPTIONS: DENY
|
|
|
|
XSS_PROTECTION: True
|
|
|
|
steps:
|
2023-01-14 09:07:12 +03:00
|
|
|
- uses: actions/checkout@v3
|
2022-11-23 20:57:20 +03:00
|
|
|
- uses: actions/setup-python@v4
|
2022-01-28 04:08:36 +03:00
|
|
|
with:
|
2024-01-31 16:44:42 +03:00
|
|
|
python-version: 3.11
|
2022-01-28 04:08:36 +03:00
|
|
|
cache: "pip"
|
2023-01-14 04:02:14 +03:00
|
|
|
- uses: actions/setup-node@v3
|
2022-01-28 04:08:36 +03:00
|
|
|
with:
|
2024-01-31 17:22:25 +03:00
|
|
|
node-version: 20
|
2022-01-28 04:08:36 +03:00
|
|
|
- name: Install Python Dependencies
|
|
|
|
run: pip install -r requirements.txt -r dev-requirements.txt
|
|
|
|
- name: Install Node Dependencies
|
|
|
|
run: npm ci
|
|
|
|
- name: Install additional tooling
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y gettext
|
|
|
|
- name: Preroll
|
|
|
|
run: |
|
|
|
|
npm run build
|
|
|
|
python network-api/manage.py collectstatic --no-input --verbosity 0
|
2023-04-25 14:08:26 +03:00
|
|
|
python network-api/manage.py check
|
|
|
|
python network-api/manage.py makemigrations --check --dry-run
|
2023-04-25 14:21:23 +03:00
|
|
|
python network-api/manage.py migrate --no-input
|
2022-01-28 04:08:36 +03:00
|
|
|
python network-api/manage.py block_inventory
|
|
|
|
python network-api/manage.py compilemessages
|
2022-11-12 00:21:55 +03:00
|
|
|
- name: Run linting
|
2022-11-12 01:35:59 +03:00
|
|
|
run: |
|
2022-11-29 21:24:25 +03:00
|
|
|
flake8 .
|
2022-11-29 21:36:38 +03:00
|
|
|
isort . --check-only
|
2022-11-12 01:35:59 +03:00
|
|
|
black . --check
|
2023-02-02 20:07:33 +03:00
|
|
|
djlint . --lint
|
2023-01-17 18:06:55 +03:00
|
|
|
# Skipping djlint format checking because it has consistency issues and issues with blocktrans.
|
|
|
|
# This should change when formatting is moved to a version using and AST.
|
|
|
|
# See also: https://github.com/Riverside-Healthcare/djLint/issues/493
|
|
|
|
# djlint . --check
|
|
|
|
#
|
|
|
|
# Using djhtml indent check in the meantime.
|
|
|
|
djhtml -c maintenance/ network-api/
|
2022-11-12 00:21:55 +03:00
|
|
|
- name: Run type checks
|
|
|
|
run: mypy network-api
|
2022-01-28 04:08:36 +03:00
|
|
|
- name: Run Tests
|
2023-12-14 03:23:37 +03:00
|
|
|
run: cd network-api && pytest -n auto -v --ds=networkapi.settings -cov=network-api/networkapi --cov-report=term-missing
|
2020-12-18 02:52:27 +03:00
|
|
|
|
2021-12-16 02:31:44 +03:00
|
|
|
test_integration:
|
|
|
|
name: Integration testing
|
2022-11-23 21:02:54 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2021-12-16 02:31:44 +03:00
|
|
|
services:
|
|
|
|
postgres:
|
2024-01-25 17:44:46 +03:00
|
|
|
image: postgres:15
|
2021-12-16 02:31:44 +03:00
|
|
|
env:
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: network
|
|
|
|
ports:
|
2022-01-28 04:08:36 +03:00
|
|
|
- 5432:5432
|
2021-12-16 02:31:44 +03:00
|
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
env:
|
2022-12-13 21:19:45 +03:00
|
|
|
ALLOWED_HOSTS: 127.0.0.1,localhost,mozfest.localhost,default-site.com,secondary-site.com
|
2023-11-29 21:51:22 +03:00
|
|
|
BASKET_URL: https://basket-dev.allizom.org
|
2021-12-16 02:31:44 +03:00
|
|
|
CONTENT_TYPE_NO_SNIFF: True
|
|
|
|
CORS_ALLOWED_ORIGINS: "*"
|
|
|
|
DATABASE_URL: postgres://postgres:postgres@localhost:5432/network
|
|
|
|
DEBUG: True
|
|
|
|
DJANGO_SECRET_KEY: secret
|
|
|
|
DOMAIN_REDIRECT_MIDDLEWARE_ENABLED: False
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2023-11-29 21:51:22 +03:00
|
|
|
NETWORK_SITE_URL: http://localhost:8000
|
2021-12-16 02:31:44 +03:00
|
|
|
PIPENV_VERBOSITY: -1
|
|
|
|
PULSE_API_DOMAIN: https://network-pulse-api-production.herokuapp.com
|
|
|
|
PULSE_DOMAIN: https://www.mozillapulse.org
|
|
|
|
RANDOM_SEED: 530910203
|
|
|
|
SET_HSTS: False
|
|
|
|
SSL_REDIRECT: False
|
|
|
|
TARGET_DOMAINS: foundation.mozilla.org
|
|
|
|
USE_S3: False
|
|
|
|
X_FRAME_OPTIONS: DENY
|
|
|
|
XSS_PROTECTION: True
|
2023-06-01 20:29:11 +03:00
|
|
|
CSP_CONNECT_SRC: "*"
|
2024-03-25 22:09:00 +03:00
|
|
|
CSP_FONT_SRC: "'self' https://fonts.gstatic.com https://fonts.googleapis.com https://code.cdn.mozilla.net https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/fonts/ data: https://static.fundraiseup.com/common-fonts/"
|
2024-04-09 20:45:26 +03:00
|
|
|
CSP_IMG_SRC: "* data: blob: https://*.fundraiseup.com https://ucarecdn.com https://pay.google.com https://*.paypalobjects.com"
|
|
|
|
CSP_FRAME_SRC: "'self' https://www.google.com/recaptcha/ https://*.stripe.com https://pay.google.com https://*.paypal.com https://*.fundraiseup.com"
|
2024-03-25 22:09:00 +03:00
|
|
|
CSP_SCRIPT_SRC: "'self' 'unsafe-inline' https://www.google-analytics.com/analytics.js http://*.shpg.org/ https://comments.mozillafoundation.org/ https://airtable.com https://platform.twitter.com https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/gsap.min.js https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/ScrollTrigger.min.js https://*.googletagmanager.com https://*.fundraiseup.com https://mozillafoundation.tfaforms.net https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/ 'unsafe-eval' https://*.stripe.com https://m.stripe.network https://*.paypal.com https://*.paypalobjects.com https://pay.google.com"
|
2023-06-01 20:29:11 +03:00
|
|
|
CSP_STYLE_SRC: "'self' 'unsafe-inline' https://code.cdn.mozilla.net https://fonts.googleapis.com https://platform.twitter.com https://mozillafoundation.tfaforms.net https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
|
2024-04-09 20:45:26 +03:00
|
|
|
SECURE_CROSS_ORIGIN_OPENER_POLICY: "same-origin-allow-popups"
|
2021-12-16 02:31:44 +03:00
|
|
|
steps:
|
2023-01-14 09:07:12 +03:00
|
|
|
- uses: actions/checkout@v3
|
2022-11-23 20:57:20 +03:00
|
|
|
- uses: actions/setup-python@v4
|
2022-01-28 04:08:36 +03:00
|
|
|
with:
|
2024-01-31 16:44:42 +03:00
|
|
|
python-version: 3.11
|
2023-01-14 02:55:06 +03:00
|
|
|
|
2022-01-28 04:08:36 +03:00
|
|
|
cache: "pip"
|
2023-01-14 04:02:14 +03:00
|
|
|
- uses: actions/setup-node@v3
|
2022-01-28 04:08:36 +03:00
|
|
|
with:
|
2024-01-31 17:22:25 +03:00
|
|
|
node-version: 20
|
2022-01-28 04:08:36 +03:00
|
|
|
cache: "npm"
|
|
|
|
- name: Install Python Dependencies
|
|
|
|
run: pip install -r requirements.txt -r dev-requirements.txt
|
|
|
|
- name: Install Node Dependencies
|
|
|
|
run: npm ci
|
|
|
|
- name: Install additional tooling
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y gettext libgconf-2-4
|
|
|
|
- name: Install Playwright
|
|
|
|
run: npm run playwright:install
|
|
|
|
- name: Preroll
|
|
|
|
run: |
|
|
|
|
npm run build
|
|
|
|
python network-api/manage.py collectstatic --no-input --verbosity 0
|
|
|
|
python network-api/manage.py migrate --no-input
|
|
|
|
python network-api/manage.py block_inventory
|
|
|
|
python network-api/manage.py load_fake_data
|
|
|
|
- name: Integration Tests
|
|
|
|
run: npm run playwright:ci
|