Skip to content

dispatch-event

dispatch-event #24

name: RegressionTests
on:
workflow_dispatch:
repository_dispatch:
types: [dispatch-event]
release:
types: [published]
jobs:
fetch-release:
runs-on: ubuntu-latest
outputs:
releases: ${{ steps.fetch-releases.outputs.releases }}
steps:
- name: Fetch Inworld Unity Releases
id: fetch-releases
run: |
json=$(curl -s https://api.github.com/repos/inworld-ai/inworld-unity-core/releases | jq -c '[.[] | {tag_name, assets: .assets[] | select(.name | endswith(".tgz"))} | {tag_name, download_url: .assets.browser_download_url}]')
echo "Found releases:"
echo $json
echo "releases=$json" >> $GITHUB_OUTPUT
notify-start:
runs-on: ubuntu-latest
needs: fetch-release
steps:
- name: Send Start Notification to Slack
id: notify-slack-start
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "🚀 Regression Tests Started"
SLACK_MESSAGE: "The regression tests have started for all releases. Updates will follow in this thread."
SLACK_ICON: "https://avatars.githubusercontent.com/u/117676025?v=4"
SLACK_COLOR: "#36a64f"
run-tests:
runs-on: ubuntu-latest
needs: [fetch-release, notify-start]
strategy:
matrix:
releaseName: ${{ fromJson(needs.fetch-release.outputs.releases) }}
steps:
- name: Download and Extract Release Files
id: download-releases
run: |
mkdir -p releases
echo "Downloading ${{ matrix.releaseName.tag_name }} from ${{ matrix.releaseName.download_url }}"
mkdir -p "releases/${{ matrix.releaseName.tag_name }}"
wget -qO- "${{ matrix.releaseName.download_url }}" | tar xvz -C "releases/${{ matrix.releaseName.tag_name }}/"
- name: Run Tests
id: run_tests
uses: game-ci/unity-test-runner@v4
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
packageMode: true
projectPath: releases/${{ matrix.releaseName.tag_name }}/package
testMode: playmode
unityVersion: 2022.3.34f1
- name: Notify Slack for Each Test
if: always()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: ":${{ job.status == 'success' && 'white_check_mark' || 'x' }}: Test Result for `${{ matrix.releaseName.tag_name }}`"
SLACK_MESSAGE: Regression tests ${{ job.status == 'success' && 'passed' || 'failed' }}.
SLACK_THREAD_TS: "${{ needs.notify-slack-start.outputs.ts }}"
SLACK_ICON: "https://avatars.githubusercontent.com/u/117676025?v=4"
SLACK_COLOR: "${{ job.status == 'success' && '#36a64f' || '#ff0000' }}"