Skip to content

Commit

Permalink
Upload check-ci and long-check-ci results as artifacts (deephaven#547)
Browse files Browse the repository at this point in the history
Setup publish job as separate workflow.
  • Loading branch information
devinrsmith authored May 9, 2021
1 parent c76e6e7 commit 6013c63
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 14 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/check-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@ jobs:
arguments: --scan quick
gradle-version: wrapper

- name: Publish Test Results
uses: scacap/action-surefire-report@v1
- name: Upload Test Results
uses: actions/upload-artifact@v2
if: always()
env:
NODE_OPTIONS: '--max_old_space_size=4096'
with:
check_name: check-ci test report
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: '**/build/test-results/test/TEST-*.xml'
name: check-ci-results
path: '**/build/test-results/test/TEST-*.xml'
11 changes: 4 additions & 7 deletions .github/workflows/long-check-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ jobs:
arguments: --scan --continue check
gradle-version: wrapper

- name: Publish Test Results
uses: scacap/action-surefire-report@v1
- name: Upload Test Results
uses: actions/upload-artifact@v2
if: always()
env:
NODE_OPTIONS: '--max_old_space_size=4096'
with:
check_name: long-check-ci test report
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: '**/build/test-results/test/TEST-*.xml'
name: long-check-ci-results
path: '**/build/test-results/test/TEST-*.xml'
48 changes: 48 additions & 0 deletions .github/workflows/publish-check-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Check CI results

# WARNING:
# workflow_run provides read-write repo token and access to secrets.
# Do *not* merge changes to this file without the proper review.
# We should only be running trusted code here.
on:
workflow_run:
workflows: ["Check CI"]
types:
- completed

jobs:
# Job based on https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
publish-check-ci:
runs-on: ubuntu-20.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
# Unfortunately, the official actions/download-artifact action is very limited in scope.
# Can't use it yet in this context, https://github.com/actions/download-artifact/issues/60
- name: Download artifact
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "check-ci-results"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/check-ci-results.zip', Buffer.from(download.data));
- run: unzip check-ci-results.zip
- name: Publish Test Results
uses: scacap/[email protected]
env:
NODE_OPTIONS: '--max_old_space_size=4096'
with:
check_name: check-ci test report
report_paths: '**/build/test-results/test/TEST-*.xml'
48 changes: 48 additions & 0 deletions .github/workflows/publish-long-check-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Long CI results

# WARNING:
# workflow_run provides read-write repo token and access to secrets.
# Do *not* merge changes to this file without the proper review.
# We should only be running trusted code here.
on:
workflow_run:
workflows: ["Long Check CI"]
types:
- completed

jobs:
# Job based on https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
publish-long-check-ci:
runs-on: ubuntu-20.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
# Unfortunately, the official actions/download-artifact action is very limited in scope.
# Can't use it yet in this context, https://github.com/actions/download-artifact/issues/60
- name: Download artifact
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "long-check-ci-results"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/long-check-ci-results.zip', Buffer.from(download.data));
- run: unzip long-check-ci-results.zip
- name: Publish Test Results
uses: scacap/[email protected]
env:
NODE_OPTIONS: '--max_old_space_size=4096'
with:
check_name: long-check-ci test report
report_paths: '**/build/test-results/test/TEST-*.xml'

0 comments on commit 6013c63

Please sign in to comment.