Skip to content

Commit

Permalink
Merge cli-ci.yml and ci.yml
Browse files Browse the repository at this point in the history
both Creditcoin integration tests and cc-cli integration tests are
building creditcoin-node with exactly the same arguments. Merging the
two definitions allows both jobs to depend on a common build job which
should reduce overall CI turnaround time.
  • Loading branch information
atodorov authored and AdaJane committed Aug 24, 2023
1 parent 4f073ae commit b2795ee
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 161 deletions.
102 changes: 101 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ jobs:
run: |
SKIP_WASM_BUILD=1 cargo check --features=runtime-benchmarks --release
test:
unit-test-creditcoin:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -277,6 +277,32 @@ jobs:
fail_ci_if_error: true
verbose: true

unit-test-cli:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install -g yarn

- name: Execute tests
run: |
pushd creditcoin-js/ && yarn install && yarn pack && popd
pushd scripts/cc-cli
yarn upgrade 'creditcoin-js'
yarn test:unit
popd
- uses: codecov/codecov-action@v3
with:
files: scripts/cc-cli/coverage/lcov.info
fail_ci_if_error: true
verbose: true

build-creditcoin-node:
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -319,6 +345,80 @@ jobs:
name: creditcoin_node_runtime.compact.compressed.wasm
path: target/release/wbuild/creditcoin-node-runtime/creditcoin_node_runtime.compact.compressed.wasm

integration-test-cli:
needs:
- build-creditcoin-node
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Download creditcoin-node binary
uses: actions/download-artifact@v3
with:
name: creditcoin-node
path: target/release

- name: Download runtime
uses: actions/download-artifact@v3
with:
name: creditcoin_node_runtime.compact.compressed.wasm
path: target/release

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install -g yarn && npm install -g jest

- name: Install Creditcoin CLI
run: |
pushd creditcoin-js/ && yarn install && yarn pack && popd
pushd scripts/cc-cli && yarn upgrade 'creditcoin-js' && yarn build && npm install -g . && popd
- name: Start Node 1
run: |
chmod a+x ./target/release/creditcoin-node
./target/release/creditcoin-node \
--chain local \
--validator --alice --pruning archive \
--node-key d182d503b7dd97e7c055f33438c7717145840fd66b2a055284ee8d768241a463 \
--base-path ./alice-data &
- name: Start Node 2
run: |
./target/release/creditcoin-node \
--chain local \
--validator --bob --pruning archive \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWKEKymnBDKfa8MkMWiLE6DYbC4aAUciqmYucm7xFKK3Au \
--port 30335 --ws-port 9945 --rpc-port 9935 &
- name: Wait for nodes to start
run: |
./integration-tests/wait-for-creditcoin.sh 'http://127.0.0.1:9933'
./integration-tests/wait-for-creditcoin.sh 'http://127.0.0.1:9935'
- name: Run integration tests
run: |
pushd scripts/cc-cli
yarn test:integration
popd
- name: Upload code coverage
uses: codecov/codecov-action@v3
with:
files: scripts/cc-cli/coverage/lcov.info
fail_ci_if_error: true
verbose: true

- name: Kill nodes
if: always()
continue-on-error: true
run: |
# if all went well kill the node. Otherwise GitHub Actions would exit on the
# previous step killing everything and we don't have to worry about
# dangling processes
killall -9 creditcoin-node
integration-test-loan-cycle:
needs:
- build-creditcoin-node
Expand Down
160 changes: 0 additions & 160 deletions .github/workflows/cli-ci.yml

This file was deleted.

0 comments on commit b2795ee

Please sign in to comment.