Test Suite #6
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: Test Suite | |
on: | |
workflow_run: | |
workflows: ["Docker Image CI"] | |
types: | |
- completed | |
jobs: | |
Test_Suite: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: 'Download artifact' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: context.payload.workflow_run.id, | |
}); | |
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | |
return artifact.name == "testinfo" | |
})[0]; | |
let download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: matchArtifact.id, | |
archive_format: 'zip', | |
}); | |
const fs = require('fs'); | |
const path = require('path'); | |
const temp = '${{ runner.temp }}/artifacts'; | |
if (!fs.existsSync(temp)){ | |
fs.mkdirSync(temp); | |
} | |
fs.writeFileSync(path.join(temp, 'testinfo.zip'), Buffer.from(download.data)); | |
- name: Unzip artifact | |
run: unzip "${{ runner.temp }}/artifacts/testinfo.zip" -d "${{ runner.temp }}/artifacts" | |
- name: Trigger Test Suite github action | |
run: | | |
if [[ ${{ github.event_name == 'release' }} == true ]]; then | |
CTVER=${{ github.event.release.tag_name }} | |
elif [[ ${{ github.event_name == 'workflow_run' }} == true ]]; then | |
CTVER=$(cat ${{ runner.temp }}/artifacts/testinfo.txt | grep CTVER | cut -d'=' -f2) | |
else | |
CTVER="latest" | |
fi | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.TESTSUITE_REPOSITORY_ACCESS_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/ICICLE-ai/ml_workbench_test_suite/dispatches \ | |
-d '{"event_type":"dispatch-event", "client_payload": {"ct_version": "'"${CTVER}"'"}}' |