-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (110 loc) · 4.76 KB
/
main.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: CI
on: [push, pull_request]
jobs:
package:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
config: [release]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: '0'
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7
- name: configure_macos
if: matrix.os == 'macos-latest'
run: mkdir build && cd build && cmake -G Xcode ..
- name: configure_windows
if: matrix.os == 'windows-latest'
run: mkdir build && cd build && cmake ..
- name: build_debug
if: matrix.config == 'debug'
run: cmake --build build --config 'Debug'
- name: build_release
if: matrix.config == 'release'
run: cmake --build build --config 'Release'
- name: test
run: cd build && ctest -C ${{ matrix.config }} . -V
- name: package_macos
if: matrix.os == 'macos-latest'
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_CONFIG: ${{ matrix.config }}
run: |
PACKAGE_NAME=`echo $GITHUB_REPOSITORY | sed 's/.*\///g'`
PACKAGE_REV=`echo $GITHUB_SHA | sed -e 's/^[[:alnum:]]\{7\}/&-/g' | sed 's/-.*//'`
PACKAGE_CONFIG=`echo $GITHUB_CONFIG`
mkdir -p $PACKAGE_NAME
if [ -e package-info.json ]; then cp package-info.json $PACKAGE_NAME; fi
for f in *.md; do [ -e "$f" ] && cp "$f" $PACKAGE_NAME ; done
if [ -e icon.png ]; then cp icon.png $PACKAGE_NAME; fi
if [ -e CMakeLists.txt ]; then cp CMakeLists.txt $PACKAGE_NAME; fi
if [ -d code ]; then cp -r code $PACKAGE_NAME; fi
if [ -d docs ]; then cp -r docs $PACKAGE_NAME; fi
if [ -d examples ]; then cp -r examples $PACKAGE_NAME; fi
if [ -d extensions ]; then cp -r extensions $PACKAGE_NAME; fi
if [ -d externals ]; then cp -r externals $PACKAGE_NAME; fi
if [ -d extras ]; then cp -r extras $PACKAGE_NAME; fi
if [ -d help ]; then cp -r help $PACKAGE_NAME; fi
if [ -d init ]; then cp -r init $PACKAGE_NAME; fi
if [ -d java-classes ]; then cp -r java-classes $PACKAGE_NAME; fi
if [ -d java-doc ]; then cp -r java-doc $PACKAGE_NAME; fi
if [ -d javascript ]; then cp -r javascript $PACKAGE_NAME; fi
if [ -d jsui ]; then cp -r jsui $PACKAGE_NAME; fi
if [ -d media ]; then cp -r media $PACKAGE_NAME; fi
if [ -d misc ]; then cp -r misc $PACKAGE_NAME; fi
if [ -d patchers ]; then cp -r patchers $PACKAGE_NAME; fi
if [ -d support ]; then cp -r support $PACKAGE_NAME; fi
if [ -d source ]; then cp -r source $PACKAGE_NAME; fi
if [ -d tests ]; then cp -r tests $PACKAGE_NAME; fi
if [ -e $PACKAGE_NAME/ReadMe-Public.md ]; then rm -f $PACKAGE_NAME/ReadMe.md; mv $PACKAGE_NAME/ReadMe-Public.md $PACKAGE_NAME/ReadMe.md; fi
- name: package_windows
if: matrix.os == 'windows-latest'
shell: cmd
env:
GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }}
GITHUB_CONFIG: ${{ matrix.config }}
run: |
set PACKAGE_NAME=%GITHUB_REPOSITORY_NAME%
mkdir %PACKAGE_NAME%
if exist extensions cp -r extensions %PACKAGE_NAME%
if exist externals cp -r externals %PACKAGE_NAME%
if exist support cp -r support %PACKAGE_NAME%
if exist tests cp -r tests %PACKAGE_NAME%
- uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ steps.short-sha.outputs.sha }}-${{ matrix.config }}-${{ matrix.os }}
path: ${{ github.event.repository.name }}
release:
runs-on: ubuntu-latest
needs: package
if: ${{ contains( github.ref, 'refs/tags/' ) }}
steps:
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7
- uses: actions/download-artifact@v4
with:
path: ${{ github.event.repository.name }}
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ github.event.repository.name }}
- name: zip
run: zip -r ${{ github.event.repository.name }}-package-for-max-${{ steps.short-sha.outputs.sha }}.zip ${{ github.event.repository.name }}
- uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ steps.short-sha.outputs.sha }}-zipped-release
path: ${{ github.event.repository.name }}-package-for-max-${{ steps.short-sha.outputs.sha }}.zip
- uses: ncipollo/[email protected]
with:
artifacts: ${{ github.event.repository.name }}-package-for-max-${{ steps.short-sha.outputs.sha }}.zip
body: "Max Package for all supported platforms"
token: ${{ secrets.GITHUB_TOKEN }}