-
Notifications
You must be signed in to change notification settings - Fork 50
156 lines (138 loc) · 5.89 KB
/
main.yml
File metadata and controls
156 lines (138 loc) · 5.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
paths-ignore:
- '*.md'
- 'docs/**'
defaults:
run:
shell: bash
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
build: [release, debug]
os: [ubuntu-latest]
outputs:
SM_TAG_EXISTS: ${{ steps.check-sm-release.outputs.SM_TAG_EXISTS }}
SM_TAG: ${{ steps.check-sm-release.outputs.SM_TAG }}
SM_CACHE_KEY_debug: ${{ steps.check-sm-release.outputs.SM_CACHE_KEY_debug }}
SM_CACHE_KEY_release: ${{ steps.check-sm-release.outputs.SM_CACHE_KEY_release }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Check if SpiderMonkey Release Exists
id: check-sm-release
run: |
SM_TAG="libspidermonkey_$(awk '/^set\(SM_TAG/ {gsub(/set\(SM_TAG |\)/, ""); print}' cmake/spidermonkey.cmake)"
echo "SM_TAG=${SM_TAG}" >> "$GITHUB_OUTPUT"
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'
uses: actions/cache@v4
id: sm-cache
with:
path: |
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
- 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: 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 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: 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.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 }}/
cp -aL cmake-build-${{ matrix.build }}/spidermonkey-obj/dist/include spidermonkey-dist-${{ matrix.build }}/
tree spidermonkey-dist-${{ matrix.build }}
# Upload tarball as an artifact of the github action run, so the output
# can be inspected for pull requests.
- 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.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 }}/*
release-spidermonkey:
needs: test
if: needs.test.outputs.SM_TAG_EXISTS == 'false' && (github.event_name == 'push' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Restore SpiderMonkey Debug Cache
uses: actions/cache/restore@v4
id: sm-cache-debug
with:
path: |
spidermonkey-dist-debug
key: ${{ needs.test.outputs.SM_CACHE_KEY_debug }}
fail-on-cache-miss: true
- name: Restore SpiderMonkey Release Cache
uses: actions/cache/restore@v4
id: sm-cache-release
with:
path: |
spidermonkey-dist-release
key: ${{ needs.test.outputs.SM_CACHE_KEY_release }}
fail-on-cache-miss: true
- name: Create SpiderMonkey Tar Balls
run: |
mkdir -p release-artifacts
tar -a -cf release-artifacts/spidermonkey-static-debug.tar.gz spidermonkey-dist-debug/*
tar -a -cf release-artifacts/spidermonkey-static-release.tar.gz spidermonkey-dist-release/*
tree release-artifacts
- name: Do the Release
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 #2.3.2
with:
body: |
This release contains pre-built SpiderMonkey artifacts to be used by the StarlingMonkey
build system. It's not meant for general public consumption and doesn't come with any
stability or availability guarantees.
tag_name: ${{ needs.test.outputs.SM_TAG }}
files: release-artifacts/*