openscad-playground icon indicating copy to clipboard operation
openscad-playground copied to clipboard

WASM version in makefile 404s

Open stockholmux opened this issue 2 years ago • 10 comments

When attempting to run make public the following error message is produced:

mkdir -p libs/openscad-wasm
wget https://files.openscad.org/snapshots/OpenSCAD-2023.03.22.wasm14181-WebAssembly.zip -O libs/openscad-wasm.zip
--2023-07-02 09:32:33--  https://files.openscad.org/snapshots/OpenSCAD-2023.03.22.wasm14181-WebAssembly.zip
Resolving files.openscad.org (files.openscad.org)... 104.236.249.91
Connecting to files.openscad.org (files.openscad.org)|104.236.249.91|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2023-07-02 09:32:34 ERROR 404: Not Found.

I think make attempts to get https://files.openscad.org/snapshots/OpenSCAD-2023.03.22.wasm14181-WebAssembly.zip which is no longer available in https://files.openscad.org/snapshots/.

I was able to alter the make file to a newer similar file and get it to complete, but the web app doesn't function properly, so once I run down that they are not related, I'm glad to contribute a fix.

stockholmux avatar Jul 02 '23 16:07 stockholmux

I've updated the path to a file that is not auto-cleaned. Also I needed to force bash as extended syntax is used.

It looks like the public folder has a openscad.wasm checked in, so maybe that's also a good starting point.

t-paul avatar Jul 02 '23 17:07 t-paul

Thanks! I'll poke around with this!

stockholmux avatar Jul 02 '23 17:07 stockholmux

Make issue seems to be resolved.

Seems like the openscad.wasm file be in .gitignore? Every time someone does a make public it updates the file and it'll get checked in all the time.

stockholmux avatar Jul 02 '23 17:07 stockholmux

Hmm, good question. I'm not sure about the original intention. @ochafik what do you think?

t-paul avatar Jul 02 '23 20:07 t-paul

Sorry I've been.. absent :-D

I've just removed (in https://github.com/openscad/openscad-playground/pull/26) the public/openscad.{js,wasm} which were gitignored but erroneously checked in.

ochafik avatar May 30 '24 16:05 ochafik

Hmm, the snapshot folder is cleaned up automatically, so I guess we need to find some way of tagging the referenced version. Last time I just copied the latest build to the playground folder manually but something automatic would be good. I suppose a minimal way preventing future 404 would be blocking the referenced file from being cleaned up on the file server.

t-paul avatar May 30 '24 19:05 t-paul

@t-paul The easiest way to get the last version would be this Python snippet:

# pip install bs4 requests
from bs4 import BeautifulSoup
import sys
import requests

url = "https://openscad.org/downloads.html"
try:
    soup = BeautifulSoup(requests.get(url).content, "html.parser")
    print(soup.find(id="WASM_SNAPSHOT_URL")["href"])
except Exception as e:
    sys.stderr.write(f"WASM Snapshot URL not found on {url}: {e}.\n")
    exit(1)

I think it's time to setup some github workflow (will try and take a stab at it in a few days), which could ultimately auto deploy the playground to https://github.com/openscad/openscad.github.com

ochafik avatar May 31 '24 10:05 ochafik

I started creating some base images on https://ci.openscad.org/ but that's currently a bit stuck. So a github action would be also a nice option.

Hmm, good point, using always the latest version would work too. As that page is populated from https://files.openscad.org/snapshots/.snapshot_wasm.js it might be even easier to parse that :-).

But as the file is generated by a python script anyway, that could just symlink the latest version to a stable name.

t-paul avatar May 31 '24 11:05 t-paul

I started creating some base images on https://ci.openscad.org/ but that's currently a bit stuck. So a github action would be also a nice option.

@t-paul Pretty slick! What's running this?

Hmm, good point, using always the latest version would work too. As that page is populated from https://files.openscad.org/snapshots/.snapshot_wasm.js it might be even easier to parse that :-).

Yay, thanks!

And actually my code above wasn't working, since the link is populated dynamically it needs selenium as follows:

# pip install selenium
# brew install chromedriver
# # brew install --cask google-chrome
from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
try:
    driver.get("https://openscad.org/downloads.html")
    print(driver.find_element(By.ID, "WASM_SNAPSHOT_URL").get_attribute("href"))
finally:
    driver.quit()

ochafik avatar May 31 '24 11:05 ochafik

Wow, they really don't advertise the program name :grinning:. It's a https://concourse-ci.org/ instance running on our file server (pipelines in https://github.com/openscad/openscad-ci).

t-paul avatar May 31 '24 16:05 t-paul

Closing this as currently should be fine. Version pinned needs to be switched back to the latest CI build, once https://github.com/openscad/openscad/pull/5531 is merged and the ci wasm builds gets unstuck.

(also, it's now easy to build your own wasm w/ make wasm, see main readme)

ochafik avatar Dec 25 '24 12:12 ochafik