Skip to content

Commit

Permalink
Fix test related CI workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
lauxjpn committed Mar 5, 2024
1 parent 1f652f9 commit 0c67eec
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions .github/workflows/test_results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,40 @@ jobs:
which node
node --version
- name: 'Check Artifact'
id: CheckArtifact
uses: actions/github-script@v7
with:
script: |
var allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "test-results";
});
if (artifacts.length > 0) {
core.setOutput('testResultsArtifactAvailable', 'true');
console.log('Test results artifact found.');
}
# - name: 'Check Artifact'
# id: CheckArtifact
# uses: actions/github-script@v7
# with:
# script: |
# var allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
# owner: context.repo.owner,
# repo: context.repo.repo,
# run_id: ${{ github.event.workflow_run.id }},
# });
#
# var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
# return artifact.name == "test-results";
# });
#
# if (artifacts.length > 0) {
# core.setOutput('testResultsArtifactAvailable', 'true');
# console.log('Test results artifact found.');
# }
# The dorny/test-reporter@v1 action doesn't support actions/upload-artifact@v4 yet.
# We therefore download the artifact manually and feed it to dorny/test-reporter@v1 as local files.
- name: 'Download Artifact'
id: DownloadArtifact
if: steps.CheckArtifact.outputs.testResultsArtifactAvailable == 'true'
uses: actions/download-artifact@v4
continue-on-error: true
with:
# name: test-results
path: test-results
merge-multiple: true
# run-id: ${{ github.event.workflow_run.id }}
# - name: 'Download Artifact'
# id: DownloadArtifact
# if: steps.CheckArtifact.outputs.testResultsArtifactAvailable == 'true'
# uses: actions/download-artifact@v4
# continue-on-error: true
# with:
# # name: test-results
# path: test-results
# merge-multiple: true
# # run-id: ${{ github.event.workflow_run.id }}
- name: 'Download Test Results'
id: DownloadTestResults
if: steps.DownloadArtifact.outcome == 'failure'
# if: steps.DownloadArtifact.outcome == 'failure'
uses: actions/github-script@v7
with:
script: |
Expand Down Expand Up @@ -100,13 +100,13 @@ jobs:
}
- name: 'Extract Artifact'
id: ExtractArtifact
if: steps.DownloadTestResults.conclusion == 'success' && steps.DownloadTestResults.outputs.hasTestResultsArtifact == 'true'
if: steps.DownloadTestResults.outputs.hasTestResultsArtifact == 'true'
shell: pwsh
run: |
Expand-Archive test-results.zip -DestinationPath './test-results' -Force
dir -Recurse | Select-Object -ExpandProperty FullName
- name: 'Publish Test Report'
if: steps.DownloadArtifact.outcome == 'success' || steps.ExtractArtifact.conclusion == 'success'
if: steps.ExtractArtifact.conclusion == 'success'
uses: dorny/test-reporter@v1
env:
#
Expand Down

0 comments on commit 0c67eec

Please sign in to comment.