Skip to content

Commit

Permalink
fix parenthesis in script; check periodically for test results
Browse files Browse the repository at this point in the history
  • Loading branch information
neerajprad committed Jan 29, 2025
1 parent f654874 commit 0977134
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
39 changes: 22 additions & 17 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,32 @@ jobs:
with:
script: |
const TIMEOUT = 600000; // 10 minutes in milliseconds
console.log('Waiting for tests to complete...');
await new Promise(r => setTimeout(r, TIMEOUT));
const START_TIME = Date.now();
const runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'unit_test.yml',
status: 'completed',
branch: 'main'
});
while (Date.now() - START_TIME < TIMEOUT) {
console.log('Checking test status...');
const runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'unit_testing.yml',
status: 'completed',
branch: 'main'
});
if(runs.data.workflow_runs.length > 0) {
const run = runs.data.workflow_runs[0];
if(run.conclusion === 'success') {
console.log('Tests passed!');
} else {
throw new Error('Tests failed!');
if(runs.data.workflow_runs.length > 0) {
const run = runs.data.workflow_runs[0];
if(run.conclusion === 'success') {
console.log('Tests passed!');
return;
} else if(run.conclusion === 'failure') {
throw new Error('Tests failed!');
}
}
} else {
throw new Error('Tests did not complete within 10 minutes');
console.log('...');
await new Promise(r => setTimeout(r, 30000)); // Wait 30 seconds between checks
}
throw new Error('Tests did not complete within 10 minutes');
- uses: actions/checkout@v4

- name: Set up Python
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
jobs:
test:
runs-on: ubuntu-latest
environment: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch') && 'CI-prod' || 'CI-staging' }}
environment: ${{ (startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch') && 'CI-prod' || 'CI-staging' }}
strategy:
# You can use PyPy versions in python-version.
# For example, pypy-2.7 and pypy-3.8
Expand Down

0 comments on commit 0977134

Please sign in to comment.