1
0
forked from baron/baron-sso

코드체크 실패 케이스 해결. 배치잡 야간 배정

This commit is contained in:
2026-05-29 16:44:46 +09:00
parent 5b345fcf6a
commit 5ddfc6c81b
9 changed files with 546 additions and 80 deletions

View File

@@ -36,6 +36,11 @@ on:
required: true
type: boolean
default: false
userfront_e2e_workers:
description: "Playwright worker count for userfront E2E tests"
required: true
type: string
default: "2"
run_adminfront_tests:
description: "Run adminfront Playwright tests"
required: true
@@ -61,8 +66,109 @@ permissions:
contents: write
jobs:
changes:
runs-on: ubuntu-latest
outputs:
any: ${{ steps.filter.outputs.any }}
lint: ${{ steps.filter.outputs.lint }}
biome: ${{ steps.filter.outputs.biome }}
backend: ${{ steps.filter.outputs.backend }}
userfront: ${{ steps.filter.outputs.userfront }}
userfront_e2e: ${{ steps.filter.outputs.userfront_e2e }}
front_coverage: ${{ steps.filter.outputs.front_coverage }}
adminfront: ${{ steps.filter.outputs.adminfront }}
devfront: ${{ steps.filter.outputs.devfront }}
orgfront: ${{ steps.filter.outputs.orgfront }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect changed areas
id: filter
run: |
set -euo pipefail
set_output() {
echo "$1=$2" >> "$GITHUB_OUTPUT"
}
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
for key in any lint biome backend userfront userfront_e2e front_coverage adminfront devfront orgfront; do
set_output "$key" true
done
exit 0
fi
base="${{ github.event.before }}"
if [ "${{ github.event_name }}" = "pull_request" ]; then
base="${{ github.event.pull_request.base.sha }}"
fi
if [ -z "$base" ] || ! git cat-file -e "$base^{commit}" 2>/dev/null; then
base="$(git rev-parse HEAD^ 2>/dev/null || true)"
fi
if [ -n "$base" ]; then
changed_files="$(git diff --name-only "$base" HEAD)"
else
changed_files="$(git ls-files)"
fi
echo "Changed files:"
printf '%s\n' "$changed_files"
matches() {
printf '%s\n' "$changed_files" | grep -Eq "$1"
}
global='^(\.gitea/workflows/code_check\.yml|Makefile|scripts/|tools/|test/code_check_)'
front_shared='^(common/|scripts/playwrightPackageVersion\.cjs|scripts/summarize_vitest_coverage\.mjs|scripts/run_adminfront_ci_tests\.sh|\.gitea/workflows/code_check\.yml|Makefile)'
i18n_shared='^(common/locales/|userfront/assets/translations/|scripts/sync_userfront_locales\.sh|tools/i18n-scanner/)'
backend=false
userfront=false
userfront_e2e=false
adminfront=false
devfront=false
orgfront=false
front_coverage=false
biome=false
if matches "$global|^backend/"; then backend=true; fi
if matches "$global|$i18n_shared|^userfront/"; then userfront=true; fi
if matches "$global|$i18n_shared|^userfront/|^userfront-e2e/"; then userfront_e2e=true; fi
if matches "$front_shared|^adminfront/"; then adminfront=true; fi
if matches "$front_shared|^devfront/"; then devfront=true; fi
if matches "$front_shared|^orgfront/"; then orgfront=true; fi
if matches "$front_shared|^adminfront/|^devfront/|^orgfront/"; then front_coverage=true; fi
if matches "$front_shared|^adminfront/|^devfront/|^orgfront/"; then biome=true; fi
lint=false
if [ "$backend" = true ] || [ "$userfront" = true ] || [ "$adminfront" = true ] || [ "$devfront" = true ] || [ "$orgfront" = true ] || matches "$i18n_shared"; then
lint=true
fi
any=false
for value in "$lint" "$biome" "$backend" "$userfront" "$userfront_e2e" "$front_coverage" "$adminfront" "$devfront" "$orgfront"; do
if [ "$value" = true ]; then any=true; fi
done
set_output any "$any"
set_output lint "$lint"
set_output biome "$biome"
set_output backend "$backend"
set_output userfront "$userfront"
set_output userfront_e2e "$userfront_e2e"
set_output front_coverage "$front_coverage"
set_output adminfront "$adminfront"
set_output devfront "$devfront"
set_output orgfront "$orgfront"
lint:
if: ${{ github.event_name != 'workflow_dispatch' || inputs.run_lint == true }}
needs: changes
if: ${{ needs.changes.outputs.lint == 'true' && (github.event_name != 'workflow_dispatch' || inputs.run_lint == true) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
@@ -162,7 +268,8 @@ jobs:
flutter analyze --no-fatal-warnings --no-fatal-infos
biome-check:
if: ${{ github.event_name != 'workflow_dispatch' || inputs.run_lint == true }}
needs: changes
if: ${{ needs.changes.outputs.biome == 'true' && (github.event_name != 'workflow_dispatch' || inputs.run_lint == true) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
@@ -210,8 +317,10 @@ jobs:
npx biome check . --linter-enabled=false --assist-enabled=false
backend-tests:
needs: lint
if: ${{ always() && (github.event_name != 'workflow_dispatch' || inputs.run_backend_tests == true) }}
needs:
- changes
- lint
if: ${{ always() && needs.changes.outputs.backend == 'true' && (github.event_name != 'workflow_dispatch' || inputs.run_backend_tests == true) }}
runs-on: ubuntu-latest
services:
redis:
@@ -286,8 +395,10 @@ jobs:
if-no-files-found: ignore
userfront-tests:
needs: lint
if: ${{ always() && (github.event_name != 'workflow_dispatch' || inputs.run_userfront_tests == true) }}
needs:
- changes
- lint
if: ${{ always() && needs.changes.outputs.userfront == 'true' && (github.event_name != 'workflow_dispatch' || inputs.run_userfront_tests == true) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
@@ -379,12 +490,15 @@ jobs:
if-no-files-found: ignore
userfront-e2e-tests:
needs: lint
if: ${{ always() && (github.event_name != 'workflow_dispatch' || inputs.run_userfront_e2e_tests == true) }}
needs:
- changes
- lint
if: ${{ always() && needs.changes.outputs.userfront_e2e == 'true' && (github.event_name != 'workflow_dispatch' || inputs.run_userfront_e2e_tests == true) }}
runs-on: ubuntu-latest
timeout-minutes: 40
env:
USERFRONT_E2E_FULL: ${{ github.event_name == 'workflow_dispatch' && inputs.run_userfront_e2e_full == true }}
USERFRONT_E2E_WORKERS: ${{ github.event_name == 'workflow_dispatch' && inputs.userfront_e2e_workers || '2' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -529,8 +643,12 @@ jobs:
else
test_command="npm test -- --project=chromium-desktop --project=chromium-mobile-webapp"
fi
echo "[userfront-e2e] $test_command" | tee ../reports/userfront-e2e-test.log
$test_command 2>&1 | tee -a ../reports/userfront-e2e-test.log
workers="${USERFRONT_E2E_WORKERS:-2}"
case "$workers" in
''|*[!0-9]*|0) workers=2 ;;
esac
echo "[userfront-e2e] PLAYWRIGHT_WORKERS=$workers $test_command" | tee ../reports/userfront-e2e-test.log
PLAYWRIGHT_WORKERS="$workers" $test_command 2>&1 | tee -a ../reports/userfront-e2e-test.log
test_exit_code=${PIPESTATUS[0]}
cd ..
set -e
@@ -632,8 +750,10 @@ jobs:
if-no-files-found: ignore
front-vitest-coverage:
needs: lint
if: ${{ always() && (github.event_name != 'workflow_dispatch' || inputs.run_front_coverage == true) }}
needs:
- changes
- lint
if: ${{ always() && needs.changes.outputs.front_coverage == 'true' && (github.event_name != 'workflow_dispatch' || inputs.run_front_coverage == true) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
@@ -815,8 +935,10 @@ jobs:
if-no-files-found: ignore
adminfront-tests:
needs: lint
if: ${{ always() && (github.event_name != 'workflow_dispatch' || inputs.run_adminfront_tests == true) }}
needs:
- changes
- lint
if: ${{ always() && needs.changes.outputs.adminfront == 'true' && (github.event_name != 'workflow_dispatch' || inputs.run_adminfront_tests == true) }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
@@ -908,8 +1030,10 @@ jobs:
if-no-files-found: ignore
devfront-tests:
needs: lint
if: ${{ always() && (github.event_name != 'workflow_dispatch' || inputs.run_devfront_tests == true) }}
needs:
- changes
- lint
if: ${{ always() && needs.changes.outputs.devfront == 'true' && (github.event_name != 'workflow_dispatch' || inputs.run_devfront_tests == true) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
@@ -1089,8 +1213,10 @@ jobs:
if-no-files-found: ignore
orgfront-tests:
needs: lint
if: ${{ always() && (github.event_name != 'workflow_dispatch' || inputs.run_orgfront_tests == true) }}
needs:
- changes
- lint
if: ${{ always() && needs.changes.outputs.orgfront == 'true' && (github.event_name != 'workflow_dispatch' || inputs.run_orgfront_tests == true) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
@@ -1274,6 +1400,7 @@ jobs:
badge-updater:
needs:
- changes
- lint
- biome-check
- backend-tests
@@ -1283,7 +1410,7 @@ jobs:
- adminfront-tests
- devfront-tests
- orgfront-tests
if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }}
if: ${{ always() && needs.changes.outputs.any == 'true' && github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
@@ -1315,19 +1442,49 @@ jobs:
ADMINFRONT_RESULT: ${{ needs['adminfront-tests'].result }}
DEVFRONT_RESULT: ${{ needs['devfront-tests'].result }}
ORGFRONT_RESULT: ${{ needs['orgfront-tests'].result }}
BADGE_SOURCE_BRANCH: dev
BADGE_SOURCE_SHA: ${{ github.sha }}
run: |
node scripts/update_code_check_badges.mjs
cat docs/badges/badges.json
- name: Commit badge updates
- name: Publish badge assets
run: |
if [ -z "$(git status --porcelain docs/badges)" ]; then
echo "No badge changes."
exit 0
fi
BADGE_BRANCH=badges
BADGE_WORKTREE="$(mktemp -d)"
BADGE_LATEST_DIR="${BADGE_WORKTREE}/latest"
BADGE_SHA_DIR="${BADGE_WORKTREE}/dev/${GITHUB_SHA}"
trap 'rm -rf "${BADGE_WORKTREE}"' EXIT
git config user.name "gitea-actions"
git config user.email "gitea-actions@hmac.kr"
git add docs/badges
git commit -m "chore: update code check badges [skip ci]"
git push
git fetch origin "+refs/heads/${BADGE_BRANCH}:refs/remotes/origin/${BADGE_BRANCH}" || true
if git show-ref --verify --quiet "refs/remotes/origin/${BADGE_BRANCH}"; then
git worktree add --detach "${BADGE_WORKTREE}" "origin/${BADGE_BRANCH}"
else
git worktree add --detach "${BADGE_WORKTREE}"
git -C "${BADGE_WORKTREE}" checkout --orphan "${BADGE_BRANCH}"
git -C "${BADGE_WORKTREE}" rm -rf . || true
fi
find "${BADGE_WORKTREE}" -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
mkdir -p "${BADGE_LATEST_DIR}" "${BADGE_SHA_DIR}"
cp docs/badges/*.svg "${BADGE_LATEST_DIR}/"
cp docs/badges/badges.json "${BADGE_LATEST_DIR}/badges.json"
cp docs/badges/*.svg "${BADGE_SHA_DIR}/"
cp docs/badges/badges.json "${BADGE_SHA_DIR}/badges.json"
git -C "${BADGE_WORKTREE}" add .
if [ -z "$(git -C "${BADGE_WORKTREE}" status --porcelain)" ]; then
echo "No published badge changes."
exit 0
fi
git -C "${BADGE_WORKTREE}" commit -m "chore: publish code check badges [skip ci]"
git -C "${BADGE_WORKTREE}" push origin HEAD:${BADGE_BRANCH}