-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
104 lines (91 loc) · 3.01 KB
/
action.yml
File metadata and controls
104 lines (91 loc) · 3.01 KB
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
name: "Notebook Runner"
description: "Runs and tests Notebooks with VS Code"
branding:
icon: "book"
color: "blue"
inputs:
notebook-files:
description: "Notebooks to be tested, separated by spaces"
required: true
notebook-file-ext:
description: "Notebook file extension"
required: false
default: 'capnb'
notebook-vscode-ext:
description: "Notebook VS Code extension"
required: false
default: 'SAPSE.vscode-cds'
vscode-version:
description: "VS Code version"
required: false
default: 'stable'
timeout:
description: "Mocha timeout for VS Code tests"
require: false
default: 120000
artifacts-on-success:
description: "Whether to create artifacts on success"
required: false
default: false
artifacts-kind:
description: "Kind of artifacts to be created"
required: false
default: 'file'
runs:
using: "composite"
steps:
- name: Checkout Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup VS Code Tests
shell: bash
run: |
echo "TIMEOUT=${{ inputs.timeout }}" >> $GITHUB_ENV
echo "NOTEBOOK_VSCODE_EXT=${{ inputs.notebook-vscode-ext }}" >> $GITHUB_ENV
echo "NOTEBOOK_FILE_EXT=${{ inputs.notebook-file-ext }}" >> $GITHUB_ENV
echo "ARTIFACTS_KIND=${{ inputs.artifacts-kind }}" >> $GITHUB_ENV
echo "VSCODE_VERSION=${{ inputs.vscode-version }}" >> $GITHUB_ENV
# Without self-hosted container, use ${{ github.action_path }} instead
cp -r ${GITHUB_ACTION_PATH}/vscode-notebook-runner .
cd vscode-notebook-runner
npm i --quiet --no-progress
mkdir -p test/data
for file in ${{ inputs.notebook-files }}; do
cp ../$file test/data
done
env PYTHONPATH=$(which python3)
pip3 install ipykernel
- name: Run all Notebooks
shell: bash
run: |
cd vscode-notebook-runner
npm i
xvfb-run --auto-servernum npm run vscode
- name: Create artifacts
if: failure() || ${{ inputs.artifacts-on-success }}
shell: bash
run: |
tar -czf notebooks.tgz -C vscode-notebook-runner/test/data/out/ .
- name: Upload artifacts
id: artifact-upload-step
if: failure() || ${{ inputs.artifacts-on-success }}
uses: actions/upload-artifact@v3
with:
name: notebooks
path: notebooks.tgz
- name: Create comment for failed notebooks
if: failure()
shell: bash
run: |
cd vscode-notebook-runner/test/data/out
echo "MULTI_LINE_COMMENT<<EOF" >> $GITHUB_ENV
echo "$(cat comment.md)" >> $GITHUB_ENV
# Note: Can add artifact url once actions/upload-artifact@v4 supports GHES
# echo "${{ steps.artifact-upload-step.outputs.artifact-url }}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Commment on failed notebooks in PR
if: failure()
uses: mshick/add-pr-comment@v2
with:
message: ${{ env.MULTI_LINE_COMMENT }}