Skip to content

Commit

Permalink
Merge branch 'master' into cscale-overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumbiegel authored Aug 31, 2023
2 parents 68e5248 + ccf32a0 commit ae99f7e
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 18 deletions.
27 changes: 9 additions & 18 deletions .github/workflows/glmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,17 @@ jobs:
name: ReferenceImages_${{ matrix.os }}_${{ matrix.arch }}_${{ matrix.version }}
path: |
./GLMakie/test/recorded_reference_images/
- name: Add reference images status
uses: actions/github-script@v6
if: matrix.version == '1'
- name: Save number of missing refimages to file
env:
n_missing_refimages: ${{ steps.referencetests.outputs.n_missing_refimages }}
N_MISSING: ${{ steps.referencetests.outputs.n_missing_refimages }}
run: |
mkdir -p ./n_missing
echo $N_MISSING > ./n_missing/n_missing_refimages
- name: Upload artifact with number of missing refimages
uses: actions/upload-artifact@v3
with:
debug: false
script: |
await github.request('POST /repos/{owner}/{repo}/statuses/{sha}', {
owner: context.repo.owner,
repo: context.repo.repo,
sha: "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}",
state: process.env.n_missing_refimages === '0' ? 'success' : 'failure',
target_url: null,
description: process.env.n_missing_refimages + " missing refimages must be uploaded",
context: 'Reference Tests',
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
name: n_missing_refimages
path: n_missing/
- name: Fail after artifacts if tests failed
if: ${{ env.TESTS_SUCCESSFUL != 'true' }}
run: exit 1
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/refimages_status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Reference Image Status

on:
workflow_run:
workflows: [GLMakie CI]
types:
- completed

jobs:
download:
permissions:
statuses: write
runs-on: ubuntu-latest
steps:
- name: "Download artifact"
uses: actions/github-script@v6
with:
debug: true
script: |
console.log(context.payload.workflow_run);
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "n_missing_refimages"
})[0];
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}/n_missing_refimages.zip`, Buffer.from(download.data));
- name: 'Unzip artifact'
run: unzip n_missing_refimages.zip

- name: Add reference images status
uses: actions/github-script@v6
with:
debug: true
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
let n_missing = Number(fs.readFileSync('./n_missing_refimages'));
await github.request('POST /repos/{owner}/{repo}/statuses/{sha}', {
owner: context.repo.owner,
repo: context.repo.repo,
sha: "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}",
state: n_missing === 0 ? 'success' : 'failure',
target_url: null,
description: n_missing + " missing refimages must be uploaded",
context: 'Reference Tests',
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})

0 comments on commit ae99f7e

Please sign in to comment.