-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Successful image build triggers test suite
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
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}"'"}}' |