difftreelog
Added script for readyness check.
in: master
2 files changed
.docker/readyness.jsdiffbeforeafterboth1#!/usr/bin/env node23const { ApiPromise, WsProvider } = require('@polkadot/api');45const main = async () => {6 const wsEndpoint = 'ws://127.0.0.1:9944'7 const api = new ApiPromise({provider: new WsProvider(wsEndpoint)});8 await api.isReady;910 const head = (await api.rpc.chain.getHeader()).number.toNumber();11 if(head < 1) throw Error('No block #1');1213 await api.disconnect();14}1516main().then(() => process.exit(0)).catch(e => {17 console.error(e);18 process.exit(1);19});.github/workflows/node_build_test.ymldiffbeforeafterboth--- a/.github/workflows/node_build_test.yml
+++ b/.github/workflows/node_build_test.yml
@@ -41,6 +41,24 @@
features: "--features=unique-runtime"
steps:
+ - name: Skip if pull request is in Draft
+ # `if: github.event.pull_request.draft == true` should be kept here, at
+ # the step level, rather than at the job level. The latter is not
+ # recommended because when the PR is moved from "Draft" to "Ready to
+ # review" the workflow will immediately be passing (since it was skipped),
+ # even though it hasn't actually ran, since it takes a few seconds for
+ # the workflow to start. This is also disclosed in:
+ # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/17
+ # That scenario would open an opportunity for the check to be bypassed:
+ # 1. Get your PR approved
+ # 2. Move it to Draft
+ # 3. Push whatever commits you want
+ # 4. Move it to "Ready for review"; now the workflow is passing (it was
+ # skipped) and "Check reviews" is also passing (it won't be updated
+ # until the workflow is finished)
+ if: github.event.pull_request.draft == true
+ run: exit 1
+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
@@ -64,8 +82,8 @@
- name: Build the stack
run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build
- - name: Wait
- run: sleep 420s
+ # - name: Wait
+ # run: sleep 420s
- name: Install node
uses: actions/setup-node@v1
@@ -81,6 +99,7 @@
- name: Run tests
run: |
+ chmod u+x .docker/readyness.js && .docker/readyness.js
cd tests
NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}
env: