chore: try to make the runner upload output #1
Workflow file for this run
This file contains 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
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 | |
- name: Upload test output | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: testsuite_runner_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_runner_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 | |
timestamp=$(date +%s) | |
file_url="https://github.com/${{ github.repository }}/actions/artifacts/testrunner_${timestamp}.txt" | |
# 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: $file_url\"}" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" |