From 6ce5ffaa9e277dd73802a455cf7c0e66b8a1b06a Mon Sep 17 00:00:00 2001 From: hanbings Date: Mon, 20 Jan 2025 02:49:28 +0800 Subject: [PATCH 1/5] Adjust CI to new configuration files for Ubuntu 24.04. --- .github/workflows/compat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compat.yml b/.github/workflows/compat.yml index 6523bae..e52dd86 100644 --- a/.github/workflows/compat.yml +++ b/.github/workflows/compat.yml @@ -27,7 +27,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 From 33cd6573aa80e036731c9dbfd1cdcd295c71da67 Mon Sep 17 00:00:00 2001 From: hanbings Date: Mon, 20 Jan 2025 03:00:24 +0800 Subject: [PATCH 2/5] Adjust CI to new configuration files for Ubuntu 24.04. --- .github/workflows/compat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compat.yml b/.github/workflows/compat.yml index e52dd86..0f970ff 100644 --- a/.github/workflows/compat.yml +++ b/.github/workflows/compat.yml @@ -102,7 +102,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 From 10c24ca5f1a8b789ee16e8124ff6d065898e6380 Mon Sep 17 00:00:00 2001 From: hanbings Date: Mon, 20 Jan 2025 03:25:00 +0800 Subject: [PATCH 3/5] Update action-download-artifact to try to fix the download issue. --- .github/workflows/compat.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/compat.yml b/.github/workflows/compat.yml index 0f970ff..86c61d7 100644 --- a/.github/workflows/compat.yml +++ b/.github/workflows/compat.yml @@ -52,7 +52,7 @@ jobs: name: gnu-result path: gnu-result.json - name: Download the result - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v7 with: workflow: compat.yml workflow_conclusion: completed @@ -61,7 +61,7 @@ jobs: branch: main path: dl - name: Download the log - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v7 with: workflow: compat.yml workflow_conclusion: completed @@ -121,7 +121,7 @@ jobs: name: bfs-result path: bfs-result.json - name: Download the result - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v7 with: workflow: compat.yml workflow_conclusion: completed @@ -130,7 +130,7 @@ jobs: branch: main path: dl - name: Download the log - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v7 with: workflow: compat.yml workflow_conclusion: completed From 8685fa5c64d0c6a54103e19a63df567a259c0d4f Mon Sep 17 00:00:00 2001 From: hanbings Date: Mon, 20 Jan 2025 16:16:28 +0800 Subject: [PATCH 4/5] Switch to using js script to download builds. --- .github/workflows/compat.yml | 113 ++++++++++++++++++++++++----------- 1 file changed, 79 insertions(+), 34 deletions(-) diff --git a/.github/workflows/compat.yml b/.github/workflows/compat.yml index 86c61d7..b2bea97 100644 --- a/.github/workflows/compat.yml +++ b/.github/workflows/compat.yml @@ -4,6 +4,9 @@ name: External-testsuites jobs: gnu-tests: + permissions: + actions: read + name: Run GNU findutils tests runs-on: ubuntu-latest steps: @@ -38,6 +41,7 @@ jobs: - name: Extract testing info shell: bash run: | + - name: Upload gnu-test-report uses: actions/upload-artifact@v4 with: @@ -51,24 +55,43 @@ jobs: with: name: gnu-result path: gnu-result.json - - name: Download the result - 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-result - repo: uutils/findutils - branch: main - path: dl - - name: Download the log - uses: dawidd6/action-download-artifact@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: | @@ -76,6 +99,8 @@ jobs: - 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 @@ -120,24 +145,42 @@ jobs: with: name: bfs-result path: bfs-result.json - - name: Download the result - 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-result - repo: uutils/findutils - branch: main - path: dl - - name: Download the log - uses: dawidd6/action-download-artifact@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: | @@ -145,6 +188,8 @@ jobs: - 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 From f536f813e22abc61f8584c849d91459ebac972d2 Mon Sep 17 00:00:00 2001 From: hanbings Date: Mon, 20 Jan 2025 16:22:17 +0800 Subject: [PATCH 5/5] Run cargo clippy. --- src/find/matchers/logical_matchers.rs | 1 - src/find/matchers/mod.rs | 2 +- src/find/matchers/prune.rs | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/find/matchers/logical_matchers.rs b/src/find/matchers/logical_matchers.rs index 8ec70f6..f2067da 100644 --- a/src/find/matchers/logical_matchers.rs +++ b/src/find/matchers/logical_matchers.rs @@ -356,7 +356,6 @@ impl Matcher for NotMatcher { } #[cfg(test)] - mod tests { use super::*; use crate::find::matchers::quit::QuitMatcher; diff --git a/src/find/matchers/mod.rs b/src/find/matchers/mod.rs index 03fbef9..2529631 100644 --- a/src/find/matchers/mod.rs +++ b/src/find/matchers/mod.rs @@ -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, diff --git a/src/find/matchers/prune.rs b/src/find/matchers/prune.rs index 36e2cff..4c837d7 100644 --- a/src/find/matchers/prune.rs +++ b/src/find/matchers/prune.rs @@ -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;