Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
fether
Commits
44d78b0b
Commit
44d78b0b
authored
Apr 09, 2019
by
Amaury Martiny
Committed by
Thibaut Sardan
Apr 09, 2019
Browse files
chore: Allow fetching cross-platform parity-ethereum (#501)
* Allow fetching cross-platform * Update ci * Fix script
parent
5fd81f1f
Pipeline
#35269
failed with stages
in 8 minutes and 19 seconds
Changes
3
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
44d78b0b
...
...
@@ -10,12 +10,11 @@ variables:
CARGOFLAGS
:
'
'
cache
:
key
:
"
${CI_JOB_NAME}
"
key
:
'
${CI_JOB_NAME}
'
paths
:
-
node_modules/
-
packages/*/node_modules/
.branches
:
&branches
only
:
-
beta
...
...
@@ -79,6 +78,9 @@ win-build:
script
:
-
yarn install
-
yarn build
# `win-build` is a linux machine, so it downloaded a linux parity-ethereum.
# We download a windows one to make it cross-compile for windows.
-
rm packages/fether-electron/static/parity* && yarn fetch-parity --win
-
yarn release --win
tags
:
-
linux-docker
...
...
package.json
View file @
44d78b0b
...
...
@@ -42,10 +42,11 @@
"yarn"
:
"^1.4.2"
},
"scripts"
:
{
"postinstall"
:
"
cd scripts && node ./fetch-latest
-parity
.js
"
,
"postinstall"
:
"
yarn fetch
-parity"
,
"build"
:
"lerna run build"
,
"preelectron"
:
"yarn build"
,
"electron"
:
"cd packages/fether-electron && yarn electron"
,
"fetch-parity"
:
"cd scripts && node ./fetch-latest-parity.js"
,
"lint-files"
:
"./scripts/lint-files.sh '**/*.js'"
,
"lint"
:
"yarn lint-files"
,
"prepackage"
:
"yarn build"
,
...
...
scripts/fetch-latest-parity.js
View file @
44d78b0b
...
...
@@ -18,19 +18,28 @@ const exec = promisify(require('child_process').exec);
const
fsChmod
=
promisify
(
chmod
);
const
fsWriteFile
=
promisify
(
writeFile
);
let
os
;
switch
(
process
.
platform
)
{
case
'
win32
'
:
os
=
'
windows
'
;
break
;
case
'
darwin
'
:
os
=
'
darwin
'
;
break
;
default
:
os
=
'
linux
'
;
function
getOs
()
{
if
(
process
.
argv
.
includes
(
'
--win
'
))
{
return
'
windows
'
;
}
if
(
process
.
argv
.
includes
(
'
--mac
'
))
{
return
'
darwin
'
;
}
if
(
process
.
argv
.
includes
(
'
--linux
'
))
{
return
'
linux
'
;
}
switch
(
process
.
platform
)
{
case
'
win32
'
:
return
'
windows
'
;
case
'
darwin
'
:
return
'
darwin
'
;
default
:
return
'
linux
'
;
}
}
const
ENDPOINT
=
`https://vanity-service.parity.io/parity-binaries?os=
${
os
}
&architecture=x86_64`
;
const
ENDPOINT
=
`https://vanity-service.parity.io/parity-binaries?os=
${
getOs
()
}
&architecture=x86_64`
;
const
STATIC_DIRECTORY
=
path
.
join
(
'
..
'
,
...
...
@@ -48,6 +57,11 @@ if (foundPath) {
// Bundled Parity was found, we check if the version matches the minimum requirements
getBinaryVersion
(
foundPath
)
.
then
(
version
=>
{
if
(
!
version
)
{
console
.
log
(
"
Couldn't get bundled Parity Ethereum version.
"
);
return
downloadParity
();
}
if
(
!
semver
.
satisfies
(
version
,
versionRequirement
))
{
console
.
log
(
'
Bundled Parity Ethereum %s is older than required version %s
'
,
...
...
@@ -137,14 +151,19 @@ function downloadParity () {
})
.
then
(
getBinaryVersion
)
.
then
(
bundledVersion
=>
console
.
log
(
`Success: bundled Parity Ethereum
${
bundledVersion
}
`
)
console
.
log
(
`Success: bundled Parity Ethereum
${
bundledVersion
||
"
(couldn't get version)
"
}
`
)
)
);
}
function
getBinaryVersion
(
binaryPath
)
{
return
exec
(
`
${
binaryPath
}
--version`
).
then
(({
stdout
,
stderr
})
=>
{
if
(
stderr
)
throw
new
Error
(
stderr
);
return
stdout
.
match
(
/v
\d
+
\.\d
+
\.\d
+/
)[
0
];
});
return
exec
(
`
${
binaryPath
}
--version`
)
.
then
(({
stdout
,
stderr
})
=>
{
if
(
stderr
)
throw
new
Error
(
stderr
);
return
stdout
.
match
(
/v
\d
+
\.\d
+
\.\d
+/
)[
0
];
})
.
catch
(
error
=>
console
.
warn
(
error
.
message
));
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment