grep script

md5sum

fix lint

restore cache

use file

use caching

fix config

config

fix grep

fix lint

nightly

catch webpack

url curl

check curl

use plus

install jq

use npx

do not use jq

rename cache

filter duplicates

manual versions

fix manual

v3

8.18

fix urls

7.6

fix regex

fix latest

remixd

rename
pull/5370/head
filip mertens 2 years ago
parent ad66759ba5
commit defc2ce0a3
  1. 15
      .circleci/config.yml
  2. 2
      apps/remix-ide/.gitignore
  3. 111
      apps/remix-ide/ci/download_e2e_assets.js
  4. 32
      apps/remix-ide/ci/downloadsoljson.sh
  5. 22
      apps/remix-ide/webpack.config.js

@ -24,17 +24,26 @@ jobs:
key: v1-deps-{{ checksum "yarn.lock" }} key: v1-deps-{{ checksum "yarn.lock" }}
paths: paths:
- node_modules - node_modules
- run: - run:
name: Build name: Build
command: | command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then if [ "${CIRCLE_BRANCH}" == "master" ]; then
NX_BIN_URL=http://127.0.0.1:8080/assets/js NX_WASM_URL=http://127.0.0.1:8080/assets/js NPM_URL=http://localhost:9090/ yarn build:production NX_BIN_URL=http://127.0.0.1:8080/assets/js/soljson NX_WASM_URL=http://127.0.0.1:8080/assets/js/soljson NPM_URL=http://localhost:9090/ yarn build:production
else else
NX_BIN_URL=http://127.0.0.1:8080/assets/js NX_WASM_URL=http://127.0.0.1:8080/assets/js NPM_URL=http://localhost:9090/ yarn build NX_BIN_URL=http://127.0.0.1:8080/assets/js/soljson NX_WASM_URL=http://127.0.0.1:8080/assets/js/soljson NPM_URL=http://localhost:9090/ yarn build
fi fi
- run: yarn run build:e2e - run: yarn run build:e2e
- run: grep -ir "[0-9]+commit" apps/* libs/* --include \*.ts > soljson-versions.txt
- restore_cache:
keys:
- soljson-v5-{{ checksum "soljson-versions.txt" }}
- run: yarn run downloadsolc_assets_e2e - run: yarn run downloadsolc_assets_e2e
- save_cache:
key: soljson-v5-{{ checksum "soljson-versions.txt" }}
paths:
- dist/apps/remix-ide/assets/js/soljson
- run: mkdir persist && zip -0 -r persist/dist.zip dist - run: mkdir persist && zip -0 -r persist/dist.zip dist
- persist_to_workspace: - persist_to_workspace:
root: . root: .

@ -13,4 +13,4 @@ TODO
.tern-port .tern-port
temp_publish_docker temp_publish_docker
src/assets/version.json src/assets/version.json
src/assets/js/soljson-v* src/assets/js/soljson/soljson-v*

@ -1,80 +1,81 @@
const testFolder = './apps/remix-ide-e2e/src/tests/';
const fs = require('fs'); const fs = require('fs');
var child_process = require('child_process');
const { exit } = require('process');
let url = 'https://binaries.soliditylang.org/wasm/list.json' var child = child_process.spawnSync('grep', ['-ir', '[0-9]+commit', 'libs/**/*', 'apps/**/*', '--include', '*.ts'], { encoding: 'utf8', cwd: process.cwd(), shell: true });
const axios = require('axios') if (child.error) {
console.log("ERROR: ", child);
exit(1);
}
// use axios to download the file const nonNightlyRegex = /v\d*\.\d*\.\d*\+commit\.[\d\w]*/g;
/*
axios({
url: url,
method: 'GET',
}).then((response) => {
let info = response.data; let soljson = child.stdout.match(nonNightlyRegex);
info.builds = info.builds.filter(build => build.path.indexOf('nightly') === -1) console.log('non nightly soljson versions found: ', soljson);
for (let build of info.builds) {
const buildurl = `https://solc-bin.ethereum.org/wasm/${build.path}`; const quotedVersionsRegex = /'\d*\.\d*\.\d*\+commit\.[\d\w]*/g;
console.log(buildurl) let soljson2 = child.stdout.match(quotedVersionsRegex).map((item) => item.replace('\'', 'v'));
console.log('quoted soljson versions found: ', soljson2);
const nightlyVersionsRegex = /\d*\.\d*\.\d-nightly.*\+commit\.[\d\w]*/g
let soljson3 = child.stdout.match(nightlyVersionsRegex).map((item) => 'v' + item);
console.log('nightly soljson versions found: ', soljson3);
// merge the three arrays
soljson = soljson.concat(soljson2);
soljson = soljson.concat(soljson3);
console.log('soljson versions found: ', soljson);
const path = `./dist/apps/remix-ide/assets/js/${build.path}`;
// use axios to get the file
try {
axios({
method: 'get',
url: buildurl,
}).then(function (response) {
fs.writeFile(path, response.data, function (err) {
if (err) {
console.log(err);
}
})
})
} catch (e) {
console.log('Failed to download ' + build.path + ' from ' + buildurl)
}
}
}
)
*/
fs.readdirSync(testFolder).forEach(file => {
let c = fs.readFileSync(testFolder + file, 'utf8');
const re = /(?<=soljson).*(?=(.js))/g;
const soljson = c.match(re);
if (soljson) { if (soljson) {
console.log(soljson) // filter out duplicates
for (let i = 0; i < soljson.length; i++) { soljson = soljson.filter((item, index) => soljson.indexOf(item) === index);
// manually add some versions
soljson.push('v0.7.6+commit.7338295f');
soljson.push('v0.5.17+commit.d19bba13');
console.log('soljson versions found: ', soljson);
for (let i = 0; i < soljson.length; i++) {
const version = soljson[i]; const version = soljson[i];
if (version) { if (version) {
const url = `https://solc-bin.ethereum.org/bin/soljson${version}.js`; let url = ''
console.log(url)
const path = `./dist/apps/remix-ide/assets/js/soljson${version}.js`; // if nightly
// use axios to get the file if (version.includes('nightly')) {
try { url = `https://binaries.soliditylang.org/bin/soljson-${version}.js`;
axios({ }else{
method: 'get', url = `https://binaries.soliditylang.org/wasm/soljson-${version}.js`;
url: url,
}).then(function (response) {
fs.writeFile(path, response.data, function (err) {
if (err) {
console.log(err);
} }
})
}) const dir = './dist/apps/remix-ide/assets/js/soljson';
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
const path = `./dist/apps/remix-ide/assets/js/soljson/soljson-${version}.js`;
// check if the file exists
const exists = fs.existsSync(path);
if (!exists) {
console.log('URL:', url)
try {
// use curl to download the file
child_process.exec(`curl -o ${path} ${url}`, { encoding: 'utf8', cwd: process.cwd(), shell: true })
} catch (e) { } catch (e) {
console.log('Failed to download soljson' + version + ' from ' + url) console.log('Failed to download soljson' + version + ' from ' + url)
} }
}
} }
} }
} }
});

@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e
# check if curl is installed
if ! command -v curl &> /dev/null
then
echo "curl could not be found"
exit
fi
# download https://binaries.soliditylang.org/wasm/list.json as json
curl https://binaries.soliditylang.org/wasm/list.json > list.json
# get the latest version without jq
latest=$(grep 'latestRelease' list.json | cut -d '"' -f 4)
echo "latest version: $latest"
# get url
url=$(grep "\"$latest\":" list.json | cut -d '"' -f 4)
echo "url: $url"
path="https://binaries.soliditylang.org/bin/$url"
echo "path: $path"
# download the file to ./apps/remix-ide/src/assets/js/soljson.js
curl $path > ./apps/remix-ide/src/assets/js/soljson.js
# if directory ./apps/remix-ide/src/assets/js/soljson does not exist, create it
if [ ! -d "./apps/remix-ide/src/assets/js/soljson" ]; then
mkdir ./apps/remix-ide/src/assets/js/soljson
fi
cp ./apps/remix-ide/src/assets/js/soljson.js ./apps/remix-ide/src/assets/js/soljson/$url
# remove list.json
rm list.json

@ -15,26 +15,8 @@ const versionData = {
} }
const loadLocalSolJson = async () => { const loadLocalSolJson = async () => {
let url = 'https://binaries.soliditylang.org/wasm/list.json' // execute apps/remix-ide/ci/downloadsoljson.sh
axios({ const child = require('child_process').execSync('bash ./apps/remix-ide/ci/downloadsoljson.sh', { encoding: 'utf8', cwd: process.cwd(), shell: true })
url: url,
method: 'GET',
}).then((response) => {
let info = response.data;
info.builds = info.builds.filter(build => build.path.indexOf('nightly') === -1)
info.builds = info.builds.slice(-1)
const buildurl = `https://solc-bin.ethereum.org/wasm/${info.builds[0].path}`;
console.log(`Copying... ${buildurl} to assets`)
const path = `./apps/remix-ide/src/assets/js/soljson.js`;
axios({
method: 'get',
url: buildurl,
responseType: 'stream'
}).then(function (response) {
response.data.pipe(fs.createWriteStream(path));
})
}
)
} }
fs.writeFileSync('./apps/remix-ide/src/assets/version.json', JSON.stringify(versionData)) fs.writeFileSync('./apps/remix-ide/src/assets/version.json', JSON.stringify(versionData))

Loading…
Cancel
Save