forked from enviPath/enviPy
## Major Changes - Implement a REST style API app in epapi - Currently implements a GET method for all entity types in the browse menu (both package level and global) - Provides paginated results per default with query style filtering for reviewed vs unreviewed. - Provides new paginated templates with thin wrappers per entity types for easier maintainability - Implements e2e tests for the API ## Minor changes - Added more comprehensive gitignore to cover coverage reports and other test/node.js etc. data. - Add additional CI file for API tests that only gets triggered on API relevant changes. ## ⚠️ Currently only works with session-based authentication. Token based will be added in new PR. Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Co-authored-by: jebus <lorsbach@envipath.com> Reviewed-on: enviPath/enviPy#243 Co-authored-by: Tobias O <tobias.olenyi@envipath.com> Co-committed-by: Tobias O <tobias.olenyi@envipath.com>
95 lines
2.4 KiB
YAML
95 lines
2.4 KiB
YAML
name: 'Setup enviPy Environment'
|
|
description: 'Shared setup for enviPy CI - installs dependencies and prepares environment'
|
|
|
|
inputs:
|
|
skip-frontend:
|
|
description: 'Skip frontend build steps (pnpm, tailwind)'
|
|
required: false
|
|
default: 'false'
|
|
skip-playwright:
|
|
description: 'Skip Playwright installation'
|
|
required: false
|
|
default: 'false'
|
|
ssh-private-key:
|
|
description: 'SSH private key for git access'
|
|
required: true
|
|
run-migrations:
|
|
description: 'Run Django migrations after setup'
|
|
required: false
|
|
default: 'true'
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Install system tools via apt
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y postgresql-client openjdk-11-jre-headless
|
|
|
|
- name: Setup ssh
|
|
shell: bash
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ inputs.ssh-private-key }}" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
ssh-keyscan git.envipath.com >> ~/.ssh/known_hosts
|
|
eval $(ssh-agent -s)
|
|
ssh-add ~/.ssh/id_ed25519
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: "pnpm"
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v6
|
|
with:
|
|
enable-cache: true
|
|
|
|
- name: Setup Python venv
|
|
shell: bash
|
|
run: |
|
|
uv sync --locked --all-extras --dev
|
|
|
|
- name: Install Playwright
|
|
if: inputs.skip-playwright == 'false'
|
|
shell: bash
|
|
run: |
|
|
source .venv/bin/activate
|
|
playwright install --with-deps
|
|
|
|
- name: Build Frontend
|
|
if: inputs.skip-frontend == 'false'
|
|
shell: bash
|
|
run: |
|
|
uv run python scripts/pnpm_wrapper.py install
|
|
cat << 'EOF' > pnpm-workspace.yaml
|
|
onlyBuiltDependencies:
|
|
- '@parcel/watcher'
|
|
- '@tailwindcss/oxide'
|
|
EOF
|
|
uv run python scripts/pnpm_wrapper.py run build
|
|
|
|
- name: Wait for Postgres
|
|
shell: bash
|
|
run: |
|
|
until pg_isready -h postgres -U ${{ env.POSTGRES_USER }}; do
|
|
echo "Waiting for postgres..."
|
|
sleep 2
|
|
done
|
|
echo "Postgres is ready!"
|
|
|
|
- name: Run Django Migrations
|
|
if: inputs.run-migrations == 'true'
|
|
shell: bash
|
|
run: |
|
|
source .venv/bin/activate
|
|
python manage.py migrate --noinput
|