Skip to content

x-sessions update

x-sessions update #135

Workflow file for this run

name: Build and run tests
on:
push:
branches:
- develop
- main
pull_request:
env:
PNPM_VERSION: 9.1.4
NODE_VERSION: 20.x
jobs:
build:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.48.2-jammy
env:
ARGENT_X_ENVIRONMENT: "hydrogen"
E2E_REPO: ${{ secrets.E2E_REPO }}
E2E_REPO_TOKEN: ${{ secrets.E2E_REPO_TOKEN }}
E2E_REPO_OWNER: ${{ secrets.E2E_REPO_OWNER }}
E2E_REPO_RELEASE_NAME: ${{ secrets.E2E_REPO_RELEASE_NAME }}
WW_EMAIL: ${{ secrets.WW_EMAIL }}
WW_LOGIN_PASSWORD: ${{ secrets.WW_LOGIN_PASSWORD }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build demo-dapp-starknet
run: pnpm run build
- name: Use Cache
uses: actions/cache@v4
with:
path: ./*
key: ${{ github.sha }}
test-webwallet:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.48.2-jammy
needs: [build]
env:
ARGENT_X_ENVIRONMENT: "hydrogen"
WW_EMAIL: ${{ secrets.WW_EMAIL }}
WW_LOGIN_PASSWORD: ${{ secrets.WW_LOGIN_PASSWORD }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: ${{ env.PNPM_VERSION }}
run_install: false
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
- name: Restore pnpm cache
uses: actions/cache/restore@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Restore cached build
uses: actions/cache/restore@v4
with:
path: ./*
key: ${{ github.sha }}
- name: Run e2e tests
run: |
pnpm run start & # Start the server in background
echo "Waiting for server to be ready..."
for i in $(seq 1 30); do
if curl -s http://localhost:3000 > /dev/null; then
echo "Server is ready!"
break
fi
echo "Attempt $i: Server not ready yet..."
if [ $i -eq 30 ]; then
echo "Server failed to start"
exit 1
fi
sleep 1
done
xvfb-run --auto-servernum pnpm test:webwallet
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: test-artifacts
path: |
e2e/artifacts/playwright/
!e2e/artifacts/playwright/*.webm
retention-days: 5
test-argentX:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.48.2-jammy
needs: [build]
env:
ARGENT_X_ENVIRONMENT: "hydrogen"
E2E_REPO: ${{ secrets.E2E_REPO }}
E2E_REPO_TOKEN: ${{ secrets.E2E_REPO_TOKEN }}
E2E_REPO_OWNER: ${{ secrets.E2E_REPO_OWNER }}
E2E_REPO_RELEASE_NAME: ${{ secrets.E2E_REPO_RELEASE_NAME }}
E2E_TESTNET_SEED3: ${{ secrets.E2E_TESTNET_SEED3 }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: ${{ env.PNPM_VERSION }}
run_install: false
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
- name: Restore pnpm cache
uses: actions/cache/restore@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Restore cached build
uses: actions/cache/restore@v4
with:
path: ./*
key: ${{ github.sha }}
- name: Install libarchive-tools
shell: bash
run: |
try_apt() {
rm -f /var/lib/apt/lists/lock
rm -f /var/cache/apt/archives/lock
rm -f /var/lib/dpkg/lock*
dpkg --configure -a
apt-get update && apt-get install -y libarchive-tools
}
for i in $(seq 1 3); do
echo "Attempt $i to install libarchive-tools"
if try_apt; then
echo "Successfully installed libarchive-tools"
exit 0
fi
echo "Attempt $i failed, waiting 10 seconds..."
sleep 10
done
echo "Failed to install libarchive-tools after 3 attempts"
exit 1
- name: Run e2e tests
run: |
pnpm run start & # Start the server in background
echo "Waiting for server to be ready..."
for i in $(seq 1 30); do
if curl -s http://localhost:3000 > /dev/null; then
echo "Server is ready!"
break
fi
echo "Attempt $i: Server not ready yet..."
if [ $i -eq 30 ]; then
echo "Server failed to start"
exit 1
fi
sleep 1
done
xvfb-run --auto-servernum pnpm test:argentx
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: test-artifacts
path: |
e2e/artifacts/playwright/
!e2e/artifacts/playwright/*.webm
retention-days: 5