Skip to content

Commit

Permalink
Move test running in dedicated file
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-vuillemot committed Apr 12, 2024
1 parent e697ce3 commit 6a8b7d9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
25 changes: 25 additions & 0 deletions .github/scripts/run-overall-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = async ({github, context, core, pythonVersion, workflowRunId}) => {
const branchTargetted = `dependencies/update-python${pythonVersion}`;

const result = await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'overall-tests.yml',
ref: branchTargetted,
})
const runs = await github.request('GET /repos/{owner}/{repo}/actions/runs', {
owner: context.repo.owner,
repo: context.repo.repo,
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
console.log(runs.data.workflow_runs[0]);
const workflow = runs.data.workflow_runs.find(run => run.head_branch == branchTargetted)
github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: workflowRunId,
body: `Tests: ${workflow.html_url}`,
});
}
26 changes: 3 additions & 23 deletions .github/workflows/dependencies-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.8'] #, '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest]
permissions:
contents: write
pull-requests: write
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
Expand Down Expand Up @@ -82,24 +81,5 @@ jobs:
with:
github-token: ${{ secrets.TRIGGER_GITHUB_PR }}
script: |
const result = await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'overall-tests.yml',
ref: 'dependencies/update-python${{matrix.python-version}}',
})
const runs = await github.request('GET /repos/{owner}/{repo}/actions/runs', {
owner: context.repo.owner,
repo: context.repo.repo,
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
console.log(runs.data.workflow_runs[0]);
const workflow = runs.data.workflow_runs.find(run => run.head_branch == 'dependencies/update-python${{matrix.python-version}}')
github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ steps.cpr.outputs.pull-request-number }},
body: 'Tests: ' + workflow.html_url,
});
const script = require('.github/scripts/run-overall-tests.js')
await script({github, context, core, ${{matrix.python-version}}, ${{ steps.cpr.outputs.pull-request-number }}})

0 comments on commit 6a8b7d9

Please sign in to comment.