Skip to content

Commit

Permalink
Fetch live test262/Wasm results instead of relying on a triggered build
Browse files Browse the repository at this point in the history
The website currently only updates when the libjs-website repository is
updated. That is, it is not updated when new test results are published
to the libjs-data repository. Instead of setting up inter-repository GH
Actions hooks, just pull fresh data from libjs-data when loading the
website.
  • Loading branch information
trflynn89 committed Nov 3, 2023
1 parent a5adc03 commit d35e786
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 68 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/deploy.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
repl/libjs.js
repl/libjs.wasm
test262/data
wasm/data
17 changes: 0 additions & 17 deletions build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion repl/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h1>LibJS REPL<span id="header-description"></span></h1>
</div>
</template>
<script src="https://unpkg.com/unfetch/polyfill"></script>
<script src="libjs.js"></script>
<script src="https://serenityos.github.io/libjs-data/libjs.js"></script>
<script src="repl.js"></script>
<script src="main.js"></script>
</body>
Expand Down
12 changes: 6 additions & 6 deletions test262/fetch.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const fetchData = (url) => {
const headers = new Headers();
headers.append("pragma", "no-cache");
headers.append("cache-control", "no-cache");
return fetch(new Request(url), {
const LIBJS_DATA_URL =
"https://raw.githubusercontent.com/SerenityOS/libjs-data/master";

const fetchData = (path) => {
return fetch(`${LIBJS_DATA_URL}/${path}`, {
method: "GET",
headers,
cache: "no-cache",
});
};
2 changes: 1 addition & 1 deletion test262/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ test262@${test262Version}, test262-parser-tests@${test262ParserTestsVersion}`;
}

document.addEventListener("DOMContentLoaded", () => {
fetchData("data/results.json")
fetchData("test262/results.json")
.then((response) => response.json())
.then((data) => {
data.sort((a, b) =>
Expand Down
2 changes: 1 addition & 1 deletion test262/per-file/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h2>Per-file results</h2>
<script>
window.config = {
initialPathInTree: "test",
loadPathsAndModes: [["per-file-master.json", ""]],
loadPathsAndModes: [["test262/per-file-master.json", ""]],
generateGitHubURLFromTestPath(filepath) {
return `https://github.com/tc39/test262/tree/main/${filepath}`;
},
Expand Down
2 changes: 1 addition & 1 deletion test262/per-file/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ document.addEventListener("DOMContentLoaded", () => {
const promises = [];
for (const [path, mode] of window.config.loadPathsAndModes) {
promises.push(
fetchData(`../data/${path}`)
fetchData(path)
.then((response) => response.json())
.then((data) => initialize(data, mode))
);
Expand Down
2 changes: 1 addition & 1 deletion wasm/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ Versions: serenity@${serenityVersion}`;
}

document.addEventListener("DOMContentLoaded", () => {
fetchData("data/results.json")
fetchData("wasm/results.json")
.then((response) => response.json())
.then((data) => {
data.sort((a, b) =>
Expand Down
2 changes: 1 addition & 1 deletion wasm/per-file/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h2>Per-file results</h2>
<script>
window.config = {
initialPathInTree: "Spec",
loadPathsAndModes: [["per-file-master.json", "Default"]],
loadPathsAndModes: [["wasm/per-file-master.json", "Default"]],
generateGitHubURLFromTestPath(filepath) {
const result = /^Spec\/(.*)\.js\/[^:]*::(.*)*$/.exec(filepath);
if (!result) return "";
Expand Down

0 comments on commit d35e786

Please sign in to comment.