-
Notifications
You must be signed in to change notification settings - Fork 1
205 lines (166 loc) · 5.47 KB
/
ci.yml
File metadata and controls
205 lines (166 loc) · 5.47 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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: Run Tests and Build
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
jobs:
pylight-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./pylight/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
working-directory: ./pylight
run: cargo fmt -- --check
- name: Run clippy
working-directory: ./pylight
run: cargo clippy -- -D warnings
- name: Run tests
working-directory: ./pylight
run: cargo test
- name: Build release binary
working-directory: ./pylight
run: cargo build --release --bin pylight
pydance-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: pydance/package-lock.json
- name: Install dependencies
working-directory: ./pydance
run: npm ci
- name: Run linter
working-directory: ./pydance
run: npm run lint
- name: Check formatting
working-directory: ./pydance
run: npm run format:check
- name: Compile TypeScript
working-directory: ./pydance
run: npm run compile
- name: Setup Rust for pylight binary
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./pylight/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build pylight binary
working-directory: ./pylight
run: cargo build --release --bin pylight
- name: Copy pylight binary to pydance
run: cp ./pylight/target/release/pylight ./pydance/pylight
- name: Run unit tests (Linux)
if: runner.os == 'Linux'
working-directory: ./pydance
run: xvfb-run -a npm test
- name: Run unit tests (macOS/Windows)
if: runner.os != 'Linux'
working-directory: ./pydance
run: npm test
- name: Run integration tests (Linux)
if: runner.os == 'Linux'
working-directory: ./pydance
run: xvfb-run -a npm run test:integration
- name: Run integration tests (macOS/Windows)
if: runner.os != 'Linux'
working-directory: ./pydance
run: npm run test:integration
build-vsix:
needs: [pylight-test, pydance-test]
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: linux-x64
- os: macos-latest
target: aarch64-apple-darwin
platform: darwin-arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: pydance/package-lock.json
- name: Install dependencies
working-directory: ./pydance
run: npm ci
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./pylight/target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build pylight binary
working-directory: ./pylight
run: |
# Build for the target platform
cargo build --release --target ${{ matrix.target }} --bin pylight
- name: Copy pylight binary to pydance
run: |
# Copy the platform-specific binary
cp ./pylight/target/${{ matrix.target }}/release/pylight ./pydance/pylight
# Make it executable
chmod +x ./pydance/pylight
- name: Compile TypeScript
working-directory: ./pydance
run: npm run compile
- name: Install vsce
run: npm install -g @vscode/vsce
- name: Package VSIX
working-directory: ./pydance
run: |
# Package with dependencies included
vsce package
- name: Test VSIX installation
working-directory: ./pydance
run: |
# Find the created VSIX file
VSIX_FILE=$(ls *.vsix | head -n 1)
echo "Testing VSIX: $VSIX_FILE"
# Install VS Code CLI if not on macOS (macOS has it pre-installed)
if [[ "${{ runner.os }}" == "Linux" ]]; then
wget -q "https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64" -O vscode-cli.tar.gz
tar -xzf vscode-cli.tar.gz
chmod +x code
export PATH=$PWD:$PATH
fi
# Try to install the extension (won't activate without a workspace, but will verify package integrity)
code --install-extension "$VSIX_FILE" --force || echo "Installation test completed"
- name: Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: pydance-vsix-${{ matrix.platform }}
path: ./pydance/*.vsix
retention-days: 30