Skip to content

Commit 5b651b9

Browse files
committed
build web examples on demand
1 parent c8570f1 commit 5b651b9

File tree

2 files changed

+72
-73
lines changed

2 files changed

+72
-73
lines changed

.github/workflows/manual-web-examples.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ name: build-web-examples
22

33

44
# make the action not run on the local repo if the branch is also in a pull request to OF/OF
5-
#on:
6-
# workflow_dispatch:
7-
# inputs:
8-
# release:
9-
# description: 'release'
10-
# required: true
11-
# default: 'nightly'
12-
on:
13-
push:
14-
if: github.event_name == 'push' && github.event.pull_request == null
15-
paths-ignore:
16-
- '**/*.md'
17-
- 'examples/**'
18-
pull_request:
19-
if: github.event_name == 'pull_request' && github.repository == 'openframeworks/openFrameworks'
20-
paths-ignore:
21-
- '**/*.md'
22-
- 'examples/**'
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
release:
9+
description: 'release'
10+
required: true
11+
default: 'nightly'
12+
#on:
13+
# push:
14+
# if: github.event_name == 'push' && github.event.pull_request == null
15+
# paths-ignore:
16+
# - '**/*.md'
17+
# - 'examples/**'
18+
# pull_request:
19+
# if: github.event_name == 'pull_request' && github.repository == 'openframeworks/openFrameworks'
20+
# paths-ignore:
21+
# - '**/*.md'
22+
# - 'examples/**'
2323
jobs:
2424
build-web-examples:
2525
runs-on: ubuntu-20.04

scripts/ci/emscripten/examples_to_build.sh

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,61 @@
33
# List of folder paths to iterate through make sure there is no trailing slash
44
folders=(
55
"examples/3d/pointCloudExample"
6-
# "examples/3d/3DPrimitivesExample"
7-
# "examples/3d/ofxAssimpBoneControlExample"
8-
# "examples/3d/ofxAssimpAdvancedExample"
9-
# "examples/3d/ofxAssimpAdvancedExample"
6+
"examples/3d/3DPrimitivesExample"
7+
"examples/3d/ofxAssimpBoneControlExample"
8+
"examples/3d/ofxAssimpAdvancedExample"
109
# Add more paths as needed
1110
)
1211

13-
echo "RUNNING IN CI ${GH_BRANCH} ${GH_ACTIONS}"
14-
echo "TRYING USER/SERVER ${GA_EXAMPLES_USER}@${GA_EXAMPLES_SERVER}"
12+
#echo "RUNNING IN CI ${GH_BRANCH} ${GH_ACTIONS}"
13+
#echo "TRYING USER/SERVER ${GA_EXAMPLES_USER}@${GA_EXAMPLES_SERVER}"
1514

16-
#cur_root=$(pwd);
17-
#cd $cur_root;
18-
#mkdir -p out
19-
#out_folder="$cur_root/out"
20-
#
21-
## Iterate through the folder paths
22-
#for folder in "${folders[@]}"; do
23-
# # Check if the folder exists
24-
# if [ -d "$folder" ]; then
25-
#
26-
# # Change to the directory
27-
# cd $folder
28-
# cp ../../../scripts/templates/emscripten/Makefile .
29-
# cp ../../../scripts/templates/emscripten/config.make .
30-
# emmake make -j2 Release
31-
#
32-
# errorcode=$?
33-
# if [[ $errorcode -ne 0 ]]; then
34-
# echo "Couldn't build emscripten example: $folder"
35-
# else
36-
# folder_name=$(basename "$folder")
37-
# cp -r "bin/em/$folder_name" "$out_folder/"
38-
# fi
39-
#
40-
# cd $cur_root
41-
# else
42-
# echo "Folder does not exist: $folder"
43-
# fi
44-
#done
45-
#
46-
#cd $cur_root;
47-
#DO_UPLOAD="false"
48-
#
49-
##if [[ "$GH_ACTIONS" = true && "${GH_BRANCH}" == "master" && -z "${GH_HEAD_REF}" ]]; then
50-
#if [[ "$GH_ACTIONS" = "true" ]]; then
51-
# echo "upload 1/2 - make key file"
52-
# # Temporary file to store the private key
53-
# key_file=$(mktemp)
54-
# echo -e "$GA_EXAMPLES_KEY" > "$key_file"
55-
# chmod 600 "$key_file"
56-
# DO_UPLOAD="true";
57-
#fi
58-
#
59-
#if [ "$DO_UPLOAD" = "true" ]; then
60-
# echo "upload 2/2 - time for rsync"
61-
# remote_path="/home/ofadmin/openFrameworks.cc/examples/"
62-
# rsync -avz -e "ssh -i $key_file" "$out_folder/" "$GA_EXAMPLES_USER@$GA_EXAMPLES_SERVER:$remote_path"
63-
# rm -f "$key_file"
64-
#fi
15+
cur_root=$(pwd);
16+
cd $cur_root;
17+
mkdir -p out
18+
out_folder="$cur_root/out"
19+
20+
# Iterate through the folder paths
21+
for folder in "${folders[@]}"; do
22+
# Check if the folder exists
23+
if [ -d "$folder" ]; then
24+
25+
# Change to the directory
26+
cd $folder
27+
cp ../../../scripts/templates/emscripten/Makefile .
28+
cp ../../../scripts/templates/emscripten/config.make .
29+
emmake make -j2 Release
30+
31+
errorcode=$?
32+
if [[ $errorcode -ne 0 ]]; then
33+
echo "Couldn't build emscripten example: $folder"
34+
else
35+
folder_name=$(basename "$folder")
36+
cp -r "bin/em/$folder_name" "$out_folder/"
37+
fi
38+
39+
cd $cur_root
40+
else
41+
echo "Folder does not exist: $folder"
42+
fi
43+
done
44+
45+
cd $cur_root;
46+
DO_UPLOAD="false"
47+
48+
#if [[ "$GH_ACTIONS" = true && "${GH_BRANCH}" == "master" && -z "${GH_HEAD_REF}" ]]; then
49+
if [[ "$GH_ACTIONS" = "true" ]]; then
50+
echo "upload 1/2 - make key file"
51+
# Temporary file to store the private key
52+
key_file=$(mktemp)
53+
echo -e "$GA_EXAMPLES_KEY" > "$key_file"
54+
chmod 600 "$key_file"
55+
DO_UPLOAD="true";
56+
fi
57+
58+
if [ "$DO_UPLOAD" = "true" ]; then
59+
echo "upload 2/2 - time for rsync"
60+
remote_path="/home/ofadmin/openFrameworks.cc/examples/"
61+
rsync -avz -e "ssh -i $key_file" "$out_folder/" "$GA_EXAMPLES_USER@$GA_EXAMPLES_SERVER:$remote_path"
62+
rm -f "$key_file"
63+
fi

0 commit comments

Comments
 (0)