Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit f52bf55

Browse files
authored
Publish the test site to Netlify (#3575)
* change from surge to netlify * use env variables available from netlify * add bundle size to page * fix size cmd
1 parent 076fd46 commit f52bf55

File tree

7 files changed

+18
-27
lines changed

7 files changed

+18
-27
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,4 @@ Fixes #(issue)
2929
- [ ] I ran `npm run build-all` and tested the resulting files from `dist` folder in a browser.
3030
- [ ] I have updated the `CHANGELOG.md` file in the root folder.
3131
- [ ] I have tested my code on the live network.
32-
- [ ] The browser visual inspection check looks ok: [sudden-playground.surge.sh][1]
33-
34-
[1]: http://sudden-playground.surge.sh/
32+
- [ ] I have checked the Deploy Preview and it looks correct.

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ jobs:
5151
CI: true
5252
DISPLAY: :99.0
5353
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
54-
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
55-
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
5654
BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE_GITHUB_TOKEN }}
5755
steps:
5856
- uses: actions/setup-node@v1

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# web3.js - Ethereum JavaScript API
66

7-
[![Gitter][gitter-image]][gitter-url] [![StackExchange][stackexchange-image]][stackexchange-url] [![NPM Package Version][npm-image-version]][npm-url] [![NPM Package Downloads][npm-image-downloads]][npm-url] [![Build Status][actions-image]][actions-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Lerna][lerna-image]][lerna-url]
7+
[![Gitter][gitter-image]][gitter-url] [![StackExchange][stackexchange-image]][stackexchange-url] [![NPM Package Version][npm-image-version]][npm-url] [![NPM Package Downloads][npm-image-downloads]][npm-url] [![Build Status][actions-image]][actions-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Lerna][lerna-image]][lerna-url] [![Netlify Status][netlify-image]][netlify-url]
88

99
This is the Ethereum [JavaScript API][docs]
1010
which connects to the [Generic JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) spec.
@@ -181,5 +181,7 @@ This project adheres to the [Release Guidelines](./REVIEW.md).
181181
[gitter-url]: https://gitter.im/ethereum/web3.js
182182
[lerna-image]: https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg
183183
[lerna-url]: https://lerna.js.org/
184+
[netlify-image]: https://api.netlify.com/api/v1/badges/1fc64933-d170-4939-8bdb-508ecd205519/deploy-status
185+
[netlify-url]: https://app.netlify.com/sites/web3-staging/deploys
184186
[stackexchange-image]: https://img.shields.io/badge/web3js-stackexchange-brightgreen
185187
[stackexchange-url]: https://ethereum.stackexchange.com/questions/tagged/web3js

TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ These should pass for PRs to merge:
1717
| typescript | dtslint | -- | TS type definitions tests |
1818
| dependencies | depcheck | -- | Verifies every dependency is listed correctly in the module package |
1919
| bundle | test:e2e:min | [e2e.minified.js][3] | Verifies minified bundle loads in a headless browser *without* being webpacked / browserified | :white_check_mark: |
20-
| cdn | test:e2e:cdn | [e2e.cdn.sh][4]| Visual inspection check: publishes an (un-webpacked) site that uses web3.min.js at http://sudden-playground.surge.sh/ | :white_check_mark: |
20+
| cdn | test:e2e:cdn | [e2e.cdn.sh][4]| Visual inspection check: publishes an (un-webpacked) site that uses web3.min.js at https://web3-staging.netlify.app/ | :white_check_mark: |
2121
| windows | -- | [e2e.windows.sh][5] | Verifies Web3 installs on Windows OS / Node 12 and can connect to Infura over wss and https | :white_check_mark: |
2222

2323

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@
142142
"puppeteer": "^1.20.0",
143143
"regenerator-runtime": "^0.13.3",
144144
"sandboxed-module": "^2.0.3",
145-
"surge": "^0.21.3",
146145
"typescript": "^3.8.3",
147146
"underscore": "^1.9.1",
148147
"vinyl-source-stream": "^2.0.0",

scripts/e2e.cdn.sh

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
11
#!/usr/bin/env bash
22

33
# --------------------------------------------------------------------
4-
# Publishes a small test site that uses the packages/web3/dist/min
4+
# Prepares a small test site that uses the packages/web3/dist/min
55
# --------------------------------------------------------------------
66

77
if [ -z "$CI" ]; then
88

99
echo "======================================================================"
10-
echo "This script publishes a test site with surge.sh. Only run in CI."
10+
echo "This script prepares a test site for Netlify. Only run in CI. "
1111
echo "======================================================================"
1212

1313
exit 1
1414

1515
fi
1616

1717
echo "======================================================================"
18-
echo "Publishing test site with surge.sh. See link below. "
18+
echo "Preparing test site for web3-staging.netlify.app "
1919
echo "======================================================================"
2020

21-
# Mark file with current commit and branch
22-
sed -i "s|__COMMIT_HASH__|$GITHUB_SHA|g" scripts/html/index.html
23-
sed -i "s|__BRANCH__|$GITHUB_REF|g" scripts/html/index.html
24-
2521
cp packages/web3/dist/web3.min.js scripts/html
26-
cd scripts
27-
(echo "" && exit && cat ) | npx surge --domain sudden-playground.surge.sh html
2822

29-
# Might be running locally in development
30-
rm html/web3.min.js
23+
cd scripts/html
24+
25+
BUNDLE_SIZE=$(wc -c web3.min.js | awk '{print $1}')
26+
27+
# Mark file with current commit, branch, and bundle size.
28+
sed -i "s|__COMMIT_HASH__|$COMMIT_REF|g" index.html
29+
sed -i "s|__BRANCH__|$BRANCH|g" index.html
30+
sed -i "s|__BUNDLE_SIZE__|$BUNDLE_SIZE|g" index.html
3131

32-
# Sometimes surge.sh fails with an auth error because it's generated a name which
33-
# is already taken (or something?) This test is just meant to be a visual
34-
# inspection check if/when there are doubts - we don't want it crash CI alot.
35-
exit 0

scripts/html/index.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ <h2> Latest Block </h2>
1111
<p id="blockNumber"></p>
1212
<p id="timestamp"></p>
1313
<p id="gasLimit"></p>
14-
15-
<h4> Important: this test site is shared by all pull requests & is overwritten by the most recent run. </h4>
16-
<h4> It's only informative when the PR ref number listed below matches your PR. </h4>
17-
1814
<p id="commitHash"></p>
1915
<p id="branch"></p>
16+
<p id="bundleSize"></p>
2017

2118
<script>
2219
var web3 = new Web3('https://mainnet.infura.io/v3/1d13168ffb894ad2827f2152620bd27c');
@@ -28,6 +25,7 @@ <h4> It's only informative when the PR ref number listed below matches your PR.
2825
document.getElementById("today").innerHTML = "Today is " + Date(block.timestamp);
2926
document.getElementById("commitHash").innerHTML = "Merge commit hash: " + "__COMMIT_HASH__";
3027
document.getElementById("branch").innerHTML = "Branch: " + "__BRANCH__";
28+
document.getElementById("bundleSize").innerHTML = "Bundle size: " + "__BUNDLE_SIZE__" + " bytes";
3129
}
3230
writeBlock();
3331
</script>

0 commit comments

Comments
 (0)