Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 35 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ jobs:
run: |
SM_TAG="libspidermonkey_$(awk '/^set\(SM_TAG/ {gsub(/set\(SM_TAG |\)/, ""); print}' cmake/spidermonkey.cmake)"
echo "SM_TAG=${SM_TAG}" >> "$GITHUB_OUTPUT"
if git rev-parse --verify "refs/tags/${SM_TAG}" >/dev/null 2>&1; then
gh release view "${SM_TAG}"
if gh release view "${SM_TAG}" >/dev/null 2>&1; then
echo "Found existing SpiderMonkey release tag: ${SM_TAG}"
echo "SM_TAG_EXISTS=true" >> "$GITHUB_OUTPUT"
else
echo "SM_TAG_EXISTS=false" >> "$GITHUB_OUTPUT"
echo "SM_CACHE_KEY_${{ matrix.build }}=spidermonkey-cache-${{ matrix.build }}-${{ hashFiles('cmake/spidermonkey.cmake') }}" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ github.token }}

- name: Cache SpiderMonkey tarball
if: steps.check-sm-release.outputs.SM_TAG_EXISTS == 'false'
Expand All @@ -56,44 +60,44 @@ jobs:
spidermonkey-dist-${{ matrix.build }}
key: spidermonkey-cache-${{ matrix.build }}-${{ hashFiles('cmake/spidermonkey.cmake') }}

#- name: Set env var to use cached SpiderMonkey tarball
# if: steps.check-sm-release.outputs.SM_TAG_EXISTS == 'false' && steps.sm-cache.outputs.cache-hit == 'true'
# run: |
# tree spidermonkey-dist-${{ matrix.build }}
# echo "SPIDERMONKEY_BINARIES=$(pwd)/spidermonkey-dist-${{ matrix.build }}" >> $GITHUB_ENV
- name: Set env var to use cached SpiderMonkey tarball
if: steps.check-sm-release.outputs.SM_TAG_EXISTS == 'false' && steps.sm-cache.outputs.cache-hit == 'true'
run: |
tree spidermonkey-dist-${{ matrix.build }}
echo "SPIDERMONKEY_BINARIES=$(pwd)/spidermonkey-dist-${{ matrix.build }}" >> $GITHUB_ENV

#- uses: actions/setup-node@v2
# with:
# node-version: 'lts/*'
- uses: actions/setup-node@v2
with:
node-version: 'lts/*'

#- name: Configure StarlingMonkey
# run: |
# cmake -S . -B cmake-build-${{ matrix.build }}\
# -DCMAKE_BUILD_TYPE=${{ (matrix.build == 'release' || matrix.build == 'weval') && 'Release' || 'Debug' }}\
# ${{matrix.build == 'weval' && '-DUSE_WASM_OPT=OFF -DWEVAL=ON' || ''}}
- name: Configure StarlingMonkey
run: |
cmake -S . -B cmake-build-${{ matrix.build }}\
-DCMAKE_BUILD_TYPE=${{ (matrix.build == 'release' || matrix.build == 'weval') && 'Release' || 'Debug' }}\
${{matrix.build == 'weval' && '-DUSE_WASM_OPT=OFF -DWEVAL=ON' || ''}}

#- name: Build StarlingMonkey
# run: |
# cmake --build cmake-build-${{ matrix.build }} --parallel $(nproc) --target all
- name: Build StarlingMonkey
run: |
cmake --build cmake-build-${{ matrix.build }} --parallel $(nproc) --target all

#- name: Build Integration Test Server
# run: |
# cmake --build cmake-build-${{ matrix.build }} --parallel $(nproc) --target integration-test-server
- name: Build Integration Test Server
run: |
cmake --build cmake-build-${{ matrix.build }} --parallel $(nproc) --target integration-test-server

#- name: Build WPT Runtime
# run: |
# cmake --build cmake-build-${{ matrix.build }} --parallel $(nproc) --target wpt-runtime
- name: Build WPT Runtime
run: |
cmake --build cmake-build-${{ matrix.build }} --parallel $(nproc) --target wpt-runtime

#- name: Prepare WPT hosts
# run: |
# cat deps/wpt-hosts | sudo tee -a /etc/hosts
- name: Prepare WPT hosts
run: |
cat deps/wpt-hosts | sudo tee -a /etc/hosts

#- name: StarlingMonkey E2E, Integration, and WPT Tests
# run: |
# CTEST_OUTPUT_ON_FAILURE=1 ctest --test-dir cmake-build-${{ matrix.build }} -j$(nproc) --verbose
- name: StarlingMonkey E2E, Integration, and WPT Tests
run: |
CTEST_OUTPUT_ON_FAILURE=1 ctest --test-dir cmake-build-${{ matrix.build }} -j$(nproc) --verbose

- name: Set up cacheable SpiderMonkey artifacts
if: steps.sm-cache.outputs.cache-hit != 'true'
if: steps.check-sm-release.outputs.SM_TAG_EXISTS == 'false' && steps.sm-cache.outputs.cache-hit != 'true'
run: |
mkdir -p spidermonkey-dist-${{ matrix.build }}
cp -a cmake-build-${{ matrix.build }}/spidermonkey-obj/dist/libspidermonkey.a spidermonkey-dist-${{ matrix.build }}/
Expand All @@ -105,7 +109,7 @@ jobs:
- name: Upload SpiderMonkey tarball
uses: actions/upload-artifact@v4
if: (github.event_name != 'push' || (github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v')))
&& steps.sm-cache.outputs.cache-hit != 'true'
&& steps.check-sm-release.outputs.SM_TAG_EXISTS == 'false' && steps.sm-cache.outputs.cache-hit != 'true'
with:
name: spidermonkey-${{ matrix.build }}
path: spidermonkey-dist-${{ matrix.build }}/*
Expand Down
5 changes: 3 additions & 2 deletions cmake/spidermonkey.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ if (DEFINED ENV{SPIDERMONKEY_BINARIES})
set(SM_LIB_DIR $ENV{SPIDERMONKEY_BINARIES})
message(STATUS "Using pre-built SpiderMonkey artifacts from local directory ${SM_LIB_DIR}")
else()
set(SM_URL https://github.com/bytecodealliance/starlingmonkey/releases/download/libspidermonkey_${SM_TAG}/spidermonkey-static-${SM_BUILD_TYPE}.tar.gz)
set(SM_URL https://github.com/tschneidereit/starlingmonkey/releases/download/libspidermonkey_${SM_TAG}/spidermonkey-static-${SM_BUILD_TYPE}.tar.gz)
message(STATUS "Checking for pre-built SpiderMonkey artifacts at ${SM_URL}")
execute_process(
COMMAND curl -s -o /dev/null -w "%{http_code}" ${SM_URL}
COMMAND curl -sIL -o /dev/null -w "%{http_code}" ${SM_URL}
RESULT_VARIABLE CURL_RESULT
OUTPUT_VARIABLE HTTP_STATUS
)
Expand Down