-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (121 loc) · 5.02 KB
/
Copy pathdeploy-cdd-web-ui.yml
File metadata and controls
145 lines (121 loc) · 5.02 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
name: Deploy Web UI to GitHub Pages
on:
push:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
env:
DEPLOY_LOCATION: /cdd-web-ui
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout main site (offscale.github.io)
uses: actions/checkout@v6
with:
path: main-site
- name: Checkout cdd-web-ui
uses: actions/checkout@v6
with:
repository: SamuelMarks/cdd-web-ui
path: cdd-web-ui
- name: Checkout cdd-docs-ui
uses: actions/checkout@v6
with:
repository: SamuelMarks/cdd-docs-ui
path: cdd-docs-ui
- name: Checkout cdd-ctl
uses: actions/checkout@v6
with:
repository: SamuelMarks/cdd-ctl
path: cdd-ctl
- name: Checkout cdd-openapi-test-harness
uses: actions/checkout@v6
with:
repository: SamuelMarks/cdd-openapi-test-harness
path: cdd-openapi-test-harness
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
- name: Install Binaryen
run: sudo apt-get update && sudo apt-get install -y binaryen
- name: Build cdd-java-cli
working-directory: ./cdd-openapi-test-harness/cdd-java
run: |
git checkout master
git pull origin master
cd package
npm install --ignore-scripts
npm run build
- name: Build WASM SDK
working-directory: ./cdd-ctl/cdd-ctl-wasm-sdk
run: |
npm install --ignore-scripts
npm run build
- name: Fetch and Optimize WASM Binaries
working-directory: ./cdd-ctl
run: |
chmod +x ./scripts/fetch_wasm.sh
./scripts/fetch_wasm.sh
mkdir -p ./optimized-wasm
for wasm_file in cdd-ctl-wasm-sdk/assets/wasm/*.wasm; do
filename=$(basename "$wasm_file")
echo "Optimizing $filename..."
wasm-opt -O3 "$wasm_file" -o "./optimized-wasm/$filename" || cp "$wasm_file" "./optimized-wasm/$filename"
done
# Download JS Wrappers and C# Zip manually since fetch_wasm.sh skips them
curl -sL -o ./optimized-wasm/cdd-ts.js "https://github.com/offscale/cdd-ts/releases/latest/download/cdd-ts.js" || true
curl -sL -o ./optimized-wasm/cdd-ts-javy.wasm "https://github.com/offscale/cdd-ts/releases/latest/download/cdd-ts-javy.wasm" || true
curl -sL -o ./optimized-wasm/cdd-java.js "https://github.com/SamuelMarks/cdd-java/releases/latest/download/cdd-java.js" || true
curl -sL -o ./cdd-csharp-wasm.zip "https://github.com/SamuelMarks/cdd-csharp/releases/latest/download/cdd-csharp-wasm.zip" || true
curl -sL -o ./optimized-wasm/openapi_python_client-0.0.1-py3-none-any.whl "https://github.com/offscale/cdd-python-all/releases/latest/download/openapi_python_client-0.0.1-py3-none-any.whl" || true
# Force python-all, java, and ts to true in the generated JSON since they are now present
sed -i 's/"python-all": false/"python-all": true/g' cdd-ctl-wasm-sdk/assets/wasm-support.json || true
sed -i 's/"java": false/"java": true/g' cdd-ctl-wasm-sdk/assets/wasm-support.json || true
sed -i 's/"ts": false/"ts": true/g' cdd-ctl-wasm-sdk/assets/wasm-support.json || true
- name: Build cdd-docs-ui
working-directory: ./cdd-docs-ui
run: |
npm install --ignore-scripts
npm run build
- name: Install UI Dependencies
working-directory: ./cdd-web-ui
run: npm ci --ignore-scripts
- name: Copy WASM Binaries to Web UI
run: |
mkdir -p cdd-web-ui/public/assets/wasm/
cp cdd-ctl/optimized-wasm/*.wasm cdd-web-ui/public/assets/wasm/ || true
cp cdd-ctl/optimized-wasm/*.js cdd-web-ui/public/assets/wasm/ || true
cp cdd-ctl/optimized-wasm/*.whl cdd-web-ui/public/assets/wasm/ || true
unzip -q cdd-ctl/cdd-csharp-wasm.zip -d cdd-web-ui/public/assets/wasm/ || true
cp cdd-ctl/cdd-ctl-wasm-sdk/assets/wasm-support.json cdd-web-ui/public/assets/wasm-support.json || true
- name: Compute base-href and Build Angular App
working-directory: ./cdd-web-ui
run: |
echo "Building Angular with --base-href=/cdd-web-ui/"
npx ng build --configuration production --base-href /cdd-web-ui/
- name: Combine Site Artifacts
run: |
rm -rf main-site/cdd-web-ui
cp -r cdd-web-ui/dist/cdd-web-ui/browser main-site/cdd-web-ui
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: ./main-site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5