Skip to content

Commit

Permalink
Debug tests.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
shBLOCK committed May 7, 2024
1 parent 925a0e7 commit c26ff7a
Showing 1 changed file with 57 additions and 53 deletions.
110 changes: 57 additions & 53 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
tests:
needs: [codegen]
runs-on: ${{ matrix.platform }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: true
matrix:
Expand All @@ -37,58 +36,58 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Fetch Latest Codegen Result
uses: actions/github-script@v7
with:
debug: true
# noinspection TypeScriptUnresolvedReference
script: |
let latest = null
for await (const runs of github.paginate.iterator(
github.rest.actions.listWorkflowRuns,
{
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: "codegen.yml"
}
)) {
console.log("runs: "+JSON.stringify(runs.data))
for (const run of runs.data.workflow_runs) {
latest = (latest != null && run.run_number > latest.run_number)
? run : latest
}
}
if (latest.status != "completed" || latest.conclusion != "success") {
core.setFailed("Latest codegen workflow run failed or is still in progress.")
return
}
let artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: latest.id
}).data
artifacts = false
if (!artifacts) {
core.setFailed("Failed to get codegen artifact.")
return
}
let artifact = artifacts.data.artifacts.filter(a => a.name == "codegen_results")[0]
if (artifact.expired) {
core.setFailed("Codegen artifact expired, please manually run the codegen workflow to generate a new result.")
return
}
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip'
});
let fs = require('fs')
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/codegen_results.zip`, Buffer.from(download.data))
# - name: Fetch Latest Codegen Result
# uses: actions/github-script@v7
# with:
# debug: true
# # noinspection TypeScriptUnresolvedReference
# script: |
# let latest = null
# for await (const runs of github.paginate.iterator(
# github.rest.actions.listWorkflowRuns,
# {
# owner: context.repo.owner,
# repo: context.repo.repo,
# workflow_id: "codegen.yml"
# }
# )) {
# console.log("runs: "+JSON.stringify(runs.data))
# for (const run of runs.data.workflow_runs) {
# latest = (latest != null && run.run_number > latest.run_number)
# ? run : latest
# }
# }
# if (latest.status != "completed" || latest.conclusion != "success") {
# core.setFailed("Latest codegen workflow run failed or is still in progress.")
# return
# }
#
# let artifacts = await github.rest.actions.listWorkflowRunArtifacts({
# owner: context.repo.owner,
# repo: context.repo.repo,
# run_id: latest.id
# }).data
# artifacts = false
# if (!artifacts) {
# core.setFailed("Failed to get codegen artifact.")
# return
# }
#
# let artifact = artifacts.data.artifacts.filter(a => a.name == "codegen_results")[0]
#
# if (artifact.expired) {
# core.setFailed("Codegen artifact expired, please manually run the codegen workflow to generate a new result.")
# return
# }
#
# let download = await github.rest.actions.downloadArtifact({
# owner: context.repo.owner,
# repo: context.repo.repo,
# artifact_id: matchArtifact.id,
# archive_format: 'zip'
# });
# let fs = require('fs')
# fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/codegen_results.zip`, Buffer.from(download.data))

# - name: Download Codegen Output
# uses: actions/download-artifact@v4
Expand Down Expand Up @@ -118,6 +117,11 @@ jobs:
# let fs = require('fs');
# fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/codegen_results.zip`, Buffer.from(download.data));

- name: Download Codegen Result
uses: actions/download-artifact@v4
with:
name: "codegen_results"

- name: Unzip
run: 7z x codegen_results.zip -osrc/spatium

Expand Down

0 comments on commit c26ff7a

Please sign in to comment.