-
Notifications
You must be signed in to change notification settings - Fork 5
GitHub Actions workflow for running GNU tar tests #45
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
Draft
kaladron
wants to merge
3
commits into
uutils:main
Choose a base branch
from
kaladron:gnu-tar-check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| name: GnuComment | ||
|
|
||
| # spell-checker:ignore zizmor backquote | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["GnuTests"] | ||
| types: | ||
| - completed | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| post-comment: | ||
| permissions: | ||
| actions: read # to list workflow runs artifacts | ||
| pull-requests: write # to comment on pr | ||
|
|
||
| runs-on: ubuntu-latest | ||
| if: > | ||
| github.event.workflow_run.event == 'pull_request' | ||
| steps: | ||
| - name: 'Download artifact' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| run_id: ${{ github.event.workflow_run.id }}, | ||
| }); | ||
| const matchArtifact = artifacts.data.artifacts.find(a => a.name === "comment"); | ||
| if (!matchArtifact) { | ||
| return core.info("No 'comment' artifact found"); | ||
| } | ||
| const download = await github.rest.actions.downloadArtifact({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| artifact_id: matchArtifact.id, | ||
| archive_format: 'zip', | ||
| }); | ||
| const fs = require('fs'); | ||
| fs.writeFileSync('${{ github.workspace }}/comment.zip', Buffer.from(download.data)); | ||
|
|
||
| - name: 'Unzip artifact' | ||
| run: unzip comment.zip | ||
|
|
||
| - name: 'Comment on PR' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const fs = require('fs'); | ||
| if (!fs.existsSync('./NR') || !fs.existsSync('./result.txt')) { | ||
| return core.info("No NR or result.txt found, skipping comment"); | ||
| } | ||
| const issue_number = Number(fs.readFileSync('./NR', 'utf8').trim()); | ||
| const content = fs.readFileSync('./result.txt', 'utf8').trim(); | ||
| if (content.length > 0) { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: issue_number, | ||
| body: `### GNU Testsuite Comparison\n\n\`\`\`\n${content}\n\`\`\`` | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| name: GnuTests | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - '*' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| env: | ||
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | ||
| TEST_FULL_SUMMARY_FILE: 'gnu-full-result.json' | ||
| TEST_SUMMARY_FILE: 'gnu-result.json' | ||
| AGGREGATED_SUMMARY_FILE: 'aggregated-result.json' | ||
|
|
||
| jobs: | ||
| native: | ||
| name: Run GNU tests (native) | ||
| runs-on: ubuntu-24.04 | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| steps: | ||
| - name: Checkout code (uutils) | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: 'uutils' | ||
| persist-credentials: false | ||
|
|
||
| - uses: dtolnay/rust-toolchain@master | ||
| with: | ||
| toolchain: stable | ||
| components: rustfmt | ||
|
|
||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: "./uutils -> target" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y autoconf autopoint bison texinfo gperf gcc g++ gdb python3-pyinotify jq valgrind libacl1-dev libattr1-dev libcap-dev libselinux1-dev attr quilt gettext | ||
|
|
||
| - name: Build binaries and GNU tar | ||
| run: | | ||
| cd 'uutils' | ||
| bash util/build-gnu.sh --release-build | ||
|
|
||
| - name: Run GNU tests | ||
| continue-on-error: true | ||
| run: | | ||
| cd 'uutils' | ||
| bash util/run-gnu-test.sh | ||
|
|
||
| - name: Extract info into JSON | ||
| run : | | ||
| python uutils/util/gnu-json-result.py gnu/tests > ${{ env.TEST_FULL_SUMMARY_FILE }} | ||
|
|
||
| - name: Upload full results | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: gnu-full-result | ||
| path: ${{ env.TEST_FULL_SUMMARY_FILE }} | ||
|
|
||
| - name: Compress logs | ||
| run : | | ||
| gzip gnu/tests/*/*.log | ||
|
|
||
| - name: Upload logs | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-logs | ||
| path: | | ||
| gnu/tests/*.log | ||
| gnu/tests/*/*.log.gz | ||
|
|
||
| aggregate: | ||
| needs: [native] | ||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| pull-requests: read | ||
| name: Aggregate GNU test results | ||
| runs-on: ubuntu-24.04 | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: 'uutils' | ||
| persist-credentials: false | ||
|
|
||
| - name: Retrieve reference artifacts | ||
| uses: dawidd6/action-download-artifact@v9 | ||
| continue-on-error: true | ||
| with: | ||
| workflow: GnuTests.yml | ||
| branch: "${{ env.DEFAULT_BRANCH }}" | ||
| workflow_conclusion: completed | ||
| path: "reference" | ||
|
|
||
| - name: Download results | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: gnu-full-result | ||
| path: results | ||
|
|
||
| - name: Summarize results | ||
| id: summary | ||
| run: | | ||
| eval $(python3 uutils/util/analyze-gnu-results.py -o=${{ env.AGGREGATED_SUMMARY_FILE }} results/*.json) | ||
|
|
||
| echo "GNU tests summary = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR / SKIP: $SKIP" | ||
|
|
||
| jq -n \ | ||
| --arg date "$(date --rfc-email)" \ | ||
| --arg sha "$GITHUB_SHA" \ | ||
| --arg total "$TOTAL" \ | ||
| --arg pass "$PASS" \ | ||
| --arg skip "$SKIP" \ | ||
| --arg fail "$FAIL" \ | ||
| --arg xpass "$XPASS" \ | ||
| --arg error "$ERROR" \ | ||
| '{($date): { sha: $sha, total: $total, pass: $pass, skip: $skip, fail: $fail, xpass: $xpass, error: $error, }}' > '${{ env.TEST_SUMMARY_FILE }}' | ||
|
|
||
| - name: Prepare comparison | ||
| if: github.event_name == 'pull_request' | ||
| run: | | ||
| mkdir -p comment | ||
| echo "${{ github.event.pull_request.number }}" > comment/NR | ||
|
|
||
| - name: Compare results | ||
| continue-on-error: true | ||
| run: | | ||
| REF_SUMMARY_FILE='reference/aggregated-result/${{ env.AGGREGATED_SUMMARY_FILE }}' | ||
| CURRENT_SUMMARY_FILE='${{ env.AGGREGATED_SUMMARY_FILE }}' | ||
| IGNORE_INTERMITTENT="uutils/.github/workflows/ignore-intermittent.txt" | ||
|
|
||
| OUTPUT_ARG="" | ||
| if [ "${{ github.event_name }}" == "pull_request" ]; then | ||
| OUTPUT_ARG="--output comment/result.txt" | ||
| fi | ||
|
|
||
| if [ -f "${REF_SUMMARY_FILE}" ]; then | ||
| python3 uutils/util/compare_test_results.py \ | ||
| --ignore-file "${IGNORE_INTERMITTENT}" \ | ||
| ${OUTPUT_ARG} \ | ||
| "${CURRENT_SUMMARY_FILE}" "${REF_SUMMARY_FILE}" | ||
| else | ||
| echo "No reference summary found. Skipping comparison." | ||
| fi | ||
|
|
||
| - name: Upload summary | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-summary | ||
| path: "${{ env.TEST_SUMMARY_FILE }}" | ||
|
|
||
| - name: Upload aggregated results | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: aggregated-result | ||
| path: ${{ env.AGGREGATED_SUMMARY_FILE }} | ||
|
|
||
| - name: Upload comment artifact | ||
| if: github.event_name == 'pull_request' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: comment | ||
| path: comment | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # List of intermittent GNU tests to ignore during comparison | ||
| # Add test paths here (one per line, without .log extension) | ||
| # Example: tests/ls/stat-free-color |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you remove preinstalled tools for faster setup?
https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md