ci: adding github actions to run e2e tests #72
Workflow file for this run
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: CI | |
on: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Use Node.js 18.8.x | |
uses: actions/setup-node@v3 | |
with: | |
# use node 18.8.x until Agoric/agoric-sdk#8636 | |
node-version: "18.8.x" | |
- name: yarn install | |
run: yarn | |
- name: yarn lint | |
run: yarn lint | |
- name: yarn build | |
run: yarn build | |
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 offerUp | |
- name: Install linux deps | |
run: | | |
sudo apt-get install --no-install-recommends -y \ | |
fluxbox \ | |
xvfb | |
- name: Run xvfb and fluxbox | |
run: | | |
Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac & | |
fluxbox & | |
env: | |
DISPLAY: :0.0 | |
- name: Run e2e tests | |
uses: cypress-io/github-action@248bde77443c376edc45906ede03a1aba9da0462 | |
with: | |
start: npx serve ui/dist -p 5173 | |
command: yarn test:e2e | |
wait-on: 'http://localhost:5173' | |
wait-on-timeout: 120 | |
browser: chrome | |
env: | |
DISPLAY: :0.0 | |
SECRET_WORDS: "orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology" | |
- name: Archive e2e artifacts | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: e2e-artifacts | |
path: | | |
ui/test/e2e/videos | |
ui/test/e2e/screenshots | |
continue-on-error: true |