Skip to content

Official Testsuite Runner #8

Official Testsuite Runner

Official Testsuite Runner #8

name: Rust TestSuite Runner Test and Publish
on:
push:
branches-ignore:
- "gh-readonly-queue/**"
- "example/**"
pull_request:
merge_group:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Set Rustup Version
run: rustup update stable --force && rustup default 1.76.0
- name: Run tests
run: |
cargo test --test=wasm_spec_testsuite -- --nocapture >> testsuite_output.txt
- name: Upload test output
uses: actions/upload-artifact@v3
with:
name: test-results
path: testsuite_output.txt # Wildcard to match the file with timestamp
deploy:
needs: test # Run after the 'test' job
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download test output
uses: actions/download-artifact@v3
with:
name: test-results
- name: Rename and store test output
run: |
# Move the test output to a new name
timestamp=$(date +%s)
mv testsuite_output.txt testrunner_${timestamp}.txt
- name: Upload renamed test result
uses: actions/upload-artifact@v3
with:
name: testrunner-output
path: testrunner_*.txt
notify-pr:
needs: deploy # Run after the 'deploy' job
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Post PR comment with file URL
run: |
# Extract the file URL based on the repository and timestamp
artifact_url=$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/artifacts" | \
jq -r '.artifacts[] | select(.name=="testrunner-output") | .archive_download_url')
# Post the comment to the PR
curl -X POST \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
--data "{\"body\":\"Test results are available at: $artifact_url\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"