Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash committed Dec 10, 2024
1 parent 1a3431e commit 26296d9
Show file tree
Hide file tree
Showing 8 changed files with 2,666 additions and 68 deletions.
84 changes: 42 additions & 42 deletions .github/workflows/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,45 +71,45 @@ jobs:
- name: Push changes
run: git fetch && git pull --rebase && git push

deploy:
needs: collect-data
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Pull latest
run: git fetch && git pull --rebase

- name: Check commit
run: git log -5

- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install pnpm
run: npm install -g pnpm

- name: pnpm install
run: pnpm install
working-directory: ./webapp

- name: pnpm run build
run: |
pnpm run build
sed -i '' 's|="/assets|="/moon-build-dashboard/assets|g' ./dist/index.html
sed -i '' 's|"/linux/latest_data.jsonl.gz"|"/moon-build-dashboard/linux/latest_data.jsonl.gz"|g' ./dist/assets/*.js
sed -i '' 's|"/windows/latest_data.jsonl.gz"|"/moon-build-dashboard/windows/latest_data.jsonl.gz"|g' ./dist/assets/*.js
sed -i '' 's|"/mac/latest_data.jsonl.gz"|"/moon-build-dashboard/mac/latest_data.jsonl.gz"|g' ./dist/assets/*.js
working-directory: ./webapp

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./webapp/dist
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
force_orphan: true
# deploy:
# needs: collect-data
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v4

# - name: Pull latest
# run: git fetch && git pull --rebase

# - name: Check commit
# run: git log -5

# - name: Setup Node.js 22
# uses: actions/setup-node@v4
# with:
# node-version: '22'

# - name: Install pnpm
# run: npm install -g pnpm

# - name: pnpm install
# run: pnpm install
# working-directory: ./webapp

# - name: pnpm run build
# run: |
# pnpm run build
# sed -i '' 's|="/assets|="/moon-build-dashboard/assets|g' ./dist/index.html
# sed -i '' 's|"/linux/latest_data.jsonl.gz"|"/moon-build-dashboard/linux/latest_data.jsonl.gz"|g' ./dist/assets/*.js
# sed -i '' 's|"/windows/latest_data.jsonl.gz"|"/moon-build-dashboard/windows/latest_data.jsonl.gz"|g' ./dist/assets/*.js
# sed -i '' 's|"/mac/latest_data.jsonl.gz"|"/moon-build-dashboard/mac/latest_data.jsonl.gz"|g' ./dist/assets/*.js
# working-directory: ./webapp

# - name: Deploy to GitHub Pages
# uses: peaceiris/actions-gh-pages@v4
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_branch: gh-pages
# publish_dir: ./webapp/dist
# user_name: 'github-actions[bot]'
# user_email: 'github-actions[bot]@users.noreply.github.com'
# force_orphan: true
826 changes: 826 additions & 0 deletions webapp/public/linux/latest_data.json

Large diffs are not rendered by default.

Binary file removed webapp/public/linux/latest_data.jsonl.gz
Binary file not shown.
826 changes: 826 additions & 0 deletions webapp/public/mac/latest_data.json

Large diffs are not rendered by default.

Binary file removed webapp/public/mac/latest_data.jsonl.gz
Binary file not shown.
826 changes: 826 additions & 0 deletions webapp/public/windows/latest_data.json

Large diffs are not rendered by default.

Binary file removed webapp/public/windows/latest_data.jsonl.gz
Binary file not shown.
172 changes: 146 additions & 26 deletions webapp/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,27 +284,134 @@ const App = () => {
});
};

// 获取第一个失败的测试信息
const getFirstFailure = (index: number, data: PlatformData, useBleedingEdge: boolean = false): string | null => {
// 检查单个项目的状态
const checkItemStatus = (cbt: CBT | null, phase: string, backend: string) => {
if (!cbt) return false;
return cbt[phase as keyof CBT][backend as keyof BackendState].status === "Success";
};

// 检查工具链版本之间的差异(重点一)
const checkToolchainDifference = (index: number, data: PlatformData) => {
const platforms: Platform[] = ["mac", "windows", "linux"];
const phases = ['check', 'build', 'test'];
const backends = ['wasm', 'wasm_gc', 'js'];

for (const platform of platforms) {
const platformData = data[platform];
if (!platformData) continue;


const stableEntry = platformData.stable_release_data[index];
const bleedingEntry = platformData.bleeding_release_data[index];
if (!stableEntry || !bleedingEntry) continue;

for (const phase of phases) {
for (const backend of backends) {
const stableSuccess = stableEntry.cbts.some(cbt => checkItemStatus(cbt, phase, backend));
const bleedingSuccess = bleedingEntry.cbts.some(cbt => checkItemStatus(cbt, phase, backend));

if (stableSuccess && !bleedingSuccess) {
return `Regression detected: ${platform}'s ${backend} ${phase} passed in stable but failed in bleeding-edge`;
}
}
}
}
return null;
};

// 检查操作系统之间的差异(重点二)
const checkPlatformDifference = (index: number, data: PlatformData, useBleedingEdge: boolean = false) => {
const platforms: Platform[] = ["mac", "windows", "linux"];
const phases = ['check', 'build', 'test'];
const backends = ['wasm', 'wasm_gc', 'js'];

for (const phase of phases) {
for (const backend of backends) {
const results = new Map<Platform, boolean>();

for (const platform of platforms) {
const platformData = data[platform];
if (!platformData) continue;

const entry = useBleedingEdge ?
platformData.bleeding_release_data[index] :
platformData.stable_release_data[index];
if (!entry) continue;

results.set(platform, entry.cbts.some(cbt => checkItemStatus(cbt, phase, backend)));
}

const successPlatforms = Array.from(results.entries()).filter(([_, success]) => success).map(([platform]) => platform);
const failurePlatforms = Array.from(results.entries()).filter(([_, success]) => !success).map(([platform]) => platform);

if (successPlatforms.length > 0 && failurePlatforms.length > 0) {
const version = useBleedingEdge ? "bleeding-edge" : "stable";
return `Platform inconsistency in ${version}: ${backend} ${phase} passed on ${successPlatforms.join(', ')} but failed on ${failurePlatforms.join(', ')}`;
}
}
}
return null;
};

// 检查后端之间的差异(重点三)
const checkBackendDifference = (index: number, data: PlatformData, useBleedingEdge: boolean = false) => {
const platforms: Platform[] = ["mac", "windows", "linux"];
const phases = ['check', 'build', 'test'];
const backends = ['wasm', 'wasm_gc', 'js'];

for (const platform of platforms) {
const platformData = data[platform];
if (!platformData) continue;

const entry = useBleedingEdge ?
platformData.bleeding_release_data[index] :
platformData.stable_release_data[index];
if (!entry) continue;

for (const cbt of entry.cbts) {
if (!cbt) continue;
for (const phase of ['check', 'build', 'test']) {
for (const backend of ['wasm', 'wasm_gc', 'js']) {
const result = cbt[phase as keyof CBT][backend as keyof BackendState];
if (result.status === "Failure") {
return `${platform} ${phase} failed on ${backend}`;
}
}

for (const phase of phases) {
const backendResults = backends.map(backend => ({
backend,
success: entry.cbts.some(cbt => checkItemStatus(cbt, phase, backend))
}));

const successBackends = backendResults.filter(r => r.success).map(r => r.backend);
const failureBackends = backendResults.filter(r => !r.success).map(r => r.backend);

if (successBackends.length > 0 && failureBackends.length > 0) {
const version = useBleedingEdge ? "bleeding-edge" : "stable";
return `Backend inconsistency in ${version} on ${platform}: ${phase} passed on ${successBackends.join(', ')} but failed on ${failureBackends.join(', ')}`;
}
}
}
return null;
};

// 检查构建阶段之间的差异(重点四)
const checkPhasesDifference = (index: number, data: PlatformData, useBleedingEdge: boolean = false) => {
const platforms: Platform[] = ["mac", "windows", "linux"];
const phases = ['check', 'build', 'test'];
const backends = ['wasm', 'wasm_gc', 'js'];

for (const platform of platforms) {
const platformData = data[platform];
if (!platformData) continue;

const entry = useBleedingEdge ?
platformData.bleeding_release_data[index] :
platformData.stable_release_data[index];
if (!entry) continue;

for (const backend of backends) {
const phaseResults = phases.map(phase => ({
phase,
success: entry.cbts.some(cbt => checkItemStatus(cbt, phase, backend))
}));

const successPhases = phaseResults.filter(r => r.success).map(r => r.phase);
const failurePhases = phaseResults.filter(r => !r.success).map(r => r.phase);

if (successPhases.length > 0 && failurePhases.length > 0) {
const version = useBleedingEdge ? "bleeding-edge" : "stable";
return `Phase inconsistency in ${version} on ${platform}'s ${backend}: passed ${successPhases.join(', ')} but failed ${failurePhases.join(', ')}`;
}
}
}
Expand All @@ -313,27 +420,41 @@ const App = () => {

// 生成项目状态摘要
const generateSummary = (index: number, data: PlatformData): { text: string; status: 'success' | 'warning' | 'error' } => {
// 首先检查是否所有测试都通过
const stableSuccess = isAllSuccess(index, data);
const bleedingSuccess = isAllSuccess(index, data, true);

if (stableSuccess && bleedingSuccess) {
return { text: "All tests passed in both stable and bleeding-edge on all platforms", status: 'success' };
}

if (stableSuccess && !bleedingSuccess) {
const failure = getFirstFailure(index, data, true);
return {
text: `Stable passed on all platforms, but bleeding-edge has issues: ${failure}`,
status: 'warning'
};
// 按优先级检查各种差异
const toolchainDiff = checkToolchainDifference(index, data);
if (toolchainDiff) {
return { text: toolchainDiff, status: 'error' };
}

const platformDiffStable = checkPlatformDifference(index, data);
const platformDiffBleeding = checkPlatformDifference(index, data, true);
if (platformDiffStable || platformDiffBleeding) {
return { text: platformDiffStable || platformDiffBleeding!, status: 'error' };
}

const backendDiffStable = checkBackendDifference(index, data);
const backendDiffBleeding = checkBackendDifference(index, data, true);
if (backendDiffStable || backendDiffBleeding) {
return { text: backendDiffStable || backendDiffBleeding!, status: 'error' };
}

const phaseDiffStable = checkPhasesDifference(index, data);
const phaseDiffBleeding = checkPhasesDifference(index, data, true);
if (phaseDiffStable || phaseDiffBleeding) {
return { text: phaseDiffStable || phaseDiffBleeding!, status: 'error' };
}

if (!stableSuccess) {
const failure = getFirstFailure(index, data);
return {
text: `Issues in stable release: ${failure}`,
status: 'error'
};
// 如果没有发现具体的差异模式,返回一般性的失败信息
if (!stableSuccess || !bleedingSuccess) {
return { text: `Other failure`, status: 'error' };
}

return { text: "No data available", status: 'error' };
Expand All @@ -347,7 +468,6 @@ const App = () => {
return platformData.mac.stable_release_data.map((_, index) => {
const macData = platformData.mac!;
const stableEntry = macData.stable_release_data[index];
const bleedingEntry = macData.bleeding_release_data[index];
if (!stableEntry) return null;

const source = macData.sources[stableEntry.source];
Expand Down

0 comments on commit 26296d9

Please sign in to comment.