Fix typos #5
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: Run all tests | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
jobs: | |
build-all-artifacts: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
env: [prod, hydrogen] | |
extension_type: [chrome, firefox] | |
environment: ${{ matrix.env }} | |
env: | |
# FEATURE flags | |
FEATURE_PRIVACY_SETTINGS: "true" | |
FEATURE_EXPERIMENTAL_SETTINGS: "false" | |
FEATURE_BETA_FEATURES: "false" | |
FEATURE_BANXA: "true" | |
FEATURE_LAYERSWAP: "true" | |
FEATURE_ORBITER: "true" | |
FEATURE_VERIFIED_DAPPS: "true" | |
FEATURE_MULTISIG: "true" | |
# API URLs | |
ARGENT_API_BASE_URL: ${{ vars.ARGENT_API_BASE_URL }} | |
ARGENT_X_STATUS_URL: ${{ vars.ARGENT_X_STATUS_URL }} | |
ARGENT_TESTNET_RPC_URL: ${{ vars.ARGENT_TESTNET_RPC_URL }} | |
# API ENVIRONMENT | |
ARGENT_X_ENVIRONMENT: ${{ matrix.env }} | |
# Sentry | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ENVIRONMENT: "staging" | |
# Misc | |
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }} | |
RAMP_API_KEY: ${{ secrets.RAMP_API_KEY }} | |
SAFE_ENV_VARS: false | |
MULTICALL_MAX_BATCH_SIZE: 20 | |
# Refresh intervals | |
FAST: 20 # 20s | |
MEDIUM: 60 # 60s | |
SLOW: 60 * 5 # 5m | |
VERY_SLOW: 24 * 60 * 60 # 1d | |
#For testing only | |
FEE_OVERHEAD: 2 | |
steps: | |
# Setup Project | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
cache: "pnpm" | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Setup project | |
run: pnpm run setup | |
- name: Build extension for ${{ matrix.extension_type }} | |
run: | | |
if [[ "${{ matrix.extension_type }}" == "firefox" ]]; then | |
MANIFEST_VERSION=v2 pnpm run build:extension | |
else | |
MANIFEST_VERSION=v3 pnpm run build:extension | |
fi | |
- name: Check bundlesize for ${{ matrix.extension_type }} | |
run: pnpm bundlewatch | |
- name: Use Cache | |
uses: actions/cache@v3 | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ matrix.extension_type }}-${{ matrix.env }} | |
- name: Set filename prefix | |
run: echo "FILENAME_PREFIX=$(echo argent-x-${{ matrix.env }}-${{ github.ref_name }} | tr / -)" >> $GITHUB_ENV | |
- name: Create ${{ matrix.extension_type }} zip | |
run: (cd ./packages/extension/dist && zip -r "../../../${{ env.FILENAME_PREFIX }}-${{ matrix.extension_type }}" .) | |
- name: Upload ${{ matrix.extension_type }} extension | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.FILENAME_PREFIX }}-${{ matrix.extension_type }} | |
path: "*-${{ matrix.extension_type }}.zip" | |
retention-days: 3 | |
test-unit: | |
runs-on: ubuntu-latest | |
needs: [build-all-artifacts] | |
environment: "hydrogen" # test-unit is always run against hydrogen | |
env: | |
ARGENT_API_BASE_URL: ${{ vars.ARGENT_API_BASE_URL }} | |
ARGENT_TESTNET_RPC_URL: ${{ vars.ARGENT_TESTNET_RPC_URL }} | |
ARGENT_X_STATUS_URL: ${{ vars.ARGENT_X_STATUS_URL }} | |
ARGENT_X_ENVIRONMENT: "hydrogen" | |
services: | |
devnet: | |
# Temporary pin the previous version of the devnet image to avoid a bug introduced in the latest version | |
image: shardlabs/starknet-devnet-rs:78527decb3f76c4c808fa35f46228557af3df385-seed0 | |
# image: shardlabs/starknet-devnet-rs:latest-seed0 | |
ports: | |
- 5050:5050 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
cache: "pnpm" | |
- name: Restore pnpm cache | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
path: ./* | |
key: ${{ github.sha }}-chrome-hydrogen # test-unit is always run against chrome-hydrogen build | |
- name: Lint | |
run: pnpm run lint | |
- name: Run tests | |
run: pnpm run test:ci | |
- name: SonarCloud Scan | |
# TODO replace with master as soon as sonarcloud fixes the issue with action https://community.sonarsource.com/t/sonarsource-sonarcloud-github-action-failing-with-node-js-12-error/89664/2 | |
uses: SonarSource/[email protected] | |
with: | |
projectBaseDir: ./packages/extension | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} | |
test-e2e: | |
runs-on: ubuntu-latest | |
needs: [build-all-artifacts] | |
strategy: | |
matrix: | |
project: [ArgentX] | |
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8] | |
shardTotal: [8] | |
env: | |
ARGENT_X_ENVIRONMENT: "hydrogen" | |
ARGENT_API_BASE_URL: ${{ secrets.ARGENT_API_BASE_URL }} | |
E2E_TESTNET_SEED1: ${{ secrets.E2E_TESTNET_SEED1 }} | |
E2E_TESTNET_SEED2: ${{ secrets.E2E_TESTNET_SEED2 }} | |
E2E_TESTNET_SEED3: ${{ secrets.E2E_TESTNET_SEED3 }} | |
E2E_ACCOUNT_1_SEED2: ${{ secrets.E2E_ACCOUNT_1_SEED2 }} | |
E2E_ACCOUNT_1_SEED3: ${{ secrets.E2E_ACCOUNT_1_SEED3 }} | |
## BANK ACCOUNT, USED FOR FUND OTHER ACCOUNTS | |
E2E_SENDER_ADDRESS: ${{ secrets.E2E_SENDER_ADDRESS }} | |
E2E_SENDER_PRIVATEKEY: ${{ secrets.E2E_SENDER_PRIVATEKEY }} | |
E2E_SENDER_SEED: ${{ secrets.E2E_SENDER_SEED }} | |
STARKNET_TESTNET_URL: ${{ secrets.STARKNET_TESTNET_URL }} | |
STARKSCAN_TESTNET_URL: ${{ secrets.STARKSCAN_TESTNET_URL }} | |
ARGENT_TESTNET_RPC_URL: ${{ secrets.ARGENT_TESTNET_RPC_URL }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
cache: "pnpm" | |
- name: Restore pnpm cache | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
path: ./* | |
key: ${{ github.sha }}-chrome-${{ env.ARGENT_X_ENVIRONMENT }} # test-e2e is always run against chrome-hydrogen build | |
- name: Install Playwright Browsers | |
run: npx playwright install chromium | |
- name: Run e2e tests | |
run: xvfb-run --auto-servernum pnpm test:e2e:extension --project=${{ matrix.project }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: test-artifacts | |
path: | | |
packages/e2e/artifacts/playwright/ | |
retention-days: 5 | |
- name: Upload blob report to GitHub Actions Artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: all-blob-reports | |
path: packages/e2e/blob-report/ | |
retention-days: 5 | |
merge-reports: | |
needs: [test-e2e, test-webwallet] | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "16" | |
cache: "pnpm" | |
- name: Restore pnpm cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Download blob reports from GitHub Actions Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: all-blob-reports | |
path: all-blob-reports | |
- name: Merge into HTML Report | |
run: npx playwright merge-reports --reporter html ./all-blob-reports | |
- name: Upload HTML report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: html-report--attempt-${{ github.run_attempt }} | |
path: playwright-report | |
retention-days: 14 | |
add_pr_comments: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'}} # Run only for pull requests and if not triggered by dependabot | |
needs: [build-all-artifacts, test-unit, test-e2e] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
cache: "pnpm" | |
- name: Restore pnpm cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Set GHA_BRANCH | |
run: echo "GHA_BRANCH=$(echo $GITHUB_REF | awk -F / '{print $3}')" >> $GITHUB_ENV | |
- name: Comment PR | |
continue-on-error: true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh pr comment ${{ env.GHA_BRANCH }} --body "[Builds for local testing](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" | |
create_sentry_release: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'}} # Run only for pull requests and if not triggered by dependabot | |
needs: [build-all-artifacts, test-unit, test-e2e] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
cache: "pnpm" | |
- name: Restore cached build | |
uses: actions/cache@v3 | |
with: | |
path: ./* | |
key: ${{ github.sha }}-chrome-hydrogen | |
- name: Get Extension version | |
id: package-version | |
run: | | |
PACKAGE_VERSION=$(cat ./packages/extension/package.json | jq -r '.version') | |
echo "current-version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT | |
- name: Check sourcemaps | |
run: | | |
ls -l ./packages/extension | |
if [ ! -d "./packages/extension/sourcemaps" ]; then | |
echo "No sourcemaps found" | |
exit 0 | |
fi | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
SENTRY_LOG_LEVEL: debug | |
with: | |
environment: ${{ env.SENTRY_ENVIRONMENT }} | |
sourcemaps: "./packages/extension/dist ./packages/extension/sourcemaps" | |
url_prefix: "~/" | |
version: ${{ steps.package-version.outputs.current-version }}-rc__${{ github.sha }} | |
ignore_missing: true | |
test-webwallet: | |
runs-on: ubuntu-latest | |
needs: [build-all-artifacts] | |
continue-on-error: true | |
environment: hydrogen | |
env: | |
NEXT_PUBLIC_NETWORK: "testnet" | |
NEXT_PUBLIC_RAMP_API_KEY: ${{ secrets.RAMP_API_KEY }} | |
NEXT_PUBLIC_FEATURE_COSIGNER: "true" | |
NEXT_PUBLIC_ARGENT_API_BASE_URL: ${{ vars.ARGENT_API_BASE_URL }} | |
NEXT_PUBLIC_ARGENT_TESTNET_RPC_URL: ${{ vars.ARGENT_TESTNET_RPC_URL }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
cache: "pnpm" | |
- name: Restore cached build | |
uses: actions/cache@v3 | |
with: | |
path: ./* | |
key: ${{ github.sha }} | |
- name: Build webwallet | |
run: pnpm run build:web | |
- name: Install Playwright Browsers | |
run: pnpm playwright install --with-deps | |
- name: Run tests | |
run: | | |
pnpm run --filter @argent/web start:ci & | |
sleep 10 && | |
curl http://localhost:3005 && | |
pnpm run test:e2e:webwallet | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: test-artifacts | |
path: | | |
packages/e2e/artifacts/playwright/ | |
retention-days: 5 | |
- name: Upload blob report to GitHub Actions Artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: all-blob-reports-webwallet | |
path: packages/e2e/blob-report/ | |
retention-days: 5 | |
slack_notif: | |
runs-on: ubuntu-latest | |
if: always() | |
needs: [test-unit, test-e2e, test-webwallet] | |
steps: | |
- name: Send notification to Slack | |
uses: 8398a7/[email protected] | |
with: | |
status: custom | |
custom_payload: | | |
{ | |
text: "*ArgentX* - ${{ env.BUILD_TYPE }} - ${{ env.BUILD_STATUS == 'good' && 'SUCCESS' || 'FAILED' }}", | |
attachments: [{ | |
fallback: 'fallback', | |
color: '${{ env.BUILD_STATUS }}', | |
title: 'Artifacts for testing ${{ env.BUILD_TYPE }} <${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number }}|${{ github.event.number }} ${{ github.event.pull_request.title }}>', | |
text: '<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts|Artifacts link>', | |
fields: [{},], | |
actions: [{}]}] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BUILD_TYPE: ${{ github.event_name == 'pull_request' && 'pull request' || 'develop' }} | |
BUILD_STATUS: ${{ needs.test-unit.result == 'success' && needs.test-e2e.result == 'success' && needs.test-webwallet.result == 'success' && 'good' || 'danger' }} |