Skip to content

Commit 6c4c2fa

Browse files
committed
🌱 prove we can use labels to enable extra testing
Signed-off-by: David Zager <david.j.zager@gmail.com>
1 parent 59d49a2 commit 6c4c2fa

3 files changed

Lines changed: 248 additions & 141 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Collect E2E Test Artifacts"
2+
description: "Collects test artifacts from E2E test runs"
3+
4+
inputs:
5+
artifact-name:
6+
description: "Name for the uploaded artifact"
7+
required: true
8+
tests-directory:
9+
description: "Path to tests directory"
10+
required: false
11+
default: "./tests"
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Collect test artifacts
17+
if: always()
18+
shell: bash
19+
working-directory: ${{ inputs.tests-directory }}
20+
run: |
21+
mkdir -p test-artifacts
22+
if [ -d "test-data-dir" ]; then
23+
cp -r test-data-dir test-artifacts/
24+
fi
25+
if [ -d "test-output" ]; then
26+
cp -r test-output test-artifacts/
27+
fi
28+
29+
# Collect extension logs from VSCode's log directory
30+
if [ -d "test-data-dir/logs" ]; then
31+
echo "Collecting extension logs..."
32+
mkdir -p test-artifacts/extension-logs
33+
cp -r test-data-dir/logs/* test-artifacts/extension-logs/
34+
35+
# List log files for debugging
36+
echo "Extension log files found:"
37+
find test-artifacts/extension-logs -type f -name "*.log" -ls || echo "No .log files found"
38+
else
39+
echo "Warning: test-data-dir/logs directory not found"
40+
fi
41+
42+
- name: Upload test artifacts
43+
if: always()
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: ${{ inputs.artifact-name }}
47+
path: ${{ inputs.tests-directory }}/test-artifacts/
48+
retention-days: 7
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: "Setup E2E Test Environment"
2+
description: "Sets up VSCode, Java, dependencies, and VSIX extensions for E2E testing"
3+
4+
inputs:
5+
node-version-file:
6+
description: "Path to .nvmrc file"
7+
required: false
8+
default: ".nvmrc"
9+
java-version:
10+
description: "Java version to install"
11+
required: false
12+
default: "17"
13+
java-distribution:
14+
description: "Java distribution"
15+
required: false
16+
default: "oracle"
17+
vsix-artifact-name:
18+
description: "Name of the VSIX artifact to download"
19+
required: false
20+
default: "vsix-artifacts"
21+
22+
outputs:
23+
core-vsix:
24+
description: "Path to core VSIX file"
25+
value: ${{ steps.set_vsix_paths.outputs.core_vsix }}
26+
java-vsix:
27+
description: "Path to Java VSIX file"
28+
value: ${{ steps.set_vsix_paths.outputs.java_vsix }}
29+
javascript-vsix:
30+
description: "Path to JavaScript VSIX file"
31+
value: ${{ steps.set_vsix_paths.outputs.javascript_vsix }}
32+
33+
runs:
34+
using: "composite"
35+
steps:
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version-file: ${{ inputs.node-version-file }}
40+
cache: "npm"
41+
42+
- name: Install vscode dependencies
43+
shell: bash
44+
run: sudo apt-get update && sudo apt-get install -y wget
45+
46+
- name: Setup Java
47+
uses: actions/setup-java@v4
48+
with:
49+
distribution: ${{ inputs.java-distribution }}
50+
java-version: ${{ inputs.java-version }}
51+
52+
- name: Download and Install VSCode
53+
shell: bash
54+
run: |
55+
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
56+
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
57+
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" |sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null
58+
rm -f packages.microsoft.gpg
59+
sudo apt install apt-transport-https -y
60+
sudo apt update
61+
sudo apt install code -y
62+
63+
- name: Set up virtual X11
64+
shell: bash
65+
run: |
66+
sudo apt-get install -y \
67+
xvfb \
68+
x11-xserver-utils \
69+
dbus-x11 \
70+
xfonts-100dpi \
71+
xfonts-75dpi \
72+
libxrender1 \
73+
libxext6 \
74+
libx11-6 \
75+
xfonts-base \
76+
nickle cairo-5c \
77+
xorg-docs-core
78+
79+
- name: Set DISPLAY environment variable
80+
shell: bash
81+
run: |
82+
Xvfb :99 -screen 0 1920x1080x24 &
83+
echo "DISPLAY=:99" >> "$GITHUB_ENV"
84+
85+
- name: Start Dbus
86+
shell: bash
87+
run: |
88+
dbus-launch --exit-with-session &
89+
sudo service dbus start
90+
export XDG_RUNTIME_DIR=/run/user/$(id -u)
91+
sudo chmod 700 $XDG_RUNTIME_DIR
92+
sudo chown $(id -un):$(id -gn) $XDG_RUNTIME_DIR
93+
export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
94+
dbus-daemon --session --address=$DBUS_SESSION_BUS_ADDRESS --nofork --nopidfile --syslog-only &
95+
mkdir ~/.vscode && echo '{ "disable-hardware-acceleration": true }' > ~/.vscode/argv.json
96+
97+
- name: Verify Installation
98+
shell: bash
99+
run: code --version
100+
101+
- name: Ensure no VSCode instances are running
102+
shell: bash
103+
run: pkill -f code || true
104+
105+
- name: Install test dependencies
106+
shell: bash
107+
run: npm ci
108+
working-directory: ./tests
109+
110+
- name: Download VSIX artifacts
111+
uses: actions/download-artifact@v4
112+
with:
113+
name: ${{ inputs.vsix-artifact-name }}
114+
path: ./dist
115+
116+
- name: Set VSIX paths
117+
id: set_vsix_paths
118+
shell: bash
119+
run: |
120+
# Read extension names from package.json files
121+
CORE_NAME=$(node -p "require('./vscode/core/package.json').name")
122+
JAVA_NAME=$(node -p "require('./vscode/java/package.json').name")
123+
JS_NAME=$(node -p "require('./vscode/javascript/package.json').name")
124+
125+
# Find the actual VSIX files using glob patterns
126+
CORE_VSIX=$(ls ./dist/${CORE_NAME}-*.vsix | head -n 1)
127+
JAVA_VSIX=$(ls ./dist/${JAVA_NAME}-*.vsix | head -n 1)
128+
JS_VSIX=$(ls ./dist/${JS_NAME}-*.vsix | head -n 1)
129+
130+
# Verify files exist
131+
if [ ! -f "$CORE_VSIX" ]; then
132+
echo "Error: Core VSIX not found for ${CORE_NAME}"
133+
ls -la ./dist/
134+
exit 1
135+
fi
136+
if [ ! -f "$JAVA_VSIX" ]; then
137+
echo "Error: Java VSIX not found for ${JAVA_NAME}"
138+
ls -la ./dist/
139+
exit 1
140+
fi
141+
if [ ! -f "$JS_VSIX" ]; then
142+
echo "Error: JavaScript VSIX not found for ${JS_NAME}"
143+
ls -la ./dist/
144+
exit 1
145+
fi
146+
147+
# Output to GitHub Actions
148+
echo "core_vsix=${CORE_VSIX}" >> $GITHUB_OUTPUT
149+
echo "java_vsix=${JAVA_VSIX}" >> $GITHUB_OUTPUT
150+
echo "javascript_vsix=${JS_VSIX}" >> $GITHUB_OUTPUT
151+
152+
echo "VSIX files found:"
153+
echo " Core: ${CORE_VSIX}"
154+
echo " Java: ${JAVA_VSIX}"
155+
echo " JavaScript: ${JS_VSIX}"

0 commit comments

Comments
 (0)