@@ -878,151 +878,6 @@ jobs:
878878 exit 1
879879 }
880880
881- internal-tests :
882- name : Internal Tests
883- needs : [lints]
884- # Skip if not a PR or a push to master
885- # Skip if this is an external contribution. GitHub secrets will be empty, so the step would fail anyway.
886- if : ${{ (github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/master'))
887- && (github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork) }}
888- permissions :
889- contents : read
890- pull-requests : read
891- runs-on : ubuntu-latest
892- env :
893- TARGET_OWNER : clockworklabs
894- TARGET_REPO : SpacetimeDBPrivate
895- steps :
896- # Skip the private dispatch entirely when only `docs/` is touched. The job
897- # itself still completes successfully so required-status-check gating is
898- # satisfied without spending private-runner time on a docs-only change.
899- - name : Detect non-docs changes
900- id : filter
901- uses : dorny/paths-filter@v3
902- with :
903- filters : |
904- non_docs:
905- - '!docs/**'
906-
907- - id : dispatch
908- name : Trigger tests
909- if : steps.filter.outputs.non_docs == 'true'
910- uses : actions/github-script@v7
911- with :
912- github-token : ${{ secrets.SPACETIMEDB_PRIVATE_TOKEN }}
913- script : |
914- const workflowId = 'ci.yml';
915- const targetRef = 'master';
916- const targetOwner = process.env.TARGET_OWNER;
917- const targetRepo = process.env.TARGET_REPO;
918- // Use the ref for pull requests because the head sha is brittle (github does some extra dance where it merges in master).
919- const publicRef = (context.eventName === 'pull_request') ? context.payload.pull_request.head.ref : context.sha;
920- const publicPrNumber = context.payload.pull_request?.number ?? context.payload.inputs?.pr_number;
921- const preDispatch = new Date().toISOString();
922- const inputs = { public_ref: publicRef };
923- if (publicPrNumber) {
924- inputs.public_pr_number = String(publicPrNumber);
925- }
926-
927- // Dispatch the workflow in the target repository
928- await github.rest.actions.createWorkflowDispatch({
929- owner: targetOwner,
930- repo: targetRepo,
931- workflow_id: workflowId,
932- ref: targetRef,
933- inputs,
934- });
935-
936- const sleep = (ms) => new Promise(r => setTimeout(r, ms));
937-
938- // Find the dispatched run by name
939- let runId = null;
940- for (let attempt = 0; attempt < 20 && !runId; attempt++) { // up to ~10 minutes to locate the run
941- await sleep(5000);
942- const runsResp = await github.rest.actions.listWorkflowRuns({
943- owner : targetOwner,
944- repo : targetRepo,
945- workflow_id : workflowId,
946- event : ' workflow_dispatch' ,
947- branch : targetRef,
948- per_page : 50,
949- });
950-
951- const expectedName = `CI [public_ref=${publicRef}]`;
952- const candidates = runsResp.data.workflow_runs
953- .filter(r => r.name === expectedName && new Date(r.created_at) >= new Date(preDispatch))
954- .sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
955-
956- if (candidates.length > 0) {
957- runId = candidates[0].id;
958- break;
959- }
960- }
961-
962- if (!runId) {
963- core.setFailed('Failed to locate dispatched run in the private repository.');
964- return;
965- }
966-
967- const runUrl = `https://github.com/${targetOwner}/${targetRepo}/actions/runs/${runId}`;
968- core.info(`View run : ${runUrl}`);
969- core.setOutput('run_id', String(runId));
970- core.setOutput('run_url', runUrl);
971-
972- - name : Wait for Internal Tests to complete
973- if : steps.filter.outputs.non_docs == 'true'
974- uses : actions/github-script@v7
975- with :
976- github-token : ${{ secrets.SPACETIMEDB_PRIVATE_TOKEN }}
977- script : |
978- const targetOwner = process.env.TARGET_OWNER;
979- const targetRepo = process.env.TARGET_REPO;
980- const runId = Number(`${{ steps.dispatch.outputs.run_id }}`);
981- const runUrl = `${{ steps.dispatch.outputs.run_url }}`;
982- const sleep = (ms) => new Promise(r => setTimeout(r, ms));
983-
984- core.info(`Waiting for workflow result... ${runUrl}`);
985-
986- let conclusion = null;
987- for (let attempt = 0; attempt < 240; attempt++) { // up to ~2 hours
988- const runResp = await github.rest.actions.getWorkflowRun({
989- owner : targetOwner,
990- repo : targetRepo,
991- run_id : runId
992- });
993- const { status, conclusion : c } = runResp.data;
994- if (status === 'completed') {
995- conclusion = c || 'success';
996- break;
997- }
998- await sleep(30000);
999- }
1000-
1001- if (!conclusion) {
1002- core.setFailed('Timed out waiting for private workflow to complete.');
1003- return;
1004- }
1005-
1006- if (conclusion !== 'success') {
1007- core.setFailed(`Private workflow failed with conclusion : ${conclusion}`);
1008- }
1009-
1010- - name : Cancel invoked run if workflow cancelled
1011- if : ${{ cancelled() && steps.dispatch.outputs.run_id }}
1012- uses : actions/github-script@v7
1013- with :
1014- github-token : ${{ secrets.SPACETIMEDB_PRIVATE_TOKEN }}
1015- script : |
1016- const targetOwner = process.env.TARGET_OWNER;
1017- const targetRepo = process.env.TARGET_REPO;
1018- const runId = Number(`${{ steps.dispatch.outputs.run_id }}`);
1019- if (!runId) return;
1020- await github.rest.actions.cancelWorkflowRun({
1021- owner: targetOwner,
1022- repo: targetRepo,
1023- run_id: runId,
1024- });
1025-
1026881 global_json_policy :
1027882 name : Verify global.json files are symlinks
1028883 runs-on : ubuntu-latest
0 commit comments