Add test: DialogueGroupContainer refreshes the selected dialogue group if a dialogue script's static content is changed #32
Workflow file for this run
This file contains hidden or 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: Run Luau tests | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - staging | |
| paths: | |
| - "src/**" | |
| - "pesde.toml" | |
| - "test.project.json" | |
| - ".github/workflows/run-luau-tests.yml" | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| paths: | |
| - "src/**" | |
| - "pesde.toml" | |
| - "test.project.json" | |
| - ".github/workflows/run-luau-tests.yml" | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| jobs: | |
| build: | |
| if: ${{ !github.event.pull_request.draft }} | |
| name: Build testing place | |
| runs-on: windows-latest | |
| timeout-minutes: 2 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/[email protected] | |
| with: | |
| submodules: recursive | |
| - name: Set up pesde | |
| uses: ernisto/setup-pesde@5f9a3399d5ae0fe78b014f5f13cd913f27755fb4 | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install dependencies | |
| run: pesde install | |
| - name: Build Rojo project | |
| run: rojo build test.project.json -o build.rbxl | |
| - name: Upload project | |
| uses: actions/[email protected] | |
| with: | |
| name: build.rbxl | |
| path: build.rbxl | |
| publish: | |
| name: Deploy testing place to Roblox | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 1 | |
| needs: build | |
| steps: | |
| - name: Download project | |
| uses: actions/[email protected] | |
| with: | |
| name: build.rbxl | |
| - name: POST to Roblox API | |
| env: | |
| ROBLOX_API_KEY: ${{ secrets.ROBLOX_DEPLOYMENT_API_KEY }} | |
| ROBLOX_UNIVERSE_ID: ${{ vars.ROBLOX_UNIVERSE_ID }} | |
| ROBLOX_PLACE_ID: ${{ vars.ROBLOX_PLACE_ID }} | |
| run: | | |
| curl \ | |
| --fail-with-body \ | |
| -H "x-api-key: $ROBLOX_API_KEY" \ | |
| -H "Content-Type: application/xml" \ | |
| --data-binary @build.rbxl \ | |
| "https://apis.roblox.com/universes/v1/""$ROBLOX_UNIVERSE_ID""/places/""$ROBLOX_PLACE_ID""/versions?versionType=Published" | |
| test: | |
| runs-on: ubuntu-24.04 | |
| name: Run test cases | |
| timeout-minutes: 1 | |
| needs: publish | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/[email protected] | |
| - name: Execute script | |
| uses: grand-hawk/[email protected] | |
| with: | |
| roblox_api_key: ${{ secrets.ROBLOX_DEPLOYMENT_API_KEY }} | |
| universe_id: ${{ vars.ROBLOX_UNIVERSE_ID }} | |
| place_id: ${{ vars.ROBLOX_PLACE_ID }} | |
| luau_file: "runTests.luau" | |
| output_file: "testResults.json" | |
| - name: Verify all tests passed | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| try { | |
| const outputFile = require("./testResults.json"); | |
| const testResults = outputFile[0]; | |
| if (!testResults) { | |
| throw new Error("No test results found."); | |
| } | |
| let summary = core.summary.addHeading("Test results"); | |
| const headerStrings = ["Status", "Test suite", "Test case", "Duration", "Error message"]; | |
| const headers = headerStrings.map(headerString => ({ | |
| data: headerString, | |
| header: true | |
| })); | |
| const rows = [headers]; | |
| let didFail = false; | |
| for (const test of testResults) { | |
| const convertSecondsToSmallestRelevantUnit = (seconds) => { | |
| if (seconds < 0.001) { | |
| return `${seconds * 1000000} microseconds`; | |
| } else if (seconds < 1) { | |
| return `${seconds * 1000} milliseconds`; | |
| } else { | |
| return `${seconds} seconds`; | |
| }; | |
| }; | |
| if (!test.didPass) { | |
| didFail = true; | |
| } | |
| const row = [ | |
| test.didPass ? "Pass ✅" : "Fail ❌", | |
| test.testSuite ? test.testSuite.name : "N/A", | |
| test.testCase.name, | |
| convertSecondsToSmallestRelevantUnit(test.durationSeconds), | |
| test.error ? JSON.stringify(test.error) : "N/A" | |
| ]; | |
| rows.push(row); | |
| } | |
| summary.addTable(rows); | |
| await summary.write(); | |
| if (didFail) { | |
| throw new Error("A test case failed."); | |
| }; | |
| } catch (error) { | |
| core.setFailed(error); | |
| } |