Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix issues related to downloading builds in ci. #487

Merged
merged 5 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 81 additions & 36 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 All @@ -27,7 +30,7 @@ jobs:
shell: bash
run: |
# Enable sources & install dependencies
sudo find /etc/apt/sources.list* -type f -exec sed -i 'p; s/^deb /deb-src /' '{}' +
sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
sudo apt-get update
sudo apt-get build-dep findutils
- name: Run GNU tests
Expand All @@ -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@v6
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@v6
- 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 All @@ -102,7 +127,7 @@ jobs:
shell: bash
run: |
# Enable sources & install dependencies
sudo find /etc/apt/sources.list* -type f -exec sed -i 'p; s/^deb /deb-src /' '{}' +
sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
sudo apt-get update
sudo apt-get build-dep bfs
- name: Run BFS tests
Expand All @@ -120,31 +145,51 @@ jobs:
with:
name: bfs-result
path: bfs-result.json
- name: Download the result
uses: dawidd6/action-download-artifact@v6
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@v6
- 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
1 change: 0 additions & 1 deletion src/find/matchers/logical_matchers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ impl Matcher for NotMatcher {
}

#[cfg(test)]

mod tests {
use super::*;
use crate::find::matchers::quit::QuitMatcher;
Expand Down
2 changes: 1 addition & 1 deletion src/find/matchers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub struct MatcherIO<'a> {
deps: &'a dyn Dependencies,
}

impl<'a> MatcherIO<'a> {
impl MatcherIO<'_> {
pub fn new(deps: &dyn Dependencies) -> MatcherIO<'_> {
MatcherIO {
should_skip_dir: false,
Expand Down
2 changes: 1 addition & 1 deletion src/find/matchers/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ impl Matcher for PruneMatcher {
true
}
}
#[cfg(test)]

#[cfg(test)]
mod tests {
use super::*;
use crate::find::matchers::tests::get_dir_entry_for;
Expand Down
Loading