-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (69 loc) · 2.28 KB
/
reusable-maya-tests.yml
File metadata and controls
85 lines (69 loc) · 2.28 KB
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
name: maya tests
on:
workflow_call:
workflow_dispatch: # Manual trigger
jobs:
collect_tests:
runs-on: ubuntu-latest
outputs:
tests_collected: ${{ steps.check_tests.outputs.tests_collected }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Check for tests
id: check_tests
run: |
#!/bin/bash
set +e # Disable exit on error
pytest --collect-only
exit_code=$?
set -e # Re-enable exit on error
if [ $exit_code -eq 5 ]; then
echo "tests_collected=0" >> $GITHUB_OUTPUT
echo "No tests were collected."
else
collected=$(pytest --collect-only | grep -oP 'collected \K\d+')
echo "tests_collected=$collected" >> $GITHUB_OUTPUT
echo "Collected $collected tests."
fi
no_tests_found:
needs: collect_tests
if: needs.collect_tests.outputs.tests_collected == '0'
runs-on: ubuntu-latest
steps:
- name: No tests found
run: echo "No tests were collected. Skipping test execution."
maya:
needs: collect_tests
if: needs.collect_tests.outputs.tests_collected != '0'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# add or remove versions as needed, a job per version will be created
# supported tags here: https://github.com/mottosso/docker-maya/
maya_version: ["2024",]
container: mottosso/maya:${{ matrix.maya_version }} # ty mottosso!
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
mayapy -m pip install --upgrade pip
mayapy -m pip install pip-tools
pip-compile requirements.in
pip-compile requirements-test.in
mayapy -m pip install --user -r requirements-test.txt
- name: Set Maya environment variables
run: |
export XDG_RUNTIME_DIR=/var/tmp/runtime-root
export MAYA_DISABLE_ADP=1
- name: Run tests
run: mayapy -m pytest tests