mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix: add tsx dependency and fix workflow step ordering
- Add tsx as an e2e devDependency (was missing, causing silent failures) - Replace `npx tsx` with `pnpm exec tsx` throughout - Move `pnpm install` before `playwright install` (correct ordering) - Remove `2>/dev/null` that was hiding analyzer errors - Add debug logging to route analysis step - Set default working-directory for the job https://claude.ai/code/session_01XSTqDJXuR4jaLN7SGm3uES
This commit is contained in:
@@ -16,6 +16,9 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./e2e
|
||||||
steps:
|
steps:
|
||||||
- id: token
|
- id: token
|
||||||
uses: immich-app/devtools/actions/create-workflow-token@05e16407c0a5492138bb38139c9d9bf067b40886 # create-workflow-token-action-v1.0.1
|
uses: immich-app/devtools/actions/create-workflow-token@05e16407c0a5492138bb38139c9d9bf067b40886 # create-workflow-token-action-v1.0.1
|
||||||
@@ -40,9 +43,11 @@ jobs:
|
|||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: '**/pnpm-lock.yaml'
|
cache-dependency-path: '**/pnpm-lock.yaml'
|
||||||
|
|
||||||
|
- name: Install e2e dependencies
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Install Playwright
|
- name: Install Playwright
|
||||||
run: pnpm exec playwright install chromium --only-shell
|
run: pnpm exec playwright install chromium --only-shell
|
||||||
working-directory: ./e2e
|
|
||||||
|
|
||||||
- name: Determine changed web files
|
- name: Determine changed web files
|
||||||
id: changed-files
|
id: changed-files
|
||||||
@@ -55,7 +60,6 @@ jobs:
|
|||||||
echo "$CHANGED" >> "$GITHUB_OUTPUT"
|
echo "$CHANGED" >> "$GITHUB_OUTPUT"
|
||||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
# Check if there are any web changes at all
|
|
||||||
if [ -z "$CHANGED" ]; then
|
if [ -z "$CHANGED" ]; then
|
||||||
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
@@ -68,11 +72,12 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CHANGED_FILES: ${{ steps.changed-files.outputs.files }}
|
CHANGED_FILES: ${{ steps.changed-files.outputs.files }}
|
||||||
run: |
|
run: |
|
||||||
# Install dependencies for the analyzer
|
|
||||||
pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
# Run the dependency analyzer
|
# Run the dependency analyzer
|
||||||
ROUTES=$(echo "$CHANGED_FILES" | xargs npx tsx src/screenshots/analyze-deps.ts 2>/dev/null | grep "^ /" | sed 's/^ //' || true)
|
echo "Changed files:"
|
||||||
|
echo "$CHANGED_FILES"
|
||||||
|
echo "---"
|
||||||
|
|
||||||
|
ROUTES=$(echo "$CHANGED_FILES" | xargs pnpm exec tsx src/screenshots/analyze-deps.ts 2>&1 | tee /dev/stderr | grep "^ /" | sed 's/^ //' || true)
|
||||||
|
|
||||||
echo "routes<<EOF" >> "$GITHUB_OUTPUT"
|
echo "routes<<EOF" >> "$GITHUB_OUTPUT"
|
||||||
echo "$ROUTES" >> "$GITHUB_OUTPUT"
|
echo "$ROUTES" >> "$GITHUB_OUTPUT"
|
||||||
@@ -84,15 +89,15 @@ jobs:
|
|||||||
echo "has_routes=true" >> "$GITHUB_OUTPUT"
|
echo "has_routes=true" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
# Build the scenario filter JSON array
|
# Build the scenario filter JSON array
|
||||||
SCENARIO_NAMES=$(npx tsx -e "
|
SCENARIO_NAMES=$(pnpm exec tsx -e "
|
||||||
import { getScenariosForRoutes } from './src/screenshots/page-map.ts';
|
import { getScenariosForRoutes } from './src/screenshots/page-map.ts';
|
||||||
const routes = process.argv.slice(1);
|
const routes = process.argv.slice(1);
|
||||||
const scenarios = getScenariosForRoutes(routes);
|
const scenarios = getScenariosForRoutes(routes);
|
||||||
console.log(JSON.stringify(scenarios.map(s => s.name)));
|
console.log(JSON.stringify(scenarios.map(s => s.name)));
|
||||||
" $ROUTES)
|
" $ROUTES)
|
||||||
echo "scenarios=$SCENARIO_NAMES" >> "$GITHUB_OUTPUT"
|
echo "scenarios=$SCENARIO_NAMES" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Scenarios: $SCENARIO_NAMES"
|
||||||
fi
|
fi
|
||||||
working-directory: ./e2e
|
|
||||||
|
|
||||||
- name: Post initial comment
|
- name: Post initial comment
|
||||||
if: steps.changed-files.outputs.has_changes == 'true' && steps.routes.outputs.has_routes == 'true'
|
if: steps.changed-files.outputs.has_changes == 'true' && steps.routes.outputs.has_routes == 'true'
|
||||||
@@ -152,6 +157,7 @@ jobs:
|
|||||||
# Wait for server to be ready
|
# Wait for server to be ready
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
if curl -s http://127.0.0.1:4173 > /dev/null 2>&1; then
|
if curl -s http://127.0.0.1:4173 > /dev/null 2>&1; then
|
||||||
|
echo "Server ready after ${i}s"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
@@ -162,7 +168,6 @@ jobs:
|
|||||||
|
|
||||||
# Stop the preview server
|
# Stop the preview server
|
||||||
kill $SERVER_PID 2>/dev/null || true
|
kill $SERVER_PID 2>/dev/null || true
|
||||||
working-directory: ./e2e
|
|
||||||
|
|
||||||
# === Screenshot base version ===
|
# === Screenshot base version ===
|
||||||
- name: Checkout base web directory
|
- name: Checkout base web directory
|
||||||
@@ -172,6 +177,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# Restore web directory from base branch
|
# Restore web directory from base branch
|
||||||
git checkout "$BASE_SHA" -- web/ open-api/typescript-sdk/ i18n/ || true
|
git checkout "$BASE_SHA" -- web/ open-api/typescript-sdk/ i18n/ || true
|
||||||
|
working-directory: .
|
||||||
|
|
||||||
- name: Build SDK (base)
|
- name: Build SDK (base)
|
||||||
if: steps.routes.outputs.has_routes == 'true'
|
if: steps.routes.outputs.has_routes == 'true'
|
||||||
@@ -198,6 +204,7 @@ jobs:
|
|||||||
# Wait for server to be ready
|
# Wait for server to be ready
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
if curl -s http://127.0.0.1:4173 > /dev/null 2>&1; then
|
if curl -s http://127.0.0.1:4173 > /dev/null 2>&1; then
|
||||||
|
echo "Server ready after ${i}s"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
@@ -208,7 +215,6 @@ jobs:
|
|||||||
|
|
||||||
# Stop the preview server
|
# Stop the preview server
|
||||||
kill $SERVER_PID 2>/dev/null || true
|
kill $SERVER_PID 2>/dev/null || true
|
||||||
working-directory: ./e2e
|
|
||||||
|
|
||||||
# === Compare and report ===
|
# === Compare and report ===
|
||||||
- name: Compare screenshots
|
- name: Compare screenshots
|
||||||
@@ -217,11 +223,10 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
WORKSPACE_DIR: ${{ github.workspace }}
|
WORKSPACE_DIR: ${{ github.workspace }}
|
||||||
run: |
|
run: |
|
||||||
npx tsx src/screenshots/compare.ts \
|
pnpm exec tsx src/screenshots/compare.ts \
|
||||||
"$WORKSPACE_DIR/screenshots/base" \
|
"$WORKSPACE_DIR/screenshots/base" \
|
||||||
"$WORKSPACE_DIR/screenshots/pr" \
|
"$WORKSPACE_DIR/screenshots/pr" \
|
||||||
"$WORKSPACE_DIR/screenshots/diff"
|
"$WORKSPACE_DIR/screenshots/diff"
|
||||||
working-directory: ./e2e
|
|
||||||
|
|
||||||
- name: Upload screenshot artifacts
|
- name: Upload screenshot artifacts
|
||||||
if: steps.routes.outputs.has_routes == 'true'
|
if: steps.routes.outputs.has_routes == 'true'
|
||||||
@@ -244,15 +249,12 @@ jobs:
|
|||||||
|
|
||||||
const workspaceDir = process.env.WORKSPACE_DIR;
|
const workspaceDir = process.env.WORKSPACE_DIR;
|
||||||
const diffDir = path.join(workspaceDir, 'screenshots', 'diff');
|
const diffDir = path.join(workspaceDir, 'screenshots', 'diff');
|
||||||
const baseDir = path.join(workspaceDir, 'screenshots', 'base');
|
|
||||||
const prDir = path.join(workspaceDir, 'screenshots', 'pr');
|
|
||||||
|
|
||||||
// Read comparison results
|
// Read comparison results
|
||||||
let results;
|
let results;
|
||||||
try {
|
try {
|
||||||
results = JSON.parse(fs.readFileSync(path.join(diffDir, 'results.json'), 'utf8'));
|
results = JSON.parse(fs.readFileSync(path.join(diffDir, 'results.json'), 'utf8'));
|
||||||
} catch {
|
} catch {
|
||||||
// Post a simple message if comparison failed
|
|
||||||
await github.rest.issues.createComment({
|
await github.rest.issues.createComment({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
@@ -310,7 +312,7 @@ jobs:
|
|||||||
});
|
});
|
||||||
|
|
||||||
const botComment = comments.data.find(c =>
|
const botComment = comments.data.find(c =>
|
||||||
c.body && c.body.includes('## Visual Review') && c.body.includes('visual-review')
|
c.body && c.body.includes('## Visual Review')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (botComment) {
|
if (botComment) {
|
||||||
|
|||||||
+3
-2
@@ -20,8 +20,8 @@
|
|||||||
"lint:fix": "pnpm run lint --fix",
|
"lint:fix": "pnpm run lint --fix",
|
||||||
"check": "tsc --noEmit",
|
"check": "tsc --noEmit",
|
||||||
"screenshots": "pnpm exec playwright test --config playwright.screenshot.config.ts",
|
"screenshots": "pnpm exec playwright test --config playwright.screenshot.config.ts",
|
||||||
"screenshots:compare": "npx tsx src/screenshots/compare.ts",
|
"screenshots:compare": "pnpm exec tsx src/screenshots/compare.ts",
|
||||||
"screenshots:analyze": "npx tsx src/screenshots/analyze-deps.ts"
|
"screenshots:analyze": "pnpm exec tsx src/screenshots/analyze-deps.ts"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
@@ -54,6 +54,7 @@
|
|||||||
"sharp": "^0.34.5",
|
"sharp": "^0.34.5",
|
||||||
"socket.io-client": "^4.7.4",
|
"socket.io-client": "^4.7.4",
|
||||||
"supertest": "^7.0.0",
|
"supertest": "^7.0.0",
|
||||||
|
"tsx": "^4.21.0",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
"typescript-eslint": "^8.28.0",
|
"typescript-eslint": "^8.28.0",
|
||||||
"utimes": "^5.2.1",
|
"utimes": "^5.2.1",
|
||||||
|
|||||||
Generated
+3
@@ -276,6 +276,9 @@ importers:
|
|||||||
supertest:
|
supertest:
|
||||||
specifier: ^7.0.0
|
specifier: ^7.0.0
|
||||||
version: 7.2.2
|
version: 7.2.2
|
||||||
|
tsx:
|
||||||
|
specifier: ^4.21.0
|
||||||
|
version: 4.21.0
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.3.3
|
specifier: ^5.3.3
|
||||||
version: 5.9.3
|
version: 5.9.3
|
||||||
|
|||||||
Reference in New Issue
Block a user