Compare commits
2 Commits
8774e85529
...
0606b71890
| Author | SHA1 | Date | |
|---|---|---|---|
| 0606b71890 | |||
| b4fc4fc955 |
@@ -20,6 +20,10 @@ on:
|
||||
description: "Run Playwright E2E gate"
|
||||
required: true
|
||||
default: "true"
|
||||
skip_tests:
|
||||
description: "Skip the entire tests stage"
|
||||
required: true
|
||||
default: "false"
|
||||
deploy:
|
||||
description: "Run production deploy over SSH"
|
||||
required: true
|
||||
@@ -31,7 +35,7 @@ on:
|
||||
require_manual_approval:
|
||||
description: "Require approval token for deploy job"
|
||||
required: true
|
||||
default: "true"
|
||||
default: "false"
|
||||
approval_token:
|
||||
description: "Approval token value when manual approval is required"
|
||||
required: false
|
||||
@@ -96,31 +100,36 @@ jobs:
|
||||
timeout-minutes: 120
|
||||
needs: prepare
|
||||
steps:
|
||||
- name: Skip tests stage
|
||||
if: ${{ github.event.inputs.skip_tests == 'true' }}
|
||||
run: echo "Skipping tests stage because skip_tests=true"
|
||||
|
||||
- name: Check out promoted ref
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' }}
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ needs.prepare.outputs.target_ref }}
|
||||
|
||||
- name: Set up Python for backend tests
|
||||
if: ${{ github.event.inputs.run_backend_tests != 'false' || github.event.inputs.run_playwright_tests != 'false' }}
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' && (github.event.inputs.run_backend_tests != 'false' || github.event.inputs.run_playwright_tests != 'false') }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Install backend dependencies (runner python)
|
||||
if: ${{ github.event.inputs.run_backend_tests != 'false' }}
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' && github.event.inputs.run_backend_tests != 'false' }}
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r backend/requirements.txt
|
||||
|
||||
- name: Run backend unit tests
|
||||
if: ${{ github.event.inputs.run_backend_tests != 'false' }}
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' && github.event.inputs.run_backend_tests != 'false' }}
|
||||
run: |
|
||||
cd backend
|
||||
pytest -q
|
||||
|
||||
- name: Set up Node.js
|
||||
if: ${{ github.event.inputs.run_frontend_tests != 'false' || github.event.inputs.run_playwright_tests != 'false' }}
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' && (github.event.inputs.run_frontend_tests != 'false' || github.event.inputs.run_playwright_tests != 'false') }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20.19.0"
|
||||
@@ -128,29 +137,29 @@ jobs:
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Install frontend dependencies
|
||||
if: ${{ github.event.inputs.run_frontend_tests != 'false' || github.event.inputs.run_playwright_tests != 'false' }}
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' && (github.event.inputs.run_frontend_tests != 'false' || github.event.inputs.run_playwright_tests != 'false') }}
|
||||
run: npm ci
|
||||
working-directory: frontend
|
||||
|
||||
- name: Run frontend unit tests
|
||||
if: ${{ github.event.inputs.run_frontend_tests != 'false' }}
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' && github.event.inputs.run_frontend_tests != 'false' }}
|
||||
run: npm run test:unit --if-present
|
||||
working-directory: frontend
|
||||
|
||||
- name: Create backend venv for Playwright webServer
|
||||
if: ${{ github.event.inputs.run_playwright_tests != 'false' }}
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' && github.event.inputs.run_playwright_tests != 'false' }}
|
||||
run: |
|
||||
python -m venv backend/.venv
|
||||
backend/.venv/bin/python -m pip install --upgrade pip
|
||||
backend/.venv/bin/python -m pip install -r backend/requirements.txt
|
||||
|
||||
- name: Install Playwright browsers
|
||||
if: ${{ github.event.inputs.run_playwright_tests != 'false' }}
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' && github.event.inputs.run_playwright_tests != 'false' }}
|
||||
run: npx playwright install --with-deps
|
||||
working-directory: frontend
|
||||
|
||||
- name: Run Playwright tests
|
||||
if: ${{ github.event.inputs.run_playwright_tests != 'false' }}
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' && github.event.inputs.run_playwright_tests != 'false' }}
|
||||
run: npx playwright test --reporter=line
|
||||
working-directory: frontend
|
||||
env:
|
||||
@@ -192,13 +201,27 @@ jobs:
|
||||
script: |
|
||||
set -euo pipefail
|
||||
|
||||
cd /opt
|
||||
if [ -d "chore/.git" ]; then
|
||||
cd chore
|
||||
repo_dir="${{ secrets.DEPLOY_PROD_PATH }}"
|
||||
if [ -z "$repo_dir" ]; then
|
||||
repo_dir="$HOME/chore"
|
||||
fi
|
||||
|
||||
repo_parent=$(dirname "$repo_dir")
|
||||
if [ ! -d "$repo_parent" ]; then
|
||||
mkdir -p "$repo_parent"
|
||||
fi
|
||||
if [ ! -w "$repo_parent" ]; then
|
||||
echo "Deploy user $(whoami) cannot write to ${repo_parent}."
|
||||
echo "Set DEPLOY_PROD_PATH to a writable location or grant write access before rerunning promotion."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$repo_dir/.git" ]; then
|
||||
cd "$repo_dir"
|
||||
git fetch --all --tags
|
||||
else
|
||||
git clone --branch "${{ needs.prepare.outputs.target_ref }}" https://git.ryankegel.com/ryan/chore.git chore
|
||||
cd chore
|
||||
git clone --branch "${{ needs.prepare.outputs.target_ref }}" https://git.ryankegel.com/ryan/chore.git "$repo_dir"
|
||||
cd "$repo_dir"
|
||||
fi
|
||||
|
||||
git checkout "${{ needs.prepare.outputs.target_ref }}"
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
"cookies": [
|
||||
{
|
||||
"name": "refresh_token",
|
||||
"value": "caYfAayTk40YWkRvN82a9_mGQ_-wXy6JdBBaD_UhLcQ",
|
||||
"value": "mqtPPFKJGGfFly1i0VW1MtJUvgIpb7LlWUEpFLn1hGc",
|
||||
"domain": "localhost",
|
||||
"path": "/api/auth",
|
||||
"expires": 1785003956.884209,
|
||||
"expires": 1785022348.96348,
|
||||
"httpOnly": true,
|
||||
"secure": true,
|
||||
"sameSite": "Strict"
|
||||
},
|
||||
{
|
||||
"name": "access_token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImUyZUB0ZXN0LmNvbSIsInVzZXJfaWQiOiI3YjcxMGU0ZC02ZTExLTRjMjctODllNS1jZTcxNGZhOTgwZTIiLCJ0b2tlbl92ZXJzaW9uIjowLCJleHAiOjE3NzcyMjg4NTZ9.wJCrQ9Y5nbVpqd6yCeCHcpcpGpg4YqavqlsHbU8kDPE",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImUyZUB0ZXN0LmNvbSIsInVzZXJfaWQiOiIzZDJmZmY0OS03MjNhLTRhMmUtYWRhOS1iMTE5N2VhYTI2MDkiLCJ0b2tlbl92ZXJzaW9uIjowLCJleHAiOjE3NzcyNTcxNDh9.g69Lwtay2i0jwEzAbYcRWM2oGoOm-4qpV8YC04X0v-0",
|
||||
"domain": "localhost",
|
||||
"path": "/",
|
||||
"expires": 1777228856.884169,
|
||||
"expires": 1777257148.963437,
|
||||
"httpOnly": true,
|
||||
"secure": true,
|
||||
"sameSite": "Lax"
|
||||
@@ -27,11 +27,11 @@
|
||||
"localStorage": [
|
||||
{
|
||||
"name": "authSyncEvent",
|
||||
"value": "{\"type\":\"logout\",\"at\":1777227956772}"
|
||||
"value": "{\"type\":\"logout\",\"at\":1777246348801}"
|
||||
},
|
||||
{
|
||||
"name": "parentAuth",
|
||||
"value": "{\"expiresAt\":1777400757015}"
|
||||
"value": "{\"expiresAt\":1777419149107}"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"status": "passed",
|
||||
"status": "interrupted",
|
||||
"failedTests": []
|
||||
}
|
||||
Reference in New Issue
Block a user