-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (129 loc) · 4.52 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Tests
on:
push:
branches:
- master
paths:
- "codegen/**"
- "src/**"
- "tests/**"
- ".github/workflows/codegen.yml"
- ".github/workflows/tests.yml"
- "*"
- "!**/*.md"
- "!**/*.txt"
- "!**/.gitignore"
pull_request:
branches:
- master
workflow_dispatch:
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
jobs:
codegen:
uses: ./.github/workflows/codegen.yml
tests:
needs: [codegen]
runs-on: ${{ matrix.platform }}
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
# 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
# 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: Download Codegen Result
uses: actions/download-artifact@v4
with:
name: codegen_results
path: src/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