Skip to content
Draft
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
66 changes: 66 additions & 0 deletions .github/workflows/GnuComment.yml
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\`\`\``
});
}
178 changes: 178 additions & 0 deletions .github/workflows/GnuTests.yml
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


- 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
3 changes: 3 additions & 0 deletions .github/workflows/ignore-intermittent.txt
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
Loading
Loading