Skip to content

Commit 9ef5dd7

Browse files
authored
Cleanup CI (#147)
1 parent 76ff7ea commit 9ef5dd7

File tree

7 files changed

+112
-200
lines changed

7 files changed

+112
-200
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Composite action to build and cache WASM dependencies (slang, spirv-tools)
2+
name: 'Build WASM Deps'
3+
description: 'Build and cache WASM dependencies (slang, spirv-tools) for the project.'
4+
inputs:
5+
build-artifacts-dir:
6+
description: 'Directory to move built artifacts into.'
7+
required: true
8+
default: ./src
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Setup emsdk
13+
shell: bash
14+
run: |
15+
sudo apt-get update
16+
sudo apt-get install -y ninja-build
17+
if [ ! -d "emsdk" ]; then
18+
git clone https://github.com/emscripten-core/emsdk.git
19+
sed -i 's/\r$//' emsdk/emsdk emsdk/emsdk_env.sh
20+
fi
21+
22+
- name: get slang head commit
23+
shell: bash
24+
run: |
25+
if [ ! -d "slang-repo" ]; then
26+
git clone https://github.com/shader-slang/slang.git slang-repo
27+
fi
28+
git -C slang-repo rev-parse HEAD > key.txt
29+
30+
- name: get spirv-tool head commit
31+
shell: bash
32+
run: |
33+
if [ ! -d "spirv-tools" ]; then
34+
git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
35+
pushd spirv-tools
36+
git checkout vulkan-sdk-1.3.290.0
37+
popd
38+
fi
39+
git -C spirv-tools rev-parse HEAD > key-spirv-tool.txt
40+
41+
- name: restore slang-wasm
42+
id: cache_slang
43+
uses: actions/cache/restore@v4
44+
with:
45+
path: |
46+
./slang-wasm.wasm.gz
47+
./slang-wasm.js
48+
./slang-wasm.d.ts
49+
key: ${{ hashFiles('key.txt') }}
50+
51+
- name: restore spirv-tools
52+
id: cache_spirv_tools
53+
uses: actions/cache/restore@v4
54+
with:
55+
path: |
56+
./spirv-tools.wasm
57+
./spirv-tools.js
58+
./spirv-tools.d.ts
59+
key: ${{ hashFiles('key-spirv-tool.txt') }}
60+
61+
- name: slang-wasm build
62+
if: steps.cache_slang.outputs.cache-hit != 'true'
63+
shell: bash
64+
run: |
65+
/bin/bash -x ./build_scripts/slang-wasm-build.sh
66+
67+
- name: save slang-wasm
68+
if: steps.cache_slang.outputs.cache-hit != 'true'
69+
uses: actions/cache/save@v4
70+
with:
71+
path: |
72+
./slang-wasm.wasm.gz
73+
./slang-wasm.js
74+
./slang-wasm.d.ts
75+
key: ${{ hashFiles('key.txt') }}
76+
77+
- name: spirv-tools-wasm build
78+
if: steps.cache_spirv_tools.outputs.cache-hit != 'true'
79+
shell: bash
80+
run: |
81+
/bin/bash -x ./build_scripts/spirv-tool-wasm-build.sh
82+
83+
- name: save spirv-tools-wasm
84+
if: steps.cache_spirv_tools.outputs.cache-hit != 'true'
85+
uses: actions/cache/save@v4
86+
with:
87+
path: |
88+
./spirv-tools.wasm
89+
./spirv-tools.js
90+
./spirv-tools.d.ts
91+
key: ${{ hashFiles('key-spirv-tool.txt') }}
92+
93+
- name: Move artifacts
94+
shell: bash
95+
run: |
96+
mkdir -p ${{ inputs.build-artifacts-dir }}
97+
mv ./slang-wasm.wasm.gz ./slang-wasm.js ./slang-wasm.d.ts ${{ inputs.build-artifacts-dir }}/
98+
mv ./spirv-tools.wasm ./spirv-tools.js ./spirv-tools.d.ts ${{ inputs.build-artifacts-dir }}/

.github/workflows/build-dependencies.yml

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,48 +19,14 @@ jobs:
1919
- name: Checkout
2020
uses: actions/checkout@v4
2121

22-
- name: get slang head commit
23-
run: |
24-
sudo apt-get update
25-
sudo apt-get install -y ninja-build
26-
mkdir slang-repo
27-
pushd slang-repo
28-
git clone https://github.com/shader-slang/slang.git
29-
popd
30-
echo "$(git -C slang-repo/slang rev-parse HEAD)" >> key.txt
31-
32-
- name: get spirv-tool head commit
33-
run: |
34-
git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
35-
pushd spirv-tools
36-
git checkout vulkan-sdk-1.3.290.0
37-
popd
38-
echo "$(git -C spirv-tools rev-parse HEAD)" >> key-spirv-tool.txt
39-
40-
- name: slang-wasm build
41-
run: |
42-
sed -i -e 's/\r$//' ./slang-wasm-build.sh
43-
chmod +x ./slang-wasm-build.sh
44-
./slang-wasm-build.sh
45-
46-
- name: spirv-tools-wasm build
47-
run: |
48-
sed -i -e 's/\r$//' ./spirv-tool-wasm-build.sh
49-
chmod +x ./spirv-tool-wasm-build.sh
50-
./spirv-tool-wasm-build.sh
51-
52-
- name: Cleanup workspace, move files, and build
53-
run: |
54-
rm -rf slang-repo
55-
rm -rf emsdk
56-
rm -rf spirv-tools
57-
mkdir dependencies
58-
mv ./slang-wasm.wasm.gz ./slang-wasm.js ./slang-wasm.d.ts ./dependencies/
59-
mv ./spirv-tools.wasm ./spirv-tools.js ./spirv-tools.d.ts ./dependencies/
22+
- name: Build and cache WASM dependencies
23+
uses: ./.github/actions/build-wasm-deps
24+
with:
25+
build-artifacts-dir: ./dependencies
6026

6127
- name: Upload export artifact
6228
uses: actions/upload-artifact@v4
6329
with:
64-
name: site-artifact
30+
name: dependencies
6531
path: ./dependencies/
6632
compression-level: 1

.github/workflows/ci.yml

Lines changed: 4 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -13,82 +13,13 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v4
1515

16-
- name: get emsdk
17-
run: |
18-
sudo apt-get update
19-
sudo apt-get install -y ninja-build
20-
git clone https://github.com/emscripten-core/emsdk.git
21-
sed -i 's/\r$//' emsdk/emsdk emsdk/emsdk_env.sh
22-
23-
- name: get slang head commit
24-
run: |
25-
git clone https://github.com/shader-slang/slang.git slang-repo
26-
git -C slang-repo rev-parse HEAD > key.txt
27-
28-
- name: get spirv-tool head commit
29-
run: |
30-
git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
31-
pushd spirv-tools
32-
git checkout vulkan-sdk-1.3.290.0
33-
popd
34-
git -C spirv-tools rev-parse HEAD > key-spirv-tool.txt
35-
36-
- name: restore slang-wasm
37-
id: cache_slang
38-
uses: actions/cache/restore@v4
16+
- name: Build and cache WASM dependencies
17+
uses: ./.github/actions/build-wasm-deps
3918
with:
40-
path: |
41-
./slang-wasm.wasm.gz
42-
./slang-wasm.js
43-
./slang-wasm.d.ts
44-
key: ${{hashFiles('key.txt')}}
45-
46-
- name: restore spirv-tools
47-
id: cache_spirv_tools
48-
uses: actions/cache/restore@v4
49-
with:
50-
path: |
51-
./spirv-tools.wasm
52-
./spirv-tools.js
53-
./spirv-tools.d.ts
54-
key: ${{hashFiles('key-spirv-tool.txt')}}
55-
56-
- name: slang-wasm build
57-
if: steps.cache_slang.outputs.cache-hit != 'true'
58-
run: |
59-
sed -i 's/\r$//' ./slang-wasm-build.sh
60-
/bin/bash -x ./slang-wasm-build.sh
61-
62-
- name: save slang-wasm
63-
if: always() && steps.cache_slang.outputs.cache-hit != 'true'
64-
uses: actions/cache/save@v4
65-
with:
66-
path: |
67-
./slang-wasm.wasm.gz
68-
./slang-wasm.js
69-
./slang-wasm.d.ts
70-
key: ${{hashFiles('key.txt')}}
71-
72-
- name: spirv-tools-wasm build
73-
if: steps.cache_spirv_tools.outputs.cache-hit != 'true'
74-
run: |
75-
sed -i 's/\r$//' ./spirv-tool-wasm-build.sh
76-
/bin/bash -x ./spirv-tool-wasm-build.sh
77-
78-
- name: save spirv-tools-wasm
79-
if: always() && steps.cache_spirv_tools.outputs.cache-hit != 'true'
80-
uses: actions/cache/save@v4
81-
with:
82-
path: |
83-
./spirv-tools.wasm
84-
./spirv-tools.js
85-
./spirv-tools.d.ts
86-
key: ${{hashFiles('key-spirv-tool.txt')}}
19+
build-artifacts-dir: ./src
8720

8821
- name: Build
8922
run: |
90-
cp ./slang-wasm.wasm.gz ./slang-wasm.js ./slang-wasm.d.ts ./src/
91-
cp ./spirv-tools.wasm ./spirv-tools.js ./spirv-tools.d.ts ./src/
9223
npm install
9324
npm run build
9425
@@ -101,6 +32,7 @@ jobs:
10132

10233
- name: Smoke test
10334
run: |
35+
cp ./src/slang-wasm.wasm.gz ./src/slang-wasm.js ./src/slang-wasm.d.ts ./
10436
pushd emsdk
10537
/bin/sh ./emsdk install latest
10638
/bin/sh ./emsdk activate latest
@@ -110,8 +42,3 @@ jobs:
11042
cp src/slang-wasm.wasm ./
11143
cp slang-repo/tests/wasm/smoke/smoke-test.js slang-repo/
11244
node slang-repo/smoke-test.js src/slang/rand_float.slang computeMain
113-
114-
- name: Cleanup workspace
115-
run: |
116-
rm -rf slang-repo emsdk spirv-tools
117-
rm ./slang-wasm.wasm.gz ./slang-wasm.js ./slang-wasm.d.ts ./spirv-tools.wasm ./spirv-tools.js ./spirv-tools.d.ts

.github/workflows/jekyll-gh-pages.yml

Lines changed: 4 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -29,80 +29,13 @@ jobs:
2929
- name: Checkout
3030
uses: actions/checkout@v4
3131

32-
- name: get slang head commit
33-
run: |
34-
sudo apt-get update
35-
sudo apt-get install -y ninja-build
36-
git clone https://github.com/shader-slang/slang.git slang-repo
37-
git -C slang-repo rev-parse HEAD > key.txt
38-
39-
- name: get spirv-tool head commit
40-
run: |
41-
git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
42-
pushd spirv-tools
43-
git checkout vulkan-sdk-1.3.290.0
44-
popd
45-
git -C spirv-tools rev-parse HEAD > key-spirv-tool.txt
46-
47-
- name: restore slang-wasm
48-
id: cache_slang
49-
uses: actions/cache/restore@v4
50-
with:
51-
path: |
52-
./slang-wasm.wasm.gz
53-
./slang-wasm.js
54-
./slang-wasm.d.ts
55-
key: ${{hashFiles('key.txt')}}
56-
57-
- name: restore spirv-tools
58-
id: cache_spirv_tools
59-
uses: actions/cache/restore@v4
60-
with:
61-
path: |
62-
./spirv-tools.wasm
63-
./spirv-tools.js
64-
./spirv-tools.d.ts
65-
key: ${{hashFiles('key-spirv-tool.txt')}}
66-
67-
- name: slang-wasm build
68-
if: steps.cache_slang.outputs.cache-hit != 'true'
69-
run: |
70-
sed -i 's/\r$//' ./slang-wasm-build.sh
71-
/bin/bash -x ./slang-wasm-build.sh
72-
73-
- name: save slang-wasm
74-
if: always() && steps.cache_slang.outputs.cache-hit != 'true'
75-
uses: actions/cache/save@v4
76-
with:
77-
path: |
78-
./slang-wasm.wasm.gz
79-
./slang-wasm.js
80-
./slang-wasm.d.ts
81-
key: ${{hashFiles('key.txt')}}
82-
83-
- name: spirv-tools-wasm build
84-
if: steps.cache_spirv_tools.outputs.cache-hit != 'true'
85-
run: |
86-
sed -i 's/\r$//' ./spirv-tool-wasm-build.sh
87-
/bin/bash -x ./spirv-tool-wasm-build.sh
88-
89-
- name: save spirv-tools-wasm
90-
if: always() && steps.cache_spirv_tools.outputs.cache-hit != 'true'
91-
uses: actions/cache/save@v4
32+
- name: Build and cache WASM dependencies
33+
uses: ./.github/actions/build-wasm-deps
9234
with:
93-
path: |
94-
./spirv-tools.wasm
95-
./spirv-tools.js
96-
./spirv-tools.d.ts
97-
key: ${{hashFiles('key-spirv-tool.txt')}}
35+
build-artifacts-dir: ./src
9836

99-
- name: Cleanup workspace, move files, and build
37+
- name: Build
10038
run: |
101-
rm -rf slang-repo
102-
rm -rf emsdk
103-
rm -rf spirv-tools
104-
mv ./slang-wasm.wasm.gz ./slang-wasm.js ./slang-wasm.d.ts ./src/
105-
mv ./spirv-tools.wasm ./spirv-tools.js ./spirv-tools.d.ts ./src/
10639
npm install
10740
npm run build
10841

build_scripts/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sh text eol=lf

slang-wasm-build.sh renamed to build_scripts/slang-wasm-build.sh

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,9 @@ pushd emsdk
2626
popd
2727

2828
echo "[$(date)] Sync slang repo ..."
29-
if [ -d slang-repo ]
30-
then
31-
echo "Remove stale slang-repo dir"
32-
rm -rf slang-repo
33-
fi
34-
3529
if [ ! -d slang-repo ]
3630
then
37-
echo "[$(date)] Cloning slang repository into slang-repo..."
3831
git clone https://github.com/shader-slang/slang.git slang-repo
39-
if [ $? -ne 0 ]
40-
then
41-
echo "Error: Failed to clone slang repository"
42-
exit 1
43-
fi
44-
echo "[$(date)] Successfully cloned slang repository"
4532
fi
4633

4734
pushd slang-repo
File renamed without changes.

0 commit comments

Comments
 (0)