2 Commits

Author SHA1 Message Date
0606b71890 feat: add workflow for promoting master to production with testing and deployment steps
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m18s
2026-04-26 22:43:29 -04:00
b4fc4fc955 feat: add workflow for promoting master to production with testing and deployment steps
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Has been cancelled
2026-04-26 22:41:14 -04:00
3 changed files with 45 additions and 22 deletions

View File

@@ -20,6 +20,10 @@ on:
description: "Run Playwright E2E gate" description: "Run Playwright E2E gate"
required: true required: true
default: "true" default: "true"
skip_tests:
description: "Skip the entire tests stage"
required: true
default: "false"
deploy: deploy:
description: "Run production deploy over SSH" description: "Run production deploy over SSH"
required: true required: true
@@ -31,7 +35,7 @@ on:
require_manual_approval: require_manual_approval:
description: "Require approval token for deploy job" description: "Require approval token for deploy job"
required: true required: true
default: "true" default: "false"
approval_token: approval_token:
description: "Approval token value when manual approval is required" description: "Approval token value when manual approval is required"
required: false required: false
@@ -96,31 +100,36 @@ jobs:
timeout-minutes: 120 timeout-minutes: 120
needs: prepare needs: prepare
steps: 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 - name: Check out promoted ref
if: ${{ github.event.inputs.skip_tests != 'true' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
ref: ${{ needs.prepare.outputs.target_ref }} ref: ${{ needs.prepare.outputs.target_ref }}
- name: Set up Python for backend tests - 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 uses: actions/setup-python@v4
with: with:
python-version: "3.11" python-version: "3.11"
- name: Install backend dependencies (runner python) - 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: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r backend/requirements.txt pip install -r backend/requirements.txt
- name: Run backend unit tests - 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: | run: |
cd backend cd backend
pytest -q pytest -q
- name: Set up Node.js - 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 uses: actions/setup-node@v4
with: with:
node-version: "20.19.0" node-version: "20.19.0"
@@ -128,29 +137,29 @@ jobs:
cache-dependency-path: frontend/package-lock.json cache-dependency-path: frontend/package-lock.json
- name: Install frontend dependencies - 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 run: npm ci
working-directory: frontend working-directory: frontend
- name: Run frontend unit tests - 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 run: npm run test:unit --if-present
working-directory: frontend working-directory: frontend
- name: Create backend venv for Playwright webServer - 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: | run: |
python -m venv backend/.venv python -m venv backend/.venv
backend/.venv/bin/python -m pip install --upgrade pip backend/.venv/bin/python -m pip install --upgrade pip
backend/.venv/bin/python -m pip install -r backend/requirements.txt backend/.venv/bin/python -m pip install -r backend/requirements.txt
- name: Install Playwright browsers - 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 run: npx playwright install --with-deps
working-directory: frontend working-directory: frontend
- name: Run Playwright tests - 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 run: npx playwright test --reporter=line
working-directory: frontend working-directory: frontend
env: env:
@@ -192,13 +201,27 @@ jobs:
script: | script: |
set -euo pipefail set -euo pipefail
cd /opt repo_dir="${{ secrets.DEPLOY_PROD_PATH }}"
if [ -d "chore/.git" ]; then if [ -z "$repo_dir" ]; then
cd chore 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 git fetch --all --tags
else else
git clone --branch "${{ needs.prepare.outputs.target_ref }}" https://git.ryankegel.com/ryan/chore.git chore git clone --branch "${{ needs.prepare.outputs.target_ref }}" https://git.ryankegel.com/ryan/chore.git "$repo_dir"
cd chore cd "$repo_dir"
fi fi
git checkout "${{ needs.prepare.outputs.target_ref }}" git checkout "${{ needs.prepare.outputs.target_ref }}"

View File

@@ -2,20 +2,20 @@
"cookies": [ "cookies": [
{ {
"name": "refresh_token", "name": "refresh_token",
"value": "caYfAayTk40YWkRvN82a9_mGQ_-wXy6JdBBaD_UhLcQ", "value": "mqtPPFKJGGfFly1i0VW1MtJUvgIpb7LlWUEpFLn1hGc",
"domain": "localhost", "domain": "localhost",
"path": "/api/auth", "path": "/api/auth",
"expires": 1785003956.884209, "expires": 1785022348.96348,
"httpOnly": true, "httpOnly": true,
"secure": true, "secure": true,
"sameSite": "Strict" "sameSite": "Strict"
}, },
{ {
"name": "access_token", "name": "access_token",
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImUyZUB0ZXN0LmNvbSIsInVzZXJfaWQiOiI3YjcxMGU0ZC02ZTExLTRjMjctODllNS1jZTcxNGZhOTgwZTIiLCJ0b2tlbl92ZXJzaW9uIjowLCJleHAiOjE3NzcyMjg4NTZ9.wJCrQ9Y5nbVpqd6yCeCHcpcpGpg4YqavqlsHbU8kDPE", "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImUyZUB0ZXN0LmNvbSIsInVzZXJfaWQiOiIzZDJmZmY0OS03MjNhLTRhMmUtYWRhOS1iMTE5N2VhYTI2MDkiLCJ0b2tlbl92ZXJzaW9uIjowLCJleHAiOjE3NzcyNTcxNDh9.g69Lwtay2i0jwEzAbYcRWM2oGoOm-4qpV8YC04X0v-0",
"domain": "localhost", "domain": "localhost",
"path": "/", "path": "/",
"expires": 1777228856.884169, "expires": 1777257148.963437,
"httpOnly": true, "httpOnly": true,
"secure": true, "secure": true,
"sameSite": "Lax" "sameSite": "Lax"
@@ -27,11 +27,11 @@
"localStorage": [ "localStorage": [
{ {
"name": "authSyncEvent", "name": "authSyncEvent",
"value": "{\"type\":\"logout\",\"at\":1777227956772}" "value": "{\"type\":\"logout\",\"at\":1777246348801}"
}, },
{ {
"name": "parentAuth", "name": "parentAuth",
"value": "{\"expiresAt\":1777400757015}" "value": "{\"expiresAt\":1777419149107}"
} }
] ]
} }

View File

@@ -1,4 +1,4 @@
{ {
"status": "passed", "status": "interrupted",
"failedTests": [] "failedTests": []
} }