Skip to content

Commit

Permalink
build web examples on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
ofTheo committed Dec 5, 2023
1 parent c8570f1 commit 5b651b9
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 73 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/manual-web-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ name: build-web-examples


# make the action not run on the local repo if the branch is also in a pull request to OF/OF
#on:
# workflow_dispatch:
# inputs:
# release:
# description: 'release'
# required: true
# default: 'nightly'
on:
push:
if: github.event_name == 'push' && github.event.pull_request == null
paths-ignore:
- '**/*.md'
- 'examples/**'
pull_request:
if: github.event_name == 'pull_request' && github.repository == 'openframeworks/openFrameworks'
paths-ignore:
- '**/*.md'
- 'examples/**'
on:
workflow_dispatch:
inputs:
release:
description: 'release'
required: true
default: 'nightly'
#on:
# push:
# if: github.event_name == 'push' && github.event.pull_request == null
# paths-ignore:
# - '**/*.md'
# - 'examples/**'
# pull_request:
# if: github.event_name == 'pull_request' && github.repository == 'openframeworks/openFrameworks'
# paths-ignore:
# - '**/*.md'
# - 'examples/**'
jobs:
build-web-examples:
runs-on: ubuntu-20.04
Expand Down
109 changes: 54 additions & 55 deletions scripts/ci/emscripten/examples_to_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,61 @@
# List of folder paths to iterate through make sure there is no trailing slash
folders=(
"examples/3d/pointCloudExample"
# "examples/3d/3DPrimitivesExample"
# "examples/3d/ofxAssimpBoneControlExample"
# "examples/3d/ofxAssimpAdvancedExample"
# "examples/3d/ofxAssimpAdvancedExample"
"examples/3d/3DPrimitivesExample"
"examples/3d/ofxAssimpBoneControlExample"
"examples/3d/ofxAssimpAdvancedExample"
# Add more paths as needed
)

echo "RUNNING IN CI ${GH_BRANCH} ${GH_ACTIONS}"
echo "TRYING USER/SERVER ${GA_EXAMPLES_USER}@${GA_EXAMPLES_SERVER}"
#echo "RUNNING IN CI ${GH_BRANCH} ${GH_ACTIONS}"
#echo "TRYING USER/SERVER ${GA_EXAMPLES_USER}@${GA_EXAMPLES_SERVER}"

#cur_root=$(pwd);
#cd $cur_root;
#mkdir -p out
#out_folder="$cur_root/out"
#
## Iterate through the folder paths
#for folder in "${folders[@]}"; do
# # Check if the folder exists
# if [ -d "$folder" ]; then
#
# # Change to the directory
# cd $folder
# cp ../../../scripts/templates/emscripten/Makefile .
# cp ../../../scripts/templates/emscripten/config.make .
# emmake make -j2 Release
#
# errorcode=$?
# if [[ $errorcode -ne 0 ]]; then
# echo "Couldn't build emscripten example: $folder"
# else
# folder_name=$(basename "$folder")
# cp -r "bin/em/$folder_name" "$out_folder/"
# fi
#
# cd $cur_root
# else
# echo "Folder does not exist: $folder"
# fi
#done
#
#cd $cur_root;
#DO_UPLOAD="false"
#
##if [[ "$GH_ACTIONS" = true && "${GH_BRANCH}" == "master" && -z "${GH_HEAD_REF}" ]]; then
#if [[ "$GH_ACTIONS" = "true" ]]; then
# echo "upload 1/2 - make key file"
# # Temporary file to store the private key
# key_file=$(mktemp)
# echo -e "$GA_EXAMPLES_KEY" > "$key_file"
# chmod 600 "$key_file"
# DO_UPLOAD="true";
#fi
#
#if [ "$DO_UPLOAD" = "true" ]; then
# echo "upload 2/2 - time for rsync"
# remote_path="/home/ofadmin/openFrameworks.cc/examples/"
# rsync -avz -e "ssh -i $key_file" "$out_folder/" "$GA_EXAMPLES_USER@$GA_EXAMPLES_SERVER:$remote_path"
# rm -f "$key_file"
#fi
cur_root=$(pwd);
cd $cur_root;
mkdir -p out
out_folder="$cur_root/out"

# Iterate through the folder paths
for folder in "${folders[@]}"; do
# Check if the folder exists
if [ -d "$folder" ]; then

# Change to the directory
cd $folder
cp ../../../scripts/templates/emscripten/Makefile .
cp ../../../scripts/templates/emscripten/config.make .
emmake make -j2 Release

errorcode=$?
if [[ $errorcode -ne 0 ]]; then
echo "Couldn't build emscripten example: $folder"
else
folder_name=$(basename "$folder")
cp -r "bin/em/$folder_name" "$out_folder/"
fi

cd $cur_root
else
echo "Folder does not exist: $folder"
fi
done

cd $cur_root;
DO_UPLOAD="false"

#if [[ "$GH_ACTIONS" = true && "${GH_BRANCH}" == "master" && -z "${GH_HEAD_REF}" ]]; then
if [[ "$GH_ACTIONS" = "true" ]]; then
echo "upload 1/2 - make key file"
# Temporary file to store the private key
key_file=$(mktemp)
echo -e "$GA_EXAMPLES_KEY" > "$key_file"
chmod 600 "$key_file"
DO_UPLOAD="true";
fi

if [ "$DO_UPLOAD" = "true" ]; then
echo "upload 2/2 - time for rsync"
remote_path="/home/ofadmin/openFrameworks.cc/examples/"
rsync -avz -e "ssh -i $key_file" "$out_folder/" "$GA_EXAMPLES_USER@$GA_EXAMPLES_SERVER:$remote_path"
rm -f "$key_file"
fi

0 comments on commit 5b651b9

Please sign in to comment.