Skip to content

Tests

Tests #76

Workflow file for this run

name: Tests
on:
workflow_run:
workflows: [Codegen]
types: [completed]
workflow_dispatch:
jobs:
tests:
runs-on: ${{ matrix.platform }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: true
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"]
platform: ["windows-latest", "ubuntu-latest", "macos-latest"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch Latest Codegen Result
uses: actions/github-script@v7
debug: true

Check failure on line 25 in .github/workflows/tests.yml

View workflow run for this annotation

GitHub Actions / Tests

Invalid workflow file

The workflow is not valid. .github/workflows/tests.yml (Line: 25, Col: 9): Unexpected value 'debug'
with:
# 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"
}
)) {
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
# with:
# name: codegen_results
# github-token: ${{ github.token }}
# run-id: ${{ github }}
#
# - name: Download Codegen Output
# uses: actions/github-script@v7
# with:
# script: |
# 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 == "codegen_results"
# })[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}/codegen_results.zip`, Buffer.from(download.data));
- name: Unzip
run: 7z x codegen_results.zip -osrc/spatium
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install Dependencies
run: pip install -r requirements.txt
- name: Build
run: pip install -v -v -v .
- name: Run Tests
run: pytest tests