Skip to content

Commit

Permalink
Switch to using js script to download builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbings committed Jan 20, 2025
1 parent 10c24ca commit 8685fa5
Showing 1 changed file with 79 additions and 34 deletions.
113 changes: 79 additions & 34 deletions .github/workflows/compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ name: External-testsuites

jobs:
gnu-tests:
permissions:
actions: read

name: Run GNU findutils tests
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -38,6 +41,7 @@ jobs:
- name: Extract testing info
shell: bash
run: |
- name: Upload gnu-test-report
uses: actions/upload-artifact@v4
with:
Expand All @@ -51,31 +55,52 @@ jobs:
with:
name: gnu-result
path: gnu-result.json
- name: Download the result
uses: dawidd6/action-download-artifact@v7
with:
workflow: compat.yml
workflow_conclusion: completed
name: gnu-result
repo: uutils/findutils
branch: main
path: dl
- name: Download the log
uses: dawidd6/action-download-artifact@v7
- name: Download artifacts (gnu-result and gnu-test-report)
uses: actions/github-script@v7
with:
workflow: compat.yml
workflow_conclusion: completed
name: gnu-test-report
repo: uutils/findutils
branch: main
path: dl
script: |
let fs = require('fs');
fs.mkdirSync('${{ github.workspace }}/dl', { recursive: true });
async function downloadArtifact(artifactName) {
// List all artifacts from the workflow run
let artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.run_id }},
});
// Find the specified artifact
let matchArtifact = artifacts.data.artifacts.find((artifact) => artifact.name === artifactName);
if (!matchArtifact) {
throw new Error(`Artifact "${artifactName}" not found.`);
}
// Download the artifact
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
// Save the artifact to a file
fs.writeFileSync(`${{ github.workspace }}/dl/${artifactName}.zip`, Buffer.from(download.data));
}
// Download the required artifacts
await downloadArtifact("gnu-result");
await downloadArtifact("gnu-test-report");
- name: Compare failing tests against master
shell: bash
run: |
./findutils/util/diff-gnu.sh ./dl ./findutils.gnu
- name: Compare against main results
shell: bash
run: |
unzip dl/gnu-result.zip -d dl/
unzip dl/gnu-test-report.zip -d dl/
mv dl/gnu-result.json latest-gnu-result.json
python findutils/util/compare_gnu_result.py
Expand Down Expand Up @@ -120,31 +145,51 @@ jobs:
with:
name: bfs-result
path: bfs-result.json
- name: Download the result
uses: dawidd6/action-download-artifact@v7
with:
workflow: compat.yml
workflow_conclusion: completed
name: bfs-result
repo: uutils/findutils
branch: main
path: dl
- name: Download the log
uses: dawidd6/action-download-artifact@v7
- name: Download artifacts (gnu-result and bfs-test-report)
uses: actions/github-script@v7
with:
workflow: compat.yml
workflow_conclusion: completed
name: bfs-test-report
repo: uutils/findutils
branch: main
path: dl
script: |
let fs = require('fs');
fs.mkdirSync('${{ github.workspace }}/dl', { recursive: true });
async function downloadArtifact(artifactName) {
// List all artifacts from the workflow run
let artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.run_id }},
});
// Find the specified artifact
let matchArtifact = artifacts.data.artifacts.find((artifact) => artifact.name === artifactName);
if (!matchArtifact) {
throw new Error(`Artifact "${artifactName}" not found.`);
}
// Download the artifact
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
// Save the artifact to a file
fs.writeFileSync(`${{ github.workspace }}/dl/${artifactName}.zip`, Buffer.from(download.data));
}
// Download the required artifacts
await downloadArtifact("bfs-result");
await downloadArtifact("bfs-test-report");
- name: Compare failing tests against main
shell: bash
run: |
./findutils/util/diff-bfs.sh dl/tests.log bfs/tests.log
- name: Compare against main results
shell: bash
run: |
unzip dl/bfs-result.zip -d dl/
unzip dl/bfs-test-report.zip -d dl/
mv dl/bfs-result.json latest-bfs-result.json
python findutils/util/compare_bfs_result.py
Expand Down

0 comments on commit 8685fa5

Please sign in to comment.