diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ccac4ad2..71191983 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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' @@ -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 }}/ @@ -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 }}/* diff --git a/cmake/spidermonkey.cmake b/cmake/spidermonkey.cmake index 6ee28d68..c25c9ba3 100644 --- a/cmake/spidermonkey.cmake +++ b/cmake/spidermonkey.cmake @@ -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 )