Fix test related CI workflows. (#227)

ci/general_test
Laurents Meyer 2 years ago committed by GitHub
parent 6ee5cd2abe
commit 1f652f9b84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -28,15 +28,15 @@ jobs:
run_id: ${{ github.event.workflow_run.id }},
});
var greenTestArtifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "green-tests"
var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "green-tests";
});
if (greenTestArtifacts.length > 0) {
if (artifacts.length > 0) {
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: greenTestArtifacts[0].id,
artifact_id: artifacts[0].id,
archive_format: 'zip',
});
@ -45,12 +45,13 @@ jobs:
core.setOutput('hasGreenTestsArtifacts', 'true');
}
- name: 'Download artifact'
- name: 'Extract Artifact'
id: ExtractArtifact
if: steps.DownloadGreenTests.outputs.hasGreenTestsArtifacts == 'true'
shell: pwsh
run: Expand-Archive green-tests.zip -DestinationPath './test/EFCore.Jet.FunctionalTests/GreenTests' -Force
- name: 'Commit Green Tests'
if: steps.DownloadGreenTests.outputs.hasGreenTestsArtifacts == 'true'
if: steps.ExtractArtifact.conclusion == 'success'
shell: pwsh
run: |
if ((git status -s).Length -gt 0) {

@ -342,8 +342,8 @@ jobs:
needs: BuildAndTest
if: always()
outputs:
testResultsAvailable: ${{ steps.MergeTestResults.result == 'success' }}
greenTestsAvailable: ${{ steps.MergeGreenTests.result == 'success' }}
testResultsAvailable: ${{ steps.MergeTestResults.conclusion == 'success' }}
greenTestsAvailable: ${{ steps.MergeGreenTests.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: 'Check Test Results Artifacts'
@ -358,12 +358,12 @@ jobs:
});
var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("test-results_")
return artifact.name.startsWith("test-results_");
});
if (artifacts.length > 0) {
core.setOutput('artifactsAvailable', 'true');
console.log('Test results artifacts found.')
console.log('Test results artifacts found.');
}
- name: 'Merge Test Results'
id: MergeTestResults
@ -385,12 +385,12 @@ jobs:
});
var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("green-tests_")
return artifact.name.startsWith("green-tests_");
});
if (artifacts.length > 0) {
core.setOutput('artifactsAvailable', 'true');
console.log('Green Tests Artifacts found.')
console.log('Green Tests Artifacts found.');
}
- name: 'Merge Green Tests'
id: MergeGreenTests
@ -407,12 +407,17 @@ jobs:
if: always()
runs-on: ubuntu-latest
outputs:
hasGreenTestsArtifacts: ${{ steps.CheckGreenTestsArtifacts.outputs.hasGreenTestsArtifacts }}
hasGreenTestsArtifacts: ${{ steps.CheckGreenTestsArtifacts.outputs.hasGreenTestsArtifacts == 'true' }}
steps:
# - name: 'Debug'
# shell: pwsh
# env:
# NEEDS_CONTEXT: ${{ toJson(needs) }}
# run: |
# echo $env:NEEDS_CONTEXT
- name: 'Download Green Tests'
if: needs.MergeArtifacts.outputs.greenTestsAvailable == 'true'
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: green-tests
path: green-tests

@ -344,8 +344,8 @@ jobs:
needs: BuildAndTest
if: always()
outputs:
testResultsAvailable: ${{ steps.MergeTestResults.result == 'success' }}
greenTestsAvailable: ${{ steps.MergeGreenTests.result == 'success' }}
testResultsAvailable: ${{ steps.MergeTestResults.conclusion == 'success' }}
greenTestsAvailable: ${{ steps.MergeGreenTests.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: 'Check Test Results Artifacts'
@ -360,12 +360,12 @@ jobs:
});
var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("test-results_")
return artifact.name.startsWith("test-results_");
});
if (artifacts.length > 0) {
core.setOutput('artifactsAvailable', 'true');
console.log('Test results artifacts found.')
console.log('Test results artifacts found.');
}
- name: 'Merge Test Results'
id: MergeTestResults
@ -387,12 +387,12 @@ jobs:
});
var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("green-tests_")
return artifact.name.startsWith("green-tests_");
});
if (artifacts.length > 0) {
core.setOutput('artifactsAvailable', 'true');
console.log('Green Tests Artifacts found.')
console.log('Green Tests Artifacts found.');
}
- name: 'Merge Green Tests'
id: MergeGreenTests

@ -46,13 +46,13 @@ jobs:
run_id: ${{ github.event.workflow_run.id }},
});
var testResultsArtifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "test-results"
var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "test-results";
});
if (testResultsArtifacts.length > 0) {
if (artifacts.length > 0) {
core.setOutput('testResultsArtifactAvailable', 'true');
console.log('Test results artifact found.')
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.
@ -60,12 +60,53 @@ jobs:
id: DownloadArtifact
if: steps.CheckArtifact.outputs.testResultsArtifactAvailable == 'true'
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: test-results
# name: test-results
path: test-results
run-id: ${{ github.event.workflow_run.id }}
merge-multiple: true
# run-id: ${{ github.event.workflow_run.id }}
- name: 'Download Test Results'
id: DownloadTestResults
if: steps.DownloadArtifact.outcome == 'failure'
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 }},
});
console.log('context.repo.owner = ' + context.repo.owner);
console.log('context.repo.repo = ' + context.repo.repo);
var artifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "test-results";
});
if (artifacts.length > 0) {
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifacts[0].id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{ github.workspace }}/test-results.zip', Buffer.from(download.data));
core.setOutput('hasTestResultsArtifact', 'true');
}
- name: 'Extract Artifact'
id: ExtractArtifact
if: steps.DownloadTestResults.conclusion == 'success' && 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.result == 'success'
if: steps.DownloadArtifact.outcome == 'success' || steps.ExtractArtifact.conclusion == 'success'
uses: dorny/test-reporter@v1
env:
#

Loading…
Cancel
Save