Skip to content

Commit

Permalink
Successful image build triggers test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
khsa1 committed Dec 5, 2024
1 parent 7002ca9 commit 8e26ce2
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/test_suite.yml
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}"'"}}'

0 comments on commit 8e26ce2

Please sign in to comment.