-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (88 loc) · 3.66 KB
/
batoms_api_test_container.yaml
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
# Test the batoms plugin using test
name: Test batoms-api package
on:
push:
branches:
- main
- develop
- workflow
pull_request:
branches:
- main
- develop
- workflow
workflow_dispatch:
env:
IMAGE_NAME: ghcr.io/beautiful-atoms/beautiful-atoms
jobs:
in_container:
defaults:
run:
shell: bash
runs-on: ubuntu-latest
strategy:
matrix:
# Manually change these to match the blender image versions
blender-version: ["3.0", "3.1", "3.2"]
container:
image: ghcr.io/beautiful-atoms/beautiful-atoms:blender${{ matrix.blender-version }}
options: --user root
steps:
- uses: actions/checkout@v2
- name: Install latest batoms-api and test dependencies
run: |
$BLENDERPY -m pip install pytest==6.2.5 flake8 pytest_blender &&\
$BLENDERPY -m pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --exclude=batoms_api/script-api.py,batoms_api/api --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --exclude=batoms_api/script-api.py,batoms_api/api --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: quick test with batoms installation (actions only)
run: |
# Explicit enable blender addons
blender -b --python-exit-code 1 --python-expr "import bpy; import addon_utils; addon_utils.enable('batoms', default_set=True); bpy.ops.wm.save_userpref(); print('success')"
ls -al /home/ || true
ls -al /home/blender || true
blender -b --python-exit-code 1 --python-expr "import batoms"
blender -b --python-exit-code 1 --python-expr "import bpy; bpy.ops.batoms.delete()"
- name: Run unit tests for api part
run:
$BLENDERPY -m pytest -svv tests/api
- name: Run unit tests for sub-modules
# There is some issue with running all test scripts in a single pytest environment. Let's do them separately
run: |
for f in tests/modules/test_*.py; do $BLENDERPY -m pytest -svv $f; done
# - name: Run test scripts
# run: |
# cd tests
# python ch4.py
# on_host:
# defaults:
# run:
# shell: bash
# runs-on: ubuntu-latest
# strategy:
# matrix:
# # Manually change these to match the blender image versions
# blender-version: ["3.0", "3.1", "3.2"]
# steps:
# - uses: actions/checkout@v2
# # - uses: actions/setup-python@v4
# # with:
# # python-version: '3.10'
# # - name: Install latest batoms-api and test dependencies
# # run: |
# # $BLENDERPY -m pip install pytest==6.2.5 flake8 pytest-blender &&\
# # $BLENDERPY -m pip install .
# # - name: Lint with flake8
# # run: |
# # # stop the build if there are Python syntax errors or undefined names
# # flake8 . --exclude=batoms_api/script-api.py,batoms_api/api --count --select=E9,F63,F7,F82 --show-source --statistics
# # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# # flake8 . --exclude=batoms_api/script-api.py,batoms_api/api --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# - name: Run test scripts in docker host
# run: |
# cd tests
# docker run -v $(pwd):/workdir -u root:root ghcr.io/beautiful-atoms/beautiful-atoms:blender${{ matrix.blender-version }} python ch4.py