Fix artifact uploading (#1355) #2142
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: manta integration test | |
on: | |
push: | |
branches: [manta] | |
pull_request: | |
branches: [manta] | |
types: [opened, reopened, synchronize, labeled] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
POLKADOT_BINARY: https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-v1.7.0/polkadot | |
POLKADOT_EXECUTE: https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-v1.7.0/polkadot-execute-worker | |
POLKADOT_PREPARE: https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-v1.7.0/polkadot-prepare-worker | |
ZOMBIENET_BINARY: https://github.com/paritytech/zombienet/releases/download/v1.3.106/zombienet-linux-x64 | |
jobs: | |
print-rust-versions: | |
if: contains(github.event.pull_request.labels.*.name, 'A-manta') | |
runs-on: ubuntu-20.04 | |
container: | |
image: paritytech/ci-linux:production | |
outputs: | |
rustc-stable: ${{ steps.get-rust-versions.outputs.stable }} | |
rustc-nightly: ${{ steps.get-rust-versions.outputs.nightly }} | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- id: get-rust-versions | |
run: | | |
echo "::set-output name=stable::$(rustc +stable --version)" | |
echo "::set-output name=nightly::$(rustc +nightly --version)" | |
build-node-current: | |
timeout-minutes: 120 | |
if: contains(github.event.pull_request.labels.*.name, 'A-manta') | |
runs-on: ubuntu-20.04 | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
- name: install sccache | |
env: | |
SCCACHE_RELEASE_URL: https://github.com/mozilla/sccache/releases/download | |
SCCACHE_VERSION: v0.5.3 | |
run: | | |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl | |
mkdir -p $HOME/.local/bin | |
curl -L "$SCCACHE_RELEASE_URL/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz | |
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache | |
chmod +x $HOME/.local/bin/sccache | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
- name: cache sccache | |
uses: actions/cache@v2 | |
continue-on-error: false | |
with: | |
path: /home/runner/.cache/sccache | |
key: sccache-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
sccache- | |
- name: start sccache server | |
run: sccache --start-server | |
- name: init | |
run: | | |
sudo apt update | |
sudo apt install -y pkg-config libssl-dev protobuf-compiler curl clang git | |
protoc --version | |
curl -s https://sh.rustup.rs -sSf | sh -s -- -y | |
source ${HOME}/.cargo/env | |
rustup toolchain install 1.74.0 | |
rustup default 1.74.0 | |
rustup target add wasm32-unknown-unknown | |
- name: cache cargo | |
uses: Swatinem/rust-cache@v2 | |
- name: build | |
env: | |
RUST_BACKTRACE: full | |
RUSTC_WRAPPER: sccache | |
SCCACHE_CACHE_SIZE: 2G | |
SCCACHE_DIR: /home/runner/.cache/sccache | |
run: | | |
source ${HOME}/.cargo/env | |
RUSTC_BOOTSTRAP=1 cargo build --profile production --verbose | |
- name: stop sccache server | |
run: sccache --stop-server || true | |
- if: always() | |
name: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: manta | |
path: target/production/manta | |
manta-integration-test: | |
if: contains(github.event.pull_request.labels.*.name, 'A-manta') | |
needs: [build-node-current] | |
runs-on: runtime-integration-test | |
timeout-minutes: 240 | |
container: | |
image: ubuntu:20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
chain-spec: | |
- id: manta-dev | |
expected: | |
block-count: | |
relay: 15 | |
para: 6 | |
peer-count: | |
relay: 7 | |
para: 4 | |
steps: | |
- name: Install Node.js, NPM and Yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.12.x | |
- run: | | |
mkdir -p $HOME/.local/share/calamari-pc | |
mkdir -p $HOME/.local/bin | |
echo "${HOME}/.local/bin" >> $GITHUB_PATH | |
- name: fetch manta | |
uses: actions/download-artifact@v4 | |
with: | |
name: manta | |
- name: mv and chmod manta | |
run: | | |
mv $GITHUB_WORKSPACE/manta $HOME/.local/bin/ | |
chmod +x $HOME/.local/bin/manta | |
ls -ahl $GITHUB_WORKSPACE/ | |
ls -ahl $HOME/.local/bin/ | |
- name: fetch and chmod polkadot | |
shell: bash | |
run: | | |
apt update && apt install -y curl jq wget git | |
curl -L -o $HOME/.local/bin/polkadot ${{ env.POLKADOT_BINARY }} | |
curl -L -o $HOME/.local/bin/polkadot-execute-worker ${{ env.POLKADOT_EXECUTE }} | |
curl -L -o $HOME/.local/bin/polkadot-prepare-worker ${{ env.POLKADOT_PREPARE }} | |
chmod +x $HOME/.local/bin/polkadot | |
chmod +x $HOME/.local/bin/polkadot-execute-worker | |
chmod +x $HOME/.local/bin/polkadot-prepare-worker | |
ls -ahl $HOME/.local/bin/ | |
$HOME/.local/bin/polkadot --version | |
- name: Install dasel cli | |
shell: bash | |
run: | | |
curl -sSLf "$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" -L -o $HOME/dasel && chmod +x $HOME/dasel | |
$HOME/dasel --version | |
- id: create-chainspec | |
shell: bash | |
run: | | |
manta build-spec --chain ${{ matrix.chain-spec.id }} --disable-default-bootnode --raw > $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-spec.json | |
jq \ | |
--sort-keys \ | |
--arg name "manta testnet ${GITHUB_SHA:0:7}" \ | |
--arg id ${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7} \ | |
--arg relay_chain rococo-local-${GITHUB_SHA:0:7} \ | |
'. | | |
.name = $name | | |
.id = $id | | |
.relay_chain = $relay_chain | | |
.telemetryEndpoints = [["/dns/api.telemetry.manta.systems/tcp/443/x-parity-wss/%2Fsubmit%2F", 0]] | |
' $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-spec.json > $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json | |
ls -ahl $HOME/.local/share/calamari-pc/ | |
echo "::set-output name=short-sha::${GITHUB_SHA:0:7}" | |
manta export-state --chain $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json > $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-state.json || true | |
- uses: borales/[email protected] | |
- uses: actions/checkout@v2 | |
with: | |
repository: Manta-Network/Manta | |
path: Manta | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.chain-spec.id }}-state.json | |
path: /home/runner/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-state.json | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.chain-spec.id }}-spec.json | |
path: /home/runner/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-spec.json | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.chain-spec.id }}-${{ steps.create-chainspec.outputs.short-sha }}-spec.json | |
path: /home/runner/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${{ steps.create-chainspec.outputs.short-sha }}-spec.json | |
- name: create launch config | |
shell: bash | |
run: | | |
ls -ahl $GITHUB_WORKSPACE | |
cd $GITHUB_WORKSPACE | |
$HOME/dasel put -t string -v $HOME/.local/bin/polkadot -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.relaychain.default_command' | |
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].collators.[0].command' | |
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].collators.[1].command' | |
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].collators.[2].command' | |
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].collators.[3].command' | |
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].collators.[4].command' | |
$HOME/dasel put -t string -v "manta-dev" -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].chain' | |
$HOME/dasel put -t int -v 2104 -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].id' | |
cat $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.chain-spec.id }}-${{ steps.create-chainspec.outputs.short-sha }}-launch-config.json | |
path: /home/runner/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${{ steps.create-chainspec.outputs.short-sha }}-launch-config.json | |
- name: fetch and chmod zombienet | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE | |
mkdir -p ./zombienet-tool | |
curl -L -o $GITHUB_WORKSPACE/zombienet-tool/zombienet ${{ env.ZOMBIENET_BINARY }} | |
cd $GITHUB_WORKSPACE/zombienet-tool | |
chmod +x zombienet | |
./zombienet version | |
- uses: actions/checkout@v2 | |
with: | |
repository: Manta-Network/Dev-Tools | |
path: dev-tools-rococo | |
- uses: actions/checkout@v2 | |
with: | |
repository: Manta-Network/Dev-Tools | |
path: dev-tools-manta | |
- name: Setup yarn | |
run: npm install -g yarn | |
- name: Install pm2 | |
run: npm install -g pm2 | |
- name: launch testnet | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE/zombienet-tool | |
pm2 start ./zombienet --name zombienet \ | |
--output $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stdout.log \ | |
--error $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stderr.log \ | |
-- spawn --provider native $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml | |
- name: init measure-block-time rococo | |
run: | | |
cd $GITHUB_WORKSPACE/dev-tools-rococo/measure-block-time | |
yarn install | |
pm2 start index.js \ | |
--name measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }} \ | |
--output $GITHUB_WORKSPACE/measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stdout.log \ | |
--error $GITHUB_WORKSPACE/measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stderr.log \ | |
--no-autorestart \ | |
-- \ | |
--address=ws://127.0.0.1:9911 | |
- name: init measure-block-time manta | |
run: | | |
cd $GITHUB_WORKSPACE/dev-tools-manta/measure-block-time | |
yarn install | |
pm2 start index.js \ | |
--name measure-block-time-${{ matrix.chain-spec.id }} \ | |
--output $GITHUB_WORKSPACE/measure-block-time-${{ matrix.chain-spec.id }}-stdout.log \ | |
--error $GITHUB_WORKSPACE/measure-block-time-${{ matrix.chain-spec.id }}-stderr.log \ | |
--no-autorestart \ | |
-- \ | |
--address=ws://127.0.0.1:9921 | |
- uses: actions/checkout@v2 | |
with: | |
repository: Manta-Network/Manta | |
path: Manta | |
- name: stop testnet | |
run: | | |
cd $GITHUB_WORKSPACE/zombienet-tool | |
pm2 stop measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }} | |
pm2 stop measure-block-time-${{ matrix.chain-spec.id }} | |
pm2 stop zombienet | |
- name: test - manta alice peered successfully | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE/zombienet-tool | |
sed -i 's/2084/2104/g' $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.zndsl | |
$HOME/dasel put -t string -v $HOME/.local/bin/polkadot -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.relaychain.default_command' | |
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].collators.[0].command' | |
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].collators.[1].command' | |
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].collators.[2].command' | |
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].collators.[3].command' | |
$HOME/dasel put -t string -v $HOME/.local/bin/manta -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].collators.[4].command' | |
$HOME/dasel put -t string -v "manta-dev" -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].chain' | |
$HOME/dasel put -t int -v 2104 -r toml \ | |
-f $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml \ | |
'.parachains.[0].id' | |
cat $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml | |
cat $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.zndsl | |
./zombienet -f -p native test $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.zndsl | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zombienet-for-${{ matrix.chain-spec.id }}-stdout.log | |
path: $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stdout.log | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zombienet-for-${{ matrix.chain-spec.id }}-stderr.log | |
path: $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stderr.log | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stdout.log | |
path: $GITHUB_WORKSPACE/measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stdout.log | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stderr.log | |
path: $GITHUB_WORKSPACE/measure-block-time-rococo-relay-for-${{ matrix.chain-spec.id }}-stderr.log | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: measure-block-time-${{ matrix.chain-spec.id }}-stdout.log | |
path: $GITHUB_WORKSPACE/measure-block-time-${{ matrix.chain-spec.id }}-stdout.log | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: measure-block-time-${{ matrix.chain-spec.id }}-stderr.log | |
path: $GITHUB_WORKSPACE/measure-block-time-${{ matrix.chain-spec.id }}-stderr.log | |
- name: launch testnet | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE/zombienet-tool | |
pm2 start ./zombienet --name zombienet \ | |
--output $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stdout.log \ | |
--error $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stderr.log \ | |
-- spawn --provider native $GITHUB_WORKSPACE/Manta/zombienet/tests/0001-block-production.toml | |
- name: run farming test | |
run: | | |
sleep 720 | |
cd $GITHUB_WORKSPACE/Manta/tests | |
yarn install | |
yarn | |
yarn test_farming --address=ws://127.0.0.1:9921 --exit | |
- name: stop testnet | |
run: | | |
cd $GITHUB_WORKSPACE/zombienet-tool | |
pm2 stop zombienet | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.chain-spec.id }}-alice-stress.log | |
path: $GITHUB_WORKSPACE/zombienet-for-${{ matrix.chain-spec.id }}-stdout.log | |
- name: run tests | |
run: | | |
sleep 120 | |
cd $GITHUB_WORKSPACE/Manta/tests | |
yarn install | |
yarn | |
MANTA_BINARY=$HOME/.local/bin/manta yarn tests | |
docker-image-test: | |
timeout-minutes: 120 | |
if: contains(github.event.pull_request.labels.*.name, 'A-manta') | |
needs: [build-node-current] | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
runtime: | |
- name: manta | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
- name: fetch manta | |
uses: actions/download-artifact@v4 | |
with: | |
name: manta | |
- name: build docker image | |
run: | | |
mv manta docker/manta | |
cd docker/ | |
chmod +x manta | |
GIT_TAG=${{ github.event.release.tag_name }} | |
BINARY_NAME=manta | |
ln -s ${{ matrix.runtime.name }}.Dockerfile Dockerfile | |
docker build \ | |
--build-arg PARA_BINARY_REF=${GIT_TAG} \ | |
--build-arg PARA_BINARY_URL=manta \ | |
--tag ${{ matrix.runtime.name }} ./ | |
- name: run docker image | |
run: | | |
sudo docker run -p 9944:9944 -p 9945:9945 -d ${{ matrix.runtime.name }} --unsafe-rpc-external -- --unsafe-rpc-external > docker_id.log | |
sleep 60 | |
- name: Show log | |
run: | | |
echo "Get the docker container ID:" | |
image_id=`cat docker_id.log` | |
echo $image_id | |
echo "Adjusting permissions so we can access docker logs..." | |
sudo cat /var/lib/docker/containers/${image_id}/${image_id}-json.log | |
- uses: actions/checkout@v2 | |
with: | |
repository: Manta-Network/Dev-Tools | |
path: dev-tools | |
- name: check if target block is finalized | |
run: | | |
cd dev-tools/check-finalized-block | |
npm install -g yarn | |
yarn install | |
yarn | |
node index.js --para_address=ws://127.0.0.1:9944 --relay_address=ws://127.0.0.1:9945 --target_block=6 | |
if [ $? == 1 ]; then echo "Failed to finalize the target block - 6"; exit 1; fi |