-
Notifications
You must be signed in to change notification settings - Fork 50
129 lines (125 loc) · 4.53 KB
/
publish.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
name: Publish
on:
push:
branches:
- master
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: Python Linter
uses: weibullguy/[email protected]
with:
python-root-list: "addons"
use-black: false
use-yapf: false
use-isort: false
use-docformatter: false
use-pycodestyle: true
use-autopep8: false
use-pydocstyle: false
use-mypy: false
use-pylint: false
use-flake8: false
use-mccabe: false
use-radon: false
use-rstcheck: false
use-check-manifest: false
use-pyroma: false
extra-black-options: ""
extra-yapf-options: ""
extra-isort-options: ""
extra-docformatter-options: ""
# This should work with **/models but it doesn't
extra-pycodestyle-options: "--exclude=models --ignore=E501,W504"
extra-pydocstyle-options: ""
extra-mypy-options: ""
extra-pylint-options: ""
extra-flake8-options: ""
extra-mccabe-options: ""
extra-radon-options: ""
extra-rstcheck-options: ""
extra-manifest-options: ""
extra-pyroma-options: ""
test:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
version: ["3.5.0", "3.4.0", "3.3.1", "2.93.9"]
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
# Finds latest Blender build, and outputs the hosted build's download URL.
- name: Find latest Blender build
id: blender_version
run: |
echo ${{ matrix.version }}
major=$(echo ${{ matrix.version }} | cut -d. -f1)
minor=$(echo ${{ matrix.version }} | cut -d. -f2)
patch=$(echo ${{ matrix.version }} | cut -d. -f3)
echo "Looking for Blender $BLENDER_MAJOR.$BLENDER_MINOR.${BLENDER_PATCH}"
BLENDER_URL="https://download.blender.org/release/Blender$major.$minor/blender-$major.$minor.$patch-linux-x64.tar.xz"
echo "blender-url=$BLENDER_URL" >> $GITHUB_OUTPUT
# Loads a cached build of Blender if available. If not available, this step
# enqueues the /opt/blender directory to be cached after tests pass.
- id: blender_cache
uses: actions/cache@v3
env:
cache-name: cache-blender
with:
path: /opt/blender
key: ${{ steps.blender_version.outputs.blender-url }}
# Downloads a build from blender.org, if a cached version was not available.
- name: Download Blender
if: ${{ !steps.blender_cache.outputs.cache-hit }}
run: |
mkdir /opt/blender
echo "Downloading: ${{ steps.blender_version.outputs.blender-url }}"
curl -SL "${{ steps.blender_version.outputs.blender-url }}" | \
tar -Jx -C /opt/blender --strip-components=1
- name: Set up workspace
run: |
sudo ln -s /opt/blender/blender /usr/local/bin/blender
blender --version
major=$(echo ${{ matrix.version }} | cut -d. -f1)
minor=$(echo ${{ matrix.version }} | cut -d. -f2)
ADDON_DIR=/opt/blender/$major.$minor/scripts/addons
rm -rf $ADDON_DIR/io_hubs_addon
cp -r addons/io_hubs_addon $ADDON_DIR
cd tests
yarn install
mkdir -p out
- name: Run tests
run: |
cd tests
OUT_PREFIX=$GITHUB_WORKSPACE/tests/out yarn test-bail --reporter-options reportDir=out/mochawesome
- name: Upload test artifacts
uses: actions/upload-artifact@v3
with:
name: test-output-${{ matrix.version }}
path: tests/out/mochawesome
if-no-files-found: error
publish:
needs: test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: Update build number
run: |
sed -i'' 's/"dev_build"/${{ github.run_number }}/g' $GITHUB_WORKSPACE/addons/io_hubs_addon/__init__.py
- name: Get version
id: get_version
run: |
VERSION=$(grep '"version"' $GITHUB_WORKSPACE/addons/io_hubs_addon/__init__.py | sed -E 's/.*\(([0-9]+), ([0-9]+), ([0-9]+), ([0-9]+)\).*/\1.\2.\3.\4/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Upload addon artifacts
uses: actions/upload-artifact@v3
with:
name: io_hubs_addon_${{ steps.get_version.outputs.version }}
path: addons
if-no-files-found: error