Fixes after security review 2023 (#3576) #38
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
name: Hypha CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
- test | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
NODE_VERSION: 18 | |
PYTHON_VERSION: "3.11" | |
jobs: | |
build-fe: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: "npm" | |
- name: install node dependencies | |
run: npm install --quiet | |
- name: builds static assets | |
run: npm run build | |
build-be: | |
runs-on: ubuntu-latest | |
env: | |
DJANGO_SETTINGS_MODULE: hypha.settings.test | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
cache-dependency-path: "**/requirements*.txt" | |
- name: install python dependencies | |
run: | | |
python3 -m venv venv | |
. venv/bin/activate | |
pip install --upgrade pip | |
pip install wheel | |
pip install -r requirements-dev.txt | |
lint-fe: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: "npm" | |
- name: install node dependencies | |
run: npm install --quiet | |
- name: run scss and js linting | |
run: npm run lint | |
lint-be: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install python dependencies | |
run: pip install `grep -E "ruff|djhtml|black" requirements-dev.txt` | |
- name: Run ruff | |
run: ruff --format github . | |
- name: Run black | |
run: black . --check | |
- name: Run djhtml | |
run: djhtml hypha/ --check | |
test-be: | |
runs-on: ubuntu-latest | |
env: | |
DATABASE_URL: postgresql://hypha:hypha@localhost/hypha?sslmode=disable | |
DJANGO_SETTINGS_MODULE: hypha.settings.test | |
SEND_MESSAGES: false | |
services: | |
postgres: | |
image: postgres:14-alpine | |
env: | |
POSTGRES_USER: hypha | |
POSTGRES_PASSWORD: hypha | |
POSTGRES_DB: hypha | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
strategy: | |
matrix: | |
group: [1, 2, 3] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
cache-dependency-path: "**/requirements*.txt" | |
- uses: codecov/codecov-action@v3 | |
- name: install python dependencies | |
run: | | |
python3 -m venv venv | |
. venv/bin/activate | |
mkdir hypha/static_compiled | |
pip install --upgrade pip | |
pip install wheel | |
pip install -r requirements-dev.txt | |
- name: run python tests | |
run: | | |
. venv/bin/activate | |
python manage.py check | |
python manage.py makemigrations --check --noinput --verbosity=1 | |
python manage.py collectstatic --noinput --no-post-process --verbosity=1 | |
pytest --cov --cov-report term:skip-covered --splits 3 --group ${{ matrix.group }} |