Skip to content

Commit 96eea1a

Browse files
Added initial web page
1 parent 4326232 commit 96eea1a

35 files changed

+801
-27
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build and Deploy Artifacts
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: macos-latest
8+
name: MacOS -> Build
9+
10+
steps:
11+
- name: Clone DiligentGraphics.github.io repository
12+
uses: actions/checkout@v3
13+
with:
14+
submodules: recursive
15+
16+
- name: Set up build environment
17+
if: success()
18+
uses: DiligentGraphics/github-action/setup-build-env@v1
19+
with:
20+
platform: Emscripten
21+
22+
- name: Build artifacts
23+
if: success()
24+
working-directory: ${{github.workspace}}
25+
run: |
26+
python ./build_artifacts.py
27+
28+
- name: Upload artifacts
29+
if: success()
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: WebPage-DiligentGraphics.github.io
33+
path: |
34+
${{github.workspace}}/BuildArtifacts
35+
retention-days: 90
36+
37+
deploy:
38+
needs: build
39+
runs-on: macos-latest
40+
name: MacOS -> Deploy
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v3
45+
46+
- name: Download artifacts
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: WebPage-DiligentGraphics.github.io
50+
path: ./build
51+
52+
- name: Deploy to GitHub Pages
53+
run: |
54+
git config --global user.name 'github-actions[bot]'
55+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
56+
git checkout --orphan gh-pages
57+
git rm -rf .
58+
cp -r build/* .
59+
git add .
60+
git commit -m "Deploy to GitHub Pages"
61+
git push -f origin gh-pages

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CMakeFiles
2+
*.cmake
3+
https_server.py
4+
DiligentEngine
5+
BuildArtifacts

build_artifacts.py

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import os
2+
import re
3+
import subprocess
4+
import shutil
5+
6+
DILIGENT_ENGINE_URL = 'https://github.com/DiligentGraphics/DiligentEngine.git'
7+
SOURCE_IMAGES = 'images'
8+
SOURCE_TEMPLATE = 'template'
9+
SOURCE_BUILD = 'DiligentEngine/build/Emscripten/DiligentSamples'
10+
DESTINATION_DIR = 'BuildArtifacts'
11+
BUILD_TARGETS = [
12+
"Tutorial01_HelloTriangle",
13+
"Tutorial02_Cube",
14+
"Tutorial03_Texturing",
15+
"Tutorial04_Instancing",
16+
"Tutorial05_TextureArray",
17+
"Tutorial06_Multithreading",
18+
"Tutorial09_Quads",
19+
"Tutorial10_DataStreaming",
20+
"Tutorial11_ResourceUpdates",
21+
"Tutorial12_RenderTarget",
22+
"Tutorial13_ShadowMap",
23+
"Tutorial14_ComputeShader",
24+
"Tutorial16_BindlessResources",
25+
"Tutorial17_MSAA",
26+
"Tutorial18_Queries",
27+
"Tutorial19_RenderPasses",
28+
"Tutorial26_StateCache",
29+
"Tutorial27_PostProcessing",
30+
31+
"Atmosphere",
32+
"ImguiDemo",
33+
"Shadows"
34+
]
35+
36+
def extract_repoitory_name(repository_url):
37+
match = re.search(r'/([^/]+?)(\.git)?$', repository_url)
38+
if match:
39+
return match.group(1)
40+
else:
41+
raise ValueError(f"Invalid repository URL: {repository_url}")
42+
43+
def clone_repository(repository_url):
44+
try:
45+
repo_name = extract_repoitory_name(repository_url)
46+
target_dir = f"./{repo_name}"
47+
if os.path.exists(target_dir):
48+
print(f"Repository already cloned in '{target_dir}'. Skipping clone.")
49+
else:
50+
command = ["git", "clone", "--recursive", "--depth", "1", repository_url]
51+
subprocess.run(command, check=True)
52+
except subprocess.CalledProcessError as e:
53+
print(f"An error occurred while cloning the repository: {e}")
54+
except Exception as e:
55+
print(f"An unexpected error occurred: {e}")
56+
57+
def configure_project():
58+
try:
59+
command = ["emcmake", "cmake", "-S", "./DiligentEngine", "-B", "./DiligentEngine/build/Emscripten", "-DCMAKE_BUILD_TYPE=Release"]
60+
subprocess.run(command, check=True)
61+
except subprocess.CalledProcessError as e:
62+
print(f"An error occurred while configuring the project: {e}")
63+
except Exception as e:
64+
print(f"An unexpected error occurred: {e}")
65+
66+
def build_project():
67+
try:
68+
command = ["cmake", "--build", "./DiligentEngine/build/Emscripten"]
69+
subprocess.run(command, check=True)
70+
except subprocess.CalledProcessError as e:
71+
print(f"An error occurred while building the project: {e}")
72+
except Exception as e:
73+
print(f"An unexpected error occurred: {e}")
74+
75+
def upload_artefacts():
76+
if not os.path.exists(DESTINATION_DIR):
77+
os.makedirs(DESTINATION_DIR)
78+
79+
shutil.copytree(SOURCE_IMAGES, os.path.join(DESTINATION_DIR, 'images'), dirs_exist_ok=True)
80+
for item in os.listdir(SOURCE_TEMPLATE):
81+
source_item = os.path.join(SOURCE_TEMPLATE, item)
82+
destination_item = os.path.join(DESTINATION_DIR, item) # Corrected the destination path
83+
84+
if os.path.isdir(source_item):
85+
shutil.copytree(source_item, destination_item, dirs_exist_ok=True)
86+
else:
87+
shutil.copy2(source_item, destination_item)
88+
89+
for folder in BUILD_TARGETS:
90+
source_folder_path_tutorials = os.path.join(SOURCE_BUILD, "Tutorials", folder)
91+
source_folder_path_samples = os.path.join(SOURCE_BUILD, "Samples", folder)
92+
destination_folder_path = os.path.join(DESTINATION_DIR, "wasm-modules", folder)
93+
94+
if os.path.exists(source_folder_path_tutorials):
95+
shutil.copytree(source_folder_path_tutorials, destination_folder_path, dirs_exist_ok=True)
96+
elif os.path.exists(source_folder_path_samples):
97+
shutil.copytree(source_folder_path_samples, destination_folder_path, dirs_exist_ok=True)
98+
else:
99+
print(f"Folder '{folder}' not found.")
100+
101+
if __name__ == '__main__':
102+
clone_repository(DILIGENT_ENGINE_URL)
103+
configure_project()
104+
build_project()
105+
upload_artefacts()
1.02 MB
Loading
100 KB
Loading
9.85 KB
Loading

images/content/samples/Shadows.jpg

220 KB
Loading
766 Bytes
Loading
102 KB
Loading
995 KB
Loading

0 commit comments

Comments
 (0)