-
Notifications
You must be signed in to change notification settings - Fork 13
88 lines (82 loc) · 3.13 KB
/
UnitTests.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
name: Run unit tests
on:
push:
pull_request:
workflow_dispatch:
jobs:
RunTests-MacOSX-x86-64:
runs-on: macos-latest
env:
WOLFRAM_SYSTEM_ID: MacOSX-x86-64
WOLFRAMENGINE_CACHE_KEY: WolframEngine-A
WOLFRAMENGINE_INSTALLATION_DIRECTORY: "/Applications/Wolfram Engine.app"
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Cache/restore Wolfram Engine install
id: cache-restore
uses: actions/cache@v3
with:
path: ${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}
key: wolframengine-${{ env.WOLFRAM_SYSTEM_ID }}-${{ env.WOLFRAMENGINE_CACHE_KEY }}
- name: Install Wolfram Engine
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
echo 'Installing Wolfram Engine...'
brew install --cask wolfram-engine
echo 'Installed Wolfram Engine.'
- name: Run unit tests
env:
WOLFRAMENGINE_EXECUTABLES_DIRECTORY: "${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}/Contents/Resources/Wolfram Player.app/Contents/MacOS"
WOLFRAMSCRIPT_ENTITLEMENTID: ${{ secrets.WOLFRAM_LICENSE_ENTITLEMENT_ID }}
WOLFRAMSCRIPT_KERNELPATH: "${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}/Contents/MacOS/WolframKernel"
run: |
export PATH="${{ env.WOLFRAMENGINE_EXECUTABLES_DIRECTORY }}:$PATH"
wolframscript -debug -verbose -script ./Tests/AllTests.wls
- name: Produce test report
id: testreport
uses: dorny/test-reporter@v1
if: always()
with:
name: Unit tests
path: TestReport.xml
reporter: jest-junit
fail-on-error: false
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Checkout gh-pages branch
uses: actions/checkout@v3
with:
ref: gh-pages
path: gh-pages
- name: Generate the badge SVG image
uses: emibcn/badge-action@v1
id: badge
with:
label: 'tests'
status: "${{ steps.testreport.outputs.passed }} passed, ${{ steps.testreport.outputs.failed }} failed, ${{ steps.testreport.outputs.skipped }} skipped"
color: ${{
steps.testreport.outputs.failed == 0 && 'green' ||
steps.testreport.outputs.failed > 0 && 'red' ||
'yellow' }}
path: gh-pages/testresult.svg
- name: Commit badge
env:
BRANCH: ${{ steps.extract_branch.outputs.branch }}
FILE: 'testresult.svg'
working-directory: ./gh-pages
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
mkdir -p "badges/${BRANCH}"
mv "${FILE}" "badges/${BRANCH}"
git add "badges/${BRANCH}/${FILE}"
git commit -m "Add/Update badge" || true
- name: Push badge commit
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
directory: gh-pages