diff --git a/.github/workflows/get-backend-memory.yml b/.github/workflows/get-backend-memory.yml index 6f36c088f1..b14885ec34 100644 --- a/.github/workflows/get-backend-memory.yml +++ b/.github/workflows/get-backend-memory.yml @@ -56,6 +56,8 @@ jobs: run: git diff --exit-code pnpm-lock.yaml - name: Copy Configure run: cp .github/misskey/test.yml .config/default.yml + - name: Compile Configure + run: pnpm convert:config - name: Build run: pnpm build - name: Run migrations diff --git a/.github/workflows/report-backend-memory.yml b/.github/workflows/report-backend-memory.yml index 8ae33bc582..ede43cc645 100644 --- a/.github/workflows/report-backend-memory.yml +++ b/.github/workflows/report-backend-memory.yml @@ -20,9 +20,9 @@ jobs: script: | const fs = require('fs'); let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, }); let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => { return artifact.name.startsWith("memory-artifact-") || artifact.name == "memory-artifact" @@ -61,18 +61,18 @@ jobs: if [ "$BASE_RSS" -gt 0 ] && [ "$HEAD_RSS" -gt 0 ]; then DIFF=$((HEAD_RSS - BASE_RSS)) DIFF_PERCENT=$(echo "scale=2; ($DIFF * 100) / $BASE_RSS" | bc) - + # Convert to MB for readability BASE_MB=$(echo "scale=2; $BASE_RSS / 1048576" | bc) HEAD_MB=$(echo "scale=2; $HEAD_RSS / 1048576" | bc) DIFF_MB=$(echo "scale=2; $DIFF / 1048576" | bc) - + echo "base_mb=$BASE_MB" >> "$GITHUB_OUTPUT" echo "head_mb=$HEAD_MB" >> "$GITHUB_OUTPUT" echo "diff_mb=$DIFF_MB" >> "$GITHUB_OUTPUT" echo "diff_percent=$DIFF_PERCENT" >> "$GITHUB_OUTPUT" echo "has_data=true" >> "$GITHUB_OUTPUT" - + # Determine if this is a significant change (more than 5% increase) if [ "$(echo "$DIFF_PERCENT > 5" | bc)" -eq 1 ]; then echo "significant_increase=true" >> "$GITHUB_OUTPUT" diff --git a/package.json b/package.json index b95bf2bd71..e72bb70d5f 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ ], "private": true, "scripts": { + "convert:config": "cd packages/backend && pnpm convert:config", "build-pre": "node ./scripts/build-pre.js", "build-assets": "node ./scripts/build-assets.mjs", "build": "pnpm build-pre && pnpm -r build && pnpm build-assets", diff --git a/packages/backend/scripts/convert_config.js b/packages/backend/scripts/convert_config.js index 32576621cb..e93baa409a 100644 --- a/packages/backend/scripts/convert_config.js +++ b/packages/backend/scripts/convert_config.js @@ -25,13 +25,16 @@ const configDir = resolve(_dirname, '../../../.config'); */ function convertYamlToJson(ymlPath, jsonPath) { if (!fs.existsSync(ymlPath)) { - console.log(`${ymlPath} が見つからないためスキップします`); + console.log(`skipped: ${ymlPath} is not found`); return; } const yamlContent = fs.readFileSync(ymlPath, 'utf-8'); const jsonContent = yaml.load(yamlContent); - fs.writeFileSync(jsonPath, JSON.stringify(jsonContent, null, 2), 'utf-8'); + fs.writeFileSync(jsonPath, JSON.stringify({ + '_NOTE_': 'This file is auto-generated from YAML file. DO NOT EDIT.', + ...jsonContent, + }), 'utf-8'); console.log(`✓ ${ymlPath} → ${jsonPath}`); } @@ -53,4 +56,4 @@ if (process.env.MISSKEY_CONFIG_YML) { convertYamlToJson(customYmlPath, customJsonPath); } -console.log('設定ファイルの変換が完了しました'); +console.log('Configuration compiled');