Tests #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
workflow_run: | |
workflows: [Codegen] | |
types: [completed] | |
jobs: | |
tests: | |
runs-on: ${{ matrix.platform }} | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
strategy: | |
fail-fast: false #TODO: temporary, remove after testing | |
matrix: | |
# python: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] | |
python: ["3.11"] | |
platform: ["windows-latest", "ubuntu-latest", "macos-latest"] | |
# platform: ["ubuntu-latest"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download Codegen Output | |
uses: actions/github-script@v6 | |
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: | | |
# if [[ "${{ runner.os }}" == "Linux" ]]; then | |
# unzip codegen_results.zip -d src/gdmath | |
# elif [[ "${{ runner.os }}" == "Macos" ]]; then | |
# unzip codegen_results.zip -d src/gdmath | |
# elif [[ "${{ runner.os }}" == "Windows" ]]; then | |
# 7z x codegen_results.zip -osrc/gdmath | |
# else | |
# echo "Unsupported OS" | |
# exit 1 | |
# fi | |
- name: Unzip | |
run: 7z x codegen_results.zip -osrc/gdmath | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install Dependencies | |
run: pip install -r requirements.txt | |
- name: Build | |
run: pip install . | |
- name: Upload Built Package | |
uses: actions/upload-artifact@v3 | |
with: | |
path: src/gdmath | |
retention-days: 1 | |
- name: Test | |
run: pytest tests |