Add github actions
This commit is contained in:
22
scripts/actions/build-linux.sh
Executable file
22
scripts/actions/build-linux.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
#strip ON
|
||||
export RUSTFLAGS=" -Clink-arg=-s -Ctarget-feature=+aes,+sse2,+ssse3"
|
||||
|
||||
echo "_____ Build OpenEthereum and tools _____"
|
||||
|
||||
time cargo build --verbose --color=always --release --features final
|
||||
time cargo build --verbose --color=always --release -p evmbin
|
||||
time cargo build --verbose --color=always --release -p ethstore-cli
|
||||
time cargo build --verbose --color=always --release -p ethkey-cli
|
||||
|
||||
echo "_____ Post-processing binaries _____"
|
||||
rm -rf artifacts/*
|
||||
mkdir -p artifacts/
|
||||
|
||||
cp -v target/release/parity artifacts/parity
|
||||
cp -v target/release/parity-evm artifacts/parity-evm
|
||||
cp -v target/release/ethstore artifacts/ethstore
|
||||
cp -v target/release/ethkey artifacts/ethkey
|
||||
21
scripts/actions/build-windows.sh
Executable file
21
scripts/actions/build-windows.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
# NOTE: Enables the aes-ni instructions for RustCrypto dependency.
|
||||
# If you change this please remember to also update .cargo/config
|
||||
export RUSTFLAGS=" -Ctarget-feature=+aes,+sse2,+ssse3 -Ctarget-feature=+crt-static -Clink-arg=-s"
|
||||
|
||||
echo "_____ Build Parity and tools _____"
|
||||
time cargo build --verbose --release --features final
|
||||
time cargo build --verbose --release -p evmbin
|
||||
time cargo build --verbose --release -p ethstore-cli
|
||||
time cargo build --verbose --release -p ethkey-cli
|
||||
|
||||
echo "_____ Post-processing binaries _____"
|
||||
rm -rf artifacts
|
||||
mkdir -p artifacts
|
||||
|
||||
cp --verbose target/release/parity.exe artifacts/parity.exe
|
||||
cp --verbose target/release/parity-evm.exe artifacts/parity-evm.exe
|
||||
cp --verbose target/release/ethstore.exe artifacts/ethstore.exe
|
||||
cp --verbose target/release/ethkey.exe artifacts/ethkey.exe
|
||||
8
scripts/actions/clean-target.sh
Executable file
8
scripts/actions/clean-target.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
find ./target/release -maxdepth 1 -type f -delete;
|
||||
rm -fr ./target/release/{deps,.fingerprint}/*{parity,ethcore,ethkey,ethstore,parity-evm}*;
|
||||
rm -f ./target/.rustc_info.json;
|
||||
19
scripts/actions/install-sccache.ps1
Executable file
19
scripts/actions/install-sccache.ps1
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$os=$args[0]
|
||||
$version="0.2.12"
|
||||
echo "Current OS:" $os
|
||||
switch ($os){
|
||||
"macOS" {$platform = "x86_64-apple-darwin"}
|
||||
"Linux" {$platform = "x86_64-unknown-linux-musl"}
|
||||
"Windows" {$platform ="x86_64-pc-windows-msvc"}
|
||||
}
|
||||
echo "Target arch: " $platform
|
||||
$basename = "sccache-$version-$platform"
|
||||
$url = "https://github.com/mozilla/sccache/releases/download/"+"$version/$basename.tar.gz"
|
||||
echo "Download sccache from "+$url
|
||||
curl -LO $url
|
||||
tar -xzvf "$basename.tar.gz"
|
||||
ls $basename/
|
||||
. $basename/sccache --start-server
|
||||
echo "::add-path::$(pwd)/$basename"
|
||||
echo "::set-env name=RUSTC_WRAPPER::sccache"
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
export CC="sccache "$CC
|
||||
export CXX="sccache "$CXX
|
||||
echo "__________Show ENVIROMENT__________"
|
||||
echo "CI_SERVER_NAME: " $CI_SERVER_NAME
|
||||
echo "CARGO_HOME: " $CARGO_HOME
|
||||
echo "CARGO_TARGET: " $CARGO_TARGET
|
||||
echo "CC: " $CC
|
||||
echo "CXX: " $CXX
|
||||
#strip ON
|
||||
export RUSTFLAGS=" -C link-arg=-s"
|
||||
|
||||
echo "_____ Building target: "$CARGO_TARGET" _____"
|
||||
if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ]
|
||||
then
|
||||
time cargo build --target $CARGO_TARGET --verbose --color=always --release -p parity-clib --features final
|
||||
else
|
||||
if [ "${CARGO_TARGET}" = "x86_64-unknown-linux-gnu" ] || [ "${CARGO_TARGET}" = "x86_64-apple-darwin" ]
|
||||
then
|
||||
# NOTE: Enables the aes-ni instructions for RustCrypto dependency.
|
||||
# If you change this please remember to also update .cargo/config
|
||||
export RUSTFLAGS="$RUSTFLAGS -Ctarget-feature=+aes,+sse2,+ssse3"
|
||||
fi
|
||||
time cargo build --target $CARGO_TARGET --verbose --color=always --release --features final
|
||||
time cargo build --target $CARGO_TARGET --verbose --color=always --release -p evmbin
|
||||
time cargo build --target $CARGO_TARGET --verbose --color=always --release -p ethstore-cli
|
||||
time cargo build --target $CARGO_TARGET --verbose --color=always --release -p ethkey-cli
|
||||
time cargo build --target $CARGO_TARGET --verbose --color=always --release -p whisper-cli
|
||||
fi
|
||||
|
||||
echo "_____ Post-processing binaries _____"
|
||||
rm -rf artifacts/*
|
||||
mkdir -p artifacts/$CARGO_TARGET
|
||||
cd artifacts/$CARGO_TARGET
|
||||
|
||||
if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ]
|
||||
then
|
||||
cp -v ../../target/$CARGO_TARGET/release/libparity.so ./libparity.so
|
||||
else
|
||||
cp -v ../../target/$CARGO_TARGET/release/parity ./parity
|
||||
cp -v ../../target/$CARGO_TARGET/release/parity-evm ./parity-evm
|
||||
cp -v ../../target/$CARGO_TARGET/release/ethstore ./ethstore
|
||||
cp -v ../../target/$CARGO_TARGET/release/ethkey ./ethkey
|
||||
cp -v ../../target/$CARGO_TARGET/release/whisper ./whisper
|
||||
fi
|
||||
|
||||
echo "_____ Calculating checksums _____"
|
||||
for binary in $(ls)
|
||||
do
|
||||
rhash --sha256 $binary -o $binary.sha256 #do we still need this hash (SHA2)?
|
||||
if [[ $CARGO_TARGET == *"x86_64"* ]];
|
||||
then
|
||||
./parity tools hash $binary > $binary.sha3
|
||||
else
|
||||
echo ">[WARN] ${binary} cannot be hashed with cross-compiled binary (keccak256)"
|
||||
fi
|
||||
done
|
||||
#show sccache statistics
|
||||
sccache --show-stats
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
set INCLUDE="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;C:\vs2015\VC\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt"
|
||||
set LIB="C:\vs2015\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64"
|
||||
sccache -s
|
||||
|
||||
echo "__________Show ENVIROMENT__________"
|
||||
echo "CI_SERVER_NAME: " $CI_SERVER_NAME
|
||||
echo "CARGO_HOME: " $CARGO_HOME
|
||||
echo "CARGO_TARGET: " $CARGO_TARGET
|
||||
echo "RUSTC_WRAPPER: " $RUSTC_WRAPPER
|
||||
echo "SCCACHE_DIR: " $SCCACHE_DIR
|
||||
|
||||
echo "_____ Building target: "$CARGO_TARGET" _____"
|
||||
time cargo build --target $CARGO_TARGET --verbose --release --features final
|
||||
time cargo build --target $CARGO_TARGET --verbose --release -p evmbin
|
||||
time cargo build --target $CARGO_TARGET --verbose --release -p ethstore-cli
|
||||
time cargo build --target $CARGO_TARGET --verbose --release -p ethkey-cli
|
||||
time cargo build --target $CARGO_TARGET --verbose --release -p whisper-cli
|
||||
|
||||
echo "__________Sign binaries__________"
|
||||
scripts/gitlab/sign-win.cmd $keyfile $certpass target/$CARGO_TARGET/release/parity.exe
|
||||
scripts/gitlab/sign-win.cmd $keyfile $certpass target/$CARGO_TARGET/release/parity-evm.exe
|
||||
scripts/gitlab/sign-win.cmd $keyfile $certpass target/$CARGO_TARGET/release/ethstore.exe
|
||||
scripts/gitlab/sign-win.cmd $keyfile $certpass target/$CARGO_TARGET/release/ethkey.exe
|
||||
scripts/gitlab/sign-win.cmd $keyfile $certpass target/$CARGO_TARGET/release/whisper.exe
|
||||
|
||||
echo "_____ Post-processing binaries _____"
|
||||
rm -rf artifacts
|
||||
mkdir -p artifacts
|
||||
cd artifacts
|
||||
mkdir -p $CARGO_TARGET
|
||||
cd $CARGO_TARGET
|
||||
cp --verbose ../../target/$CARGO_TARGET/release/parity.exe ./parity.exe
|
||||
cp --verbose ../../target/$CARGO_TARGET/release/parity-evm.exe ./parity-evm.exe
|
||||
cp --verbose ../../target/$CARGO_TARGET/release/ethstore.exe ./ethstore.exe
|
||||
cp --verbose ../../target/$CARGO_TARGET/release/ethkey.exe ./ethkey.exe
|
||||
cp --verbose ../../target/$CARGO_TARGET/release/whisper.exe ./whisper.exe
|
||||
|
||||
echo "_____ Calculating checksums _____"
|
||||
for binary in $(ls)
|
||||
do
|
||||
rhash --sha256 $binary -o $binary.sha256
|
||||
./parity.exe tools hash $binary > $binary.sha3
|
||||
done
|
||||
cp parity.exe.sha256 parity.sha256
|
||||
cp parity.exe.sha3 parity.sha3
|
||||
|
||||
sccache -s
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
target_filename="parity-${CI_COMMIT_TAG:-${CI_COMMIT_REF_NAME}}.exe"
|
||||
apt -y update
|
||||
apt -y install ftp
|
||||
|
||||
echo "__________Publish Windows binaries to Avast Whitelisting program__________"
|
||||
|
||||
ftp -pinv whitelisting.avast.com <<EOF
|
||||
quote USER ftp_parityio
|
||||
quote PASS $avast_ftp_password
|
||||
cd /share
|
||||
put ./artifacts/x86_64-pc-windows-msvc/parity.exe $target_filename
|
||||
bye
|
||||
EOF
|
||||
|
||||
echo "__________Publish Windows binaries to Kaspersky Whitelisting program__________"
|
||||
|
||||
ftp -pinv whitelist1.kaspersky-labs.com <<EOF
|
||||
quote USER wl-ParityTech
|
||||
quote PASS $kaspersky_ftp_password
|
||||
put ./artifacts/x86_64-pc-windows-msvc/parity.exe $target_filename
|
||||
bye
|
||||
EOF
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
clone_repos() {
|
||||
echo "__________Clone repos__________"
|
||||
git clone https://github.com/parity-js/jsonrpc.git jsonrpc
|
||||
git clone https://github.com/paritytech/wiki.git wiki
|
||||
git clone https://github.com/paritytech/parity-config-generator
|
||||
}
|
||||
|
||||
build_docs() {
|
||||
echo "__________Build docs__________"
|
||||
npm install
|
||||
npm run build:markdown
|
||||
}
|
||||
|
||||
build_config() {
|
||||
echo "_______Build config docs______"
|
||||
yarn install
|
||||
AUTOGENSCRIPT=1 yarn generate-docs
|
||||
}
|
||||
|
||||
update_wiki_docs() {
|
||||
echo "__________Update WIKI docs__________"
|
||||
for file in $(ls jsonrpc/docs); do
|
||||
module_name=${file:0:-3}
|
||||
mv jsonrpc/docs/$file wiki/JSONRPC-$module_name-module.md
|
||||
done
|
||||
mv parity-config-generator/docs/config.md wiki/Configuring-Parity-Ethereum.md
|
||||
}
|
||||
|
||||
setup_git() {
|
||||
echo "__________Set github__________"
|
||||
git config --global user.email "devops-team@parity.io"
|
||||
git config --global user.name "Devops Team Parity"
|
||||
}
|
||||
|
||||
set_remote_wiki() {
|
||||
git config remote.origin.url "https://${GITHUB_TOKEN}@github.com/paritytech/wiki.git"
|
||||
}
|
||||
|
||||
commit_files() {
|
||||
echo "__________Commit files__________"
|
||||
git checkout -b rpcdoc-update-${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}
|
||||
git add .
|
||||
git commit -m "Update docs to ${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}"
|
||||
git tag -a -f "${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}" -m "Update RPC and config docs to ${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}"
|
||||
}
|
||||
|
||||
upload_files() {
|
||||
echo "__________Upload files__________"
|
||||
# this version of git (2.7.4) will dump the token on failure
|
||||
git push -q origin HEAD 2>&1 \
|
||||
| sed -r "s|(${GITHUB_USER}):[a-f0-9]+@|\1:REDACTED@|g"
|
||||
git push -q -f --tags 2>&1 \
|
||||
| sed -r "s|(${GITHUB_USER}):[a-f0-9]+@|\1:REDACTED@|g"
|
||||
}
|
||||
|
||||
RPC_TRAITS_DIR="rpc/src/v1/traits"
|
||||
|
||||
setup_git
|
||||
clone_repos
|
||||
mkdir -p "jsonrpc/.parity/$RPC_TRAITS_DIR"
|
||||
cp $RPC_TRAITS_DIR/*.rs "jsonrpc/.parity/$RPC_TRAITS_DIR"
|
||||
cd jsonrpc
|
||||
build_docs
|
||||
cd ..
|
||||
cd parity-config-generator
|
||||
build_config
|
||||
cd ..
|
||||
update_wiki_docs
|
||||
cd wiki
|
||||
set_remote_wiki
|
||||
commit_files
|
||||
upload_files
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
echo "__________Register Release__________"
|
||||
DATA="secret=$RELEASES_SECRET"
|
||||
|
||||
echo "Pushing release to Mainnet"
|
||||
./tools/safe-curl.sh $DATA "https://update.parity.io/push-release/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$CI_COMMIT_SHA"
|
||||
|
||||
cd artifacts
|
||||
ls -l | sort -k9
|
||||
filetest=( * )
|
||||
echo ${filetest[*]}
|
||||
for DIR in "${filetest[@]}";
|
||||
do
|
||||
cd $DIR
|
||||
if [[ $DIR =~ "windows" ]];
|
||||
then
|
||||
WIN=".exe";
|
||||
else
|
||||
WIN="";
|
||||
fi
|
||||
sha3=$(cat parity.sha3 | awk '{print $1}')
|
||||
case $DIR in
|
||||
x86_64* )
|
||||
DATA="commit=$CI_COMMIT_SHA&sha3=$sha3&filename=parity$WIN&secret=$RELEASES_SECRET"
|
||||
../../tools/safe-curl.sh $DATA "https://update.parity.io/push-build/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$DIR"
|
||||
;;
|
||||
esac
|
||||
cd ..
|
||||
done
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
# prepare variables
|
||||
TRACK=$(cat ./tools/TRACK)
|
||||
echo "Track is: ${TRACK}"
|
||||
VERSION=$(cat ./tools/VERSION)
|
||||
SNAP_PACKAGE="parity_"$VERSION"_"$BUILD_ARCH".snap"
|
||||
# Choose snap release channel based on parity ethereum version track
|
||||
case ${TRACK} in
|
||||
nightly) export GRADE="devel" CHANNEL="edge";;
|
||||
beta) export GRADE="stable" CHANNEL="beta";;
|
||||
stable) export GRADE="stable" CHANNEL="stable";;
|
||||
*) echo "No release" && exit 0;;
|
||||
esac
|
||||
|
||||
echo "__________Create snap package__________"
|
||||
echo "Release channel :" $GRADE " Branch/tag: " $CI_COMMIT_REF_NAME "Track: " ${TRACK}
|
||||
echo $VERSION:$GRADE:$BUILD_ARCH:$CARGO_TARGET
|
||||
|
||||
sed -e 's/$VERSION/'"$VERSION"'/g' \
|
||||
-e 's/$GRADE/'"$GRADE"'/g' \
|
||||
-e 's/$BUILD_ARCH/'"$BUILD_ARCH"'/g' \
|
||||
-e 's/$CARGO_TARGET/'"$CARGO_TARGET"'/g' \
|
||||
scripts/snap/snapcraft.template.yaml > snapcraft.yaml
|
||||
|
||||
apt update
|
||||
apt install -y --no-install-recommends rhash
|
||||
cat snapcraft.yaml
|
||||
snapcraft --target-arch=$BUILD_ARCH
|
||||
ls *.snap
|
||||
|
||||
echo "__________Calculating checksums__________"
|
||||
rhash --sha256 $SNAP_PACKAGE -o $SNAP_PACKAGE".sha256"
|
||||
cat $SNAP_PACKAGE".sha256"
|
||||
|
||||
echo "__________Releasing snap package__________"
|
||||
echo "Release channel :" $CHANNEL " Branch/tag: " $CI_COMMIT_REF_NAME
|
||||
|
||||
echo $SNAPCRAFT_LOGIN_PARITY_BASE64 | base64 --decode > snapcraft.login
|
||||
snapcraft login --with snapcraft.login
|
||||
snapcraft push --release $CHANNEL $SNAP_PACKAGE
|
||||
snapcraft status parity
|
||||
snapcraft logout
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "________Running rust_changes.sh________"
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
echo "__________Checking if Rust files were changed__________"
|
||||
git log --graph --oneline --decorate=short -n 10
|
||||
|
||||
case ${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}} in
|
||||
(beta|stable)
|
||||
export GIT_COMPARE=origin/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}~
|
||||
;;
|
||||
(master|nightly)
|
||||
export GIT_COMPARE=master~
|
||||
;;
|
||||
(*)
|
||||
export GIT_COMPARE=master
|
||||
;;
|
||||
esac
|
||||
|
||||
export RUST_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep -v -e ^\\. -e ^LICENSE -e ^README.md -e ^CHANGELOG.md -e ^test.sh -e ^scripts/ -e ^docs/ -e ^docker/ -e ^snap/ | wc -l | tr -d ' ')"
|
||||
echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED"
|
||||
|
||||
if [ "${RUST_FILES_MODIFIED}" = "0" ]
|
||||
then
|
||||
echo "__________Skipping Rust tests since no Rust files modified__________";
|
||||
exit 0
|
||||
fi
|
||||
|
||||
rustup show
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
DATA=$1
|
||||
ADDRESS=$2
|
||||
|
||||
CODE=$(curl -o out.txt -w '%{http_code}' --data $DATA $ADDRESS)
|
||||
cat out.txt && rm out.txt
|
||||
echo "\n"
|
||||
|
||||
if [[ $CODE -eq 200 ]]; then
|
||||
echo 'Pushed to updater service.';
|
||||
elif [[ $CODE -eq 202 ]]; then
|
||||
echo 'Updater service ignored request.';
|
||||
else
|
||||
echo 'Unable to push info to updater service.';
|
||||
exit 2
|
||||
fi
|
||||
@@ -1 +0,0 @@
|
||||
@signtool sign /f %1 /p %2 /tr http://timestamp.comodoca.com /du https://parity.io %3
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "________Running test-cpp.sh________"
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
#use nproc `linux only
|
||||
THREADS=$(nproc)
|
||||
export CC="sccache gcc"
|
||||
export CXX="sccache g++"
|
||||
|
||||
echo "________Running the C++ example________"
|
||||
DIR=parity-clib/examples/cpp/build
|
||||
mkdir -p $DIR
|
||||
cd $DIR
|
||||
cmake ..
|
||||
make VERBOSE=1 -j $THREADS
|
||||
# Note: we don't try to run the example because it tries to sync Kovan, and we don't want
|
||||
# that to happen on CI
|
||||
cd -
|
||||
rm -rf $DIR
|
||||
#show sccache statistics
|
||||
sccache --stop-server
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
# ARGUMENT $1 Rust flavor to run test with (stable/beta/nightly)
|
||||
|
||||
echo "________Running test-linux.sh________"
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
export CC="sccache gcc"
|
||||
export CXX="sccache g++"
|
||||
FEATURES="json-tests"
|
||||
|
||||
OPTIONS="--release"
|
||||
#use nproc `linux only
|
||||
THREADS=$(nproc)
|
||||
|
||||
rustup default $1
|
||||
rustup show
|
||||
|
||||
echo "________Running Parity Full Test Suite________"
|
||||
# Why are we using RUSTFLAGS? See https://github.com/paritytech/parity-ethereum/pull/10719
|
||||
CARGO_INCREMENTAL=0 RUSTFLAGS="-C opt-level=3 -C overflow-checks=on -C debuginfo=2" time cargo test $OPTIONS --features "$FEATURES" --locked --all --target $CARGO_TARGET --verbose --color=never -- --test-threads $THREADS
|
||||
|
||||
#show sccache statistics
|
||||
sccache --stop-server
|
||||
Reference in New Issue
Block a user