forked from camel-tooling/camel-lsp-client-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
227 lines (194 loc) · 7.08 KB
/
main.yaml
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
216
217
218
219
220
221
222
223
224
225
226
227
name: Main CI
on:
push:
branches: [ main, FUSETOOLS2-2302 ]
pull_request:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
init:
if: always()
runs-on: ubuntu-latest
name: Utils fork check
env:
USER: "${{ github.repository_owner }}"
BRANCH: "${{ github.ref_name }}"
TOKEN: "${{ secrets.GITHUB_TOKEN }}"
outputs:
branch_exists: ${{ steps.checkBranch.outputs.exists }}
steps:
- name: Check for branch in vscode-uitests-tooling
id: checkBranch
run: |
REPO_URL="https://api.github.com/repos/$USER/vscode-uitests-tooling/branches"
RESPONSE=$(curl -s -H "Authorization: Bearer $TOKEN" "$REPO_URL")
if ([ $? -ne 0 ]); then
echo "exists=false" >> $GITHUB_OUTPUT
fi
BRANCH_EXISTS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="'"$BRANCH"'") | .name')
if [ "$BRANCH_EXISTS" == "$BRANCH" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
main:
strategy:
matrix:
os: [ ubuntu-latest, macos-13, windows-latest ]
version: [ "1.82.3", max ] # [ "x.x.x" | latest | max ]
type: [ stable ] # [ stable | insider ]
fail-fast: false
env:
CODE_VERSION: ${{ matrix.version }}
CODE_TYPE: ${{ matrix.type }}
TEST_RESOURCES: test-resources
USER: "${{ github.repository_owner }}"
BRANCH: "${{ github.ref_name }}"
runs-on: ${{ matrix.os }}
needs: [ init ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
path: camel-lsp-client-vscode
- name: Clone utils repo
if: ${{needs.init.outputs.branch_exists}} == 'true'
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH }}
repository: ${{ env.USER }}/vscode-uitests-tooling
path: vscode-uitests-tooling
# - name: Clone utils repo
# if: ${{needs.init.outputs.branch_exists}} == 'true'
# run: |
# git clone -b ${{ env.BRANCH }} https://github.com/${{ env.USER }}/vscode-uitests-tooling.git ../vscode-uitests-tooling
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
- name: Test java
run: java --version
- name: Install JBang (ubuntu, macOS)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-13'
run: |
curl -Ls https://sh.jbang.dev | bash -s - app setup
echo "$HOME/.jbang/bin" >> $GITHUB_PATH
- name: Install JBang (windows)
if: matrix.os == 'windows-latest'
run: choco install jbang
- name: Setup JBang (trusted sources)
run: jbang trust add https://github.com/apache/
- name: Setup Node
uses: actions/setup-node@v4
working-directory: camel-lsp-client-vscode
with:
node-version: 18.15.x
cache: npm
- name: Setup vsce
run: |
npm install -g typescript @vscode/vsce
vsce --version
- name: npm-ci
run: npm ci
- name: npm-vscode:prepublish
run: npm run vscode:prepublish
- name: test (ubuntu)
id: test_Ubuntu
if: matrix.os == 'ubuntu-latest'
run: xvfb-run --auto-servernum npm test
- name: test (macos, windows)
if: matrix.os != 'ubuntu-latest'
run: npm test
- name: Link utils to camel-lsp-client-vscode
if: env.BRANCH_EXISTS == 'true'
run: |
npm run dev --prefix ../vscode-uitests-tooling
npm link ../vscode-uitests-tooling
- name: ui test (ubuntu)
id: uiTest_Ubuntu
if: matrix.os == 'ubuntu-latest'
run: xvfb-run --auto-servernum npm run ui-test
- name: ui test (macos, windows)
id: uiTest_MacOS_Windows
if: matrix.os != 'ubuntu-latest'
run: npm run ui-test
- name: vsce-package
run: vsce package
- name: get-npm-version
id: package-version
if: matrix.os == 'ubuntu-latest'
uses: martinbeentjes/npm-get-version-action@v1.3.1
- name: Generate SBOM
if: matrix.os == 'ubuntu-latest'
run: |
npm install --global @cyclonedx/cyclonedx-npm
cyclonedx-npm --omit dev --output-file node-sbom.json
wget https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.25.0/cyclonedx-linux-x64
chmod +x cyclonedx-linux-x64
./cyclonedx-linux-x64 merge --hierarchical --group com.github.camel-tooling --name vscode-apache-camel --version ${{ steps.package-version.outputs.current-version}} --input-files node-sbom.json camel-ls-sbom.json --output-file manifest.json
- name: Store SBOM
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.version == 'max'
with:
name: sbom
path: manifest.json
- name: Store Camel Language Server log
uses: actions/upload-artifact@v4
if: failure() && matrix.os != 'windows-latest'
with:
name: ${{ matrix.os }}-${{ matrix.version }}-camel-lsp-log
path: |
/tmp/log-camel-lsp.log
/tmp/log-camel*.log.gz
- name: Store VS Code Logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ matrix.os }}-${{ matrix.version }}-test-logs
path: .vscode-test/logs/*
- name: Store UI test log
uses: actions/upload-artifact@v4
if: |
(failure() || cancelled()) &&
(steps.uiTest_Ubuntu.outcome == 'failure' ||
steps.uiTest_MacOS_Windows.outcome == 'failure' ||
steps.uiTest_Ubuntu.outcome == 'cancelled' ||
steps.uiTest_MacOS_Windows.outcome == 'cancelled')
with:
name: ${{ matrix.os }}-${{ matrix.version }}-ui-test-logs
path: test-resources/settings/logs/*
- name: Store UI Test Screenshots
uses: actions/upload-artifact@v4
if: |
(failure() || cancelled()) &&
(steps.uiTest_Ubuntu.outcome == 'failure' ||
steps.uiTest_MacOS_Windows.outcome == 'failure' ||
steps.uiTest_Ubuntu.outcome == 'cancelled' ||
steps.uiTest_MacOS_Windows.outcome == 'cancelled')
with:
name: ${{ matrix.os }}-${{ matrix.version }}-ui-test-screenshots
path: test-resources/screenshots/*.png
check:
if: always()
runs-on: ubuntu-latest
name: Status Check
needs: [ main ]
steps:
- name: Test Matrix Result
run: |
echo result = ${{ needs.main.result }}
- name: Status Check - success
if: ${{ needs.main.result == 'success' }}
run: |
echo "All tests successfully completed!"
exit 0
- name: Status Check - failure
if: ${{ needs.main.result != 'success' }}
run: |
echo "Status Check failed!"
exit 1