Skip to content

Commit c1527c1

Browse files
committed
feat(rakefile): add :ci task to skip install on web (preinstalled)
1 parent 14d9cdb commit c1527c1

3 files changed

Lines changed: 38 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
fetch-tags: true # Tag history is needed to generate nodable version and..
4040
fetch-depth: 100 # ..we also need some commits to generate the version name (uses `git describe --tags`), until now this value was enough.
4141

42-
- run: rake install
42+
- run: rake ci
4343

4444
- if: env.PLATFORM == 'web'
4545
run: |

rake/build-tools.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,3 +886,6 @@ def file_pattern_split(pattern)
886886
return src, dst
887887
end
888888

889+
def run_sudo_apt_install(packages)
890+
system("sudo apt install #{packages.join(" ")}", exception: true)
891+
end

rakefile

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,43 @@ task :rebuild_all do
8282
end
8383
end
8484

85+
APT_PACKAGES = [
86+
"libx11-dev",
87+
"libgl1-mesa-dev",
88+
]
89+
90+
def install_emsdk()
91+
system("python extern/emsdk/emsdk.py install latest --system", exception: true) # Make the "latest" SDK "active" for the current user. (writes .emscripten file)
92+
end
93+
94+
def activate_emsdk()
95+
system("python extern/emsdk/emsdk.py activate latest --system", exception: true) # Make the "latest" SDK "active" for the current user. (writes .emscripten file)
96+
end
97+
98+
task :ci do
99+
case PLATFORM
100+
when PLATFORM_LINUX
101+
run_sudo_apt_install(APT_PACKAGES)
102+
when PLATFORM_WEB
103+
install_emsdk()
104+
activate_emsdk()
105+
else
106+
puts "INFO: Nothing to install on CI for #{PLATFORM}"
107+
end
108+
end
109+
85110
desc "Install system dependencies"
86111
task :install do
87-
88-
if LINUX
89-
# The CI may not have it
90-
# Even if we add them via vcpkg for convenience, we still need to install the system packages
91-
apt_packages = [
92-
"libx11-dev",
93-
"libgl1-mesa-dev",
94-
]
95-
system("sudo apt install #{apt_packages.join(" ")}", exception: true)
96-
97-
elsif WINDOWS
98-
puts "INFO: NOthing to install on windows"
99-
elsif WEB
100-
system("python extern/emsdk/emsdk.py install latest --system", exception: true) # Download and install the latest SDK tools.
101-
system("python extern/emsdk/emsdk.py activate latest --system", exception: true) # Make the "latest" SDK "active" for the current user. (writes .emscripten file)
112+
case PLATFORM
113+
when PLATFORM_LINUX
114+
run_sudo_apt_install(APT_PACKAGES)
115+
when PLATFORM_WEB
116+
install_emsdk()
117+
activate_emsdk()
102118
puts("emsdk environment has been activated, consider running source extern/emsdk/emdsk_env.sh to get commands (emcc, emrun, etc)")
103-
end
119+
else
120+
puts "INFO: Nothing to install on #{PLATFORM}"
121+
end
104122
end
105123

106124
desc "Recompiles vcpkg binaries"

0 commit comments

Comments
 (0)