-
Notifications
You must be signed in to change notification settings - Fork 1
215 lines (196 loc) · 6.5 KB
/
debug.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
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
206
207
208
209
210
211
212
213
214
215
name: DEBUG
on:
push:
branches: [n]
pull_request:
branches: [n]
jobs:
unit-testing:
name: Unit testing
strategy:
matrix:
include:
# Linux targets
# - os: ubuntu-latest
# target: x86_64-unknown-linux-musl
# Windows targets
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-msvc
# macOS targets
# - os: macos-14
# target: aarch64-apple-darwin
# - os: macos-13
# target: x86_64-apple-darwin
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
# - name: Test Network
# if: runner.os == 'Windows'
# run: |
# # 测试 DNS 解析
# nslookup raw.githubusercontent.com
# # 测试网络连接
# ping raw.githubusercontent.com
# # 测试 HTTPS 连接(使用 PowerShell 命令替代 curl)
# powershell -Command "Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/nodejs/Release/main/schedule.json' -UseBasicParsing"
# # 显示网络路由
# tracert raw.githubusercontent.com
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Install Rust
# uses: actions-rust-lang/setup-rust-toolchain@v1
# with:
# override: true
# target: ${{ matrix.target }}
# - name: Setup Windows Network
# if: runner.os == 'Windows'
# shell: powershell
# run: |
# # 检查网络状态
# Write-Host "Testing local network connectivity..."
# Test-NetConnection -ComputerName localhost
# # 确保 HTTP.sys 服务运行
# Write-Host "Ensuring HTTP service is running..."
# Start-Service -Name http
# # 添加防火墙规则
# Write-Host "Adding firewall rules..."
# New-NetFirewallRule -DisplayName "Allow Mock Server" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 0-65535
# node -v
# cargo install just
# just setup
# just ready
# just ci-e2e
# env:
# RUST_BACKTRACE: full
# - name: Run tests
# if: runner.os != 'Windows'
# run: |
# node -v
# cargo install just
# just setup
# just ready
# just ci-e2e
# env:
# RUST_BACKTRACE: full
# build-release:
# name: Build release
# needs: unit-testing
# strategy:
# matrix:
# include:
# # Linux targets
# - os: ubuntu-latest
# target: x86_64-unknown-linux-musl
# # Windows targets
# # - os: windows-latest
# # target: x86_64-pc-windows-msvc
# # - os: windows-latest
# # target: i686-pc-windows-msvc
# # macOS targets
# - os: macos-14
# target: aarch64-apple-darwin
# - os: macos-13
# target: x86_64-apple-darwin
# fail-fast: false
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Install Rust
# uses: actions-rust-lang/setup-rust-toolchain@v1
# with:
# override: true
# target: ${{ matrix.target }}
# - name: Build binary
# uses: actions-rs/cargo@v1
# with:
# command: build
# args: --verbose --release --target ${{ matrix.target }}
# - name: Display binary size
# shell: bash
# run: |
# ls -l target/${{ matrix.target }}/release/*
# du -h target/${{ matrix.target }}/release/*
# - name: Strip binary (Linux and macOS only)
# if: matrix.os != 'windows-latest'
# run: |
# for file in snm node npm npx pnpm pnpx yarn; do
# strip "target/${{ matrix.target }}/release/$file"
# done
# - name: Create Archive
# shell: bash
# run: |
# mkdir archive
# cp LICENSE README.md target/${{ matrix.target }}/release/{node,npm,npx,pnpm,pnpx,snm,yarn} archive/
# tar -czf ${{ matrix.target }}.tar.gz -C archive LICENSE README.md node npm npx pnpm pnpx snm yarn
# ls -l
# - name: Upload Artifacts tar.gz
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.target }}
# path: ${{ matrix.target }}.tar.gz
# e2e-testing:
# name: E2E testing
# needs: build-release
# strategy:
# matrix:
# include:
# # Linux targets
# - os: ubuntu-latest
# target: x86_64-unknown-linux-musl
# # Windows targets
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# - os: windows-latest
# target: i686-pc-windows-msvc
# # macOS targets
# - os: macos-14
# target: aarch64-apple-darwin
# - os: macos-13
# target: x86_64-apple-darwin
# fail-fast: false
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Install Rust
# uses: actions-rust-lang/setup-rust-toolchain@v1
# with:
# override: true
# target: ${{ matrix.target }}
# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# name: ${{ matrix.target }}
# path: .
# - name: Tar downloaded files
# shell: bash
# run: |
# tar -xvf ${{ matrix.target }}.tar.gz -C e2e/tests
# cd e2e/tests
# ls -R
# - name: e2e tests
# shell: bash
# run: |
# cargo test --package e2e -- --nocapture
# coverage:
# name: Collect test coverage
# runs-on: ubuntu-latest
# env:
# CARGO_TERM_COLOR: always
# steps:
# - uses: actions/checkout@v4
# - name: Install Rust
# run: rustup update stable
# - name: Install cargo-llvm-cov
# uses: taiki-e/install-action@cargo-llvm-cov
# - name: Generate code coverage
# run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# files: lcov.info
# fail_ci_if_error: true