-
Notifications
You must be signed in to change notification settings - Fork 5
99 lines (93 loc) · 2.88 KB
/
runTests.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
name: Run Unit Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
strategy:
matrix:
platform: [Windows, Linux, macOS]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout RAT
uses: actions/checkout@v4
- name: Build Mex
uses: matlab-actions/run-command@v2
with:
command: buildScript
- name: Run tests
uses: matlab-actions/run-command@v2
with:
command: testScript
- name: Create build archive (Windows and macOS)
if: runner.os != 'Linux'
run: tar --exclude="**/-lang:c++.zip" --exclude=".git*/" --exclude="htmlcov/" -acvf ../${{ runner.os }}.zip *
- name: Create build archive (Linux)
if: runner.os == 'Linux'
run: zip -r ../${{ runner.os }}.zip * -x "**/-lang:c++.zip" ".git*/" "htmlcov/*"
- run: mv ../${{ runner.os }}.zip ${{ runner.os }}.zip
- name: Upload releases
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}
retention-days: 1
path: ${{ runner.os }}.zip
- name: Create cppDeploy
if: runner.os == 'Linux'
uses: matlab-actions/run-command@v2
with:
command: cppDeploy
- name: Upload cppDeploy
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: cppDeploy
retention-days: 1
path: compile/fullCompile/cppDeploy/
deploy-nightly:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [test]
permissions:
contents: write
steps:
- name: Get artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create nightly release
run: |
output=$(gh release delete nightly --cleanup-tag --yes --repo ${{ github.repository }} 2>&1) || [[ "${output}" == "release not found" ]]
gh release create nightly Windows.zip Linux.zip macOS.zip --prerelease --title "Nightly Build" --latest=false --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ github.token }}
cpp-deploy:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
ref: generated_source
path: rat_source
- name: Get cppDeploy
uses: actions/download-artifact@v4
with:
name: cppDeploy
path: cppDeploy/
- name: Deploy Source
run: |
rm -rf rat_source/*.c rat_source/*.cpp rat_source/*.h rat_source/*.hpp
rsync -av cppDeploy/ rat_source/
cd rat_source
git config user.name github-actions
git config user.email [email protected]
git add -A
git commit -m "Deploy Source Code" || true
git push