Skip to content

Commit

Permalink
ci: add integration test to GitHub Action (#24)
Browse files Browse the repository at this point in the history
* ci: add integration test to GitHub Action

* ci: add comment and switch up order for steps

* ci: add a step to verify contracts started onchain

And bump the block height threshold for being healthy

* ci: add additional tests for other contracts

* ci: bump timeout to 300 seconds

* ci: remove bogus curl line for testing

* ci: remove test for swaparoo for now

Ref: #24 (comment)
  • Loading branch information
LuqiPan authored Mar 18, 2024
1 parent a4d767e commit 1b7c376
Showing 1 changed file with 47 additions and 7 deletions.
54 changes: 47 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: Lint and Test
name: CI

on:
pull_request:

jobs:
all:
unit:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Use Node.js 18.8.x
uses: actions/setup-node@v3
uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
# use node 18.8.x until Agoric/agoric-sdk#8636
node-version: '18.8.x'
node-version: "18"
- name: yarn install
run: yarn
- name: yarn lint
Expand All @@ -24,3 +23,44 @@ jobs:
run: yarn test
- name: yarn test:e2e
run: yarn test:e2e
integration:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: "18"
- name: yarn install
run: yarn
- name: yarn start:docker
run: yarn start:docker
- name: yarn build
run: yarn build
# Borrowed from https://github.com/DCFoundation/cosmos-proposal-builder/blob/main/.github/workflows/pr.yml#L43-L61
- name: Wait for Docker container to be ready
run: |
timeout 300 bash -c '
TARGET_HEIGHT=1111
SLEEP=10
echo "Waiting for the Agoric service to be fully ready..."
echo "Target block height: $TARGET_HEIGHT"
while true; do
response=$(curl --silent http://localhost:26657/abci_info);
height=$(echo $response | jq -r ".result.response.last_block_height | tonumber");
if [ "$height" -ge $TARGET_HEIGHT ]; then
echo "Service is ready! Last block height: $height";
break;
else
echo "Waiting for last block height to reach $TARGET_HEIGHT. Current height: $height";
fi;
sleep $SLEEP;
done
'
- name: yarn start:contract
run: yarn start:contract
- name: verify contracts started onchain
run: |
curl http://localhost:1317/agoric/vstorage/data/published.agoricNames.instance | grep sellConcertTickets
curl http://localhost:1317/agoric/vstorage/data/published.agoricNames.instance | grep postalService

0 comments on commit 1b7c376

Please sign in to comment.