Skip to content

fix(core): [lw-11146] fix circular deps in core package #6519

fix(core): [lw-11146] fix circular deps in core package

fix(core): [lw-11146] fix circular deps in core package #6519

Workflow file for this run

name: Continuous Integration
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- main
- 'release/**'
permissions:
pull-requests: write
actions: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
BUILD_ARTIFACT_NAME: 'lace-dev-${{ github.sha }}'
jobs:
prepare:
name: Prepare
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Collect Workflow Telemetry Build Packages
uses: catchpoint/workflow-telemetry-action@v2
with:
comment_on_pr: false
- name: Setup Node.js and install dependencies
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Build common
uses: ./.github/actions/build/package
with:
DIR: packages/common
NAME: packages-common
- name: Build cardano
uses: ./.github/actions/build/package
with:
DIR: packages/cardano
NAME: packages-cardano
- name: Build translation
uses: ./.github/actions/build/package
with:
DIR: packages/translation
NAME: packages-translation
- name: Build core
uses: ./.github/actions/build/package
with:
DIR: packages/core
NAME: packages-core
- name: Build staking
uses: ./.github/actions/build/package
with:
DIR: packages/staking
NAME: packages-staking
unitTests:
name: Unit tests
runs-on: ubuntu-20.04
needs: prepare
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js and install dependencies
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Download packages-common
uses: actions/download-artifact@v4
with:
name: packages-common
path: packages/common/dist
- name: Download packages-cardano
uses: actions/download-artifact@v4
with:
name: packages-cardano
path: packages/cardano/dist
- name: Download packages-translation
uses: actions/download-artifact@v4
with:
name: packages-translation
path: packages/translation/dist
- name: Download packages-core
uses: actions/download-artifact@v4
with:
name: packages-core
path: packages/core/dist
- name: Download packages-staking
uses: actions/download-artifact@v4
with:
name: packages-staking
path: packages/staking/dist
- name: Collect Workflow Telemetry Unit Tests
uses: catchpoint/workflow-telemetry-action@v2
with:
comment_on_pr: false
- name: Execute unit tests
uses: ./.github/actions/test/unit
build:
name: Build Lace
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if build exists
shell: bash
id: check-build-exists
run: |
echo "ART_NAME: $BUILD_ARTIFACT_NAME"
ART_ID=$(curl "https://api.github.com/repos/input-output-hk/lace/actions/artifacts?name=$BUILD_ARTIFACT_NAME" | jq -r .artifacts[0].id)
if ([ "$ART_ID" == "null" ]) then
echo "Lace build artifact not found. Building..."
echo "build_exists=false" >> $GITHUB_OUTPUT
else
echo "Lace build artifact found. Downloading..."
echo "build_exists=true" >> $GITHUB_OUTPUT
fi
- name: Build Lace artifact
if: steps.check-build-exists.outputs.build_exists == 'false'
uses: ./.github/shared/build
with:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
- name: Upload build artifact
if: steps.check-build-exists.outputs.build_exists == 'false'
uses: actions/upload-artifact@v4
with:
name: '${{ env.BUILD_ARTIFACT_NAME }}'
path: ./apps/browser-extension-wallet/dist
smokeTests:
name: Smoke e2e tests
runs-on: ubuntu-22.04
needs: build
strategy:
fail-fast: false
matrix:
batch: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js and install dependencies
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Download Lace build artifact
uses: actions/download-artifact@v4
with:
name: '${{ env.BUILD_ARTIFACT_NAME }}'
path: ./apps/browser-extension-wallet/dist
- name: Execute E2E tests
uses: ./.github/actions/test/e2e
with:
BATCH: ${{ matrix.batch }}
SMOKE_ONLY: true
TEST_DAPP_URL: ${{ secrets.TEST_DAPP_URL }}
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
processReports:
name: Process smoke e2e test reports
runs-on: ubuntu-22.04
needs: smokeTests
if: always()
steps:
- name: Download all smoke tests artifacts
uses: actions/download-artifact@v4
with:
path: .
pattern: 'runner-artifacts-*'
merge-multiple: true
- name: Create allure properties
shell: bash
if: always()
working-directory: ./reports/allure/results
run: |
echo "
branch=${{ github.ref_name }}
browser= 'Chrome'
tags= '@Smoke'
platform=Linux
" > environment.properties
- name: Publish allure report to S3
uses: andrcuns/allure-publish-action@v2.6.0
if: always()
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.E2E_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.E2E_AWS_SECRET_ACCESS_KEY }}
with:
storageType: s3
resultsGlob: './reports/allure/results'
bucket: lace-e2e-test-results
prefix: 'smoke/linux/chrome/${{ github.run_number }}'
copyLatest: true
ignoreMissingResults: true
updatePr: comment
baseUrl: 'https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASSWORD }}@${{ secrets.E2E_REPORTS_URL }}'
- name: Publish artifacts (logs, reports, screenshots)
uses: actions/upload-artifact@v4
if: always()
with:
name: test-artifacts
path: |
./packages/e2e-tests/screenshots
./packages/e2e-tests/logs
./packages/e2e-tests/reports
retention-days: 5
- run: |
if [[ ${{ needs.smokeTests.result }} == "success" ]]; then
exit 0
else
exit 1
fi
if-core-changed:
name: When core changed
if: ${{ github.event.pull_request.draft == false }}
runs-on: ubuntu-20.04
outputs:
requireChromaticCheck: ${{ steps.diffcheck.outputs.requireChromaticCheck }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: diffcheck
run: |
set +e
git diff --quiet ${{ github.event.pull_request.base.sha }}..${{ github.sha }} -- packages/core/**
echo "requireChromaticCheck=$?" >> "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT
set -e
chromaticCore:
name: >
Run Chromatic check: Core
runs-on: ubuntu-20.04
needs:
- prepare
- if-core-changed
steps:
- name: Checkout repository
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js and install dependencies
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Download packages-common
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-common
path: packages/common/dist
- name: Download packages-cardano
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-cardano
path: packages/cardano/dist
- name: Download packages-translation
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-translation
path: packages/translation/dist
- name: Download packages-core
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-core
path: packages/core/dist
- name: Chromatic packages-core
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: ./.github/actions/chromatic
with:
DIR: packages/core
NAME: packages-core
TOKEN: ${{ secrets.CHROMATIC_LACE_CORE_TOKEN }}
- name: Skip
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 0 }}
run: echo "Chromatic check for packages/core not needed"
exit 0
if-staking-changed:
name: When staking change
if: ${{ github.event.pull_request.draft == false }}
runs-on: ubuntu-20.04
outputs:
requireChromaticCheck: ${{ steps.diffcheck.outputs.requireChromaticCheck }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: diffcheck
run: |
set +e
git diff --quiet ${{ github.event.pull_request.base.sha }}..${{ github.sha }} -- packages/staking/**
echo "requireChromaticCheck=$?" >> "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT
set -e
chromaticStaking:
name: >
Run Chromatic check: Staking
runs-on: ubuntu-20.04
needs:
- prepare
- if-staking-changed
steps:
- name: Checkout repository
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js and install dependencies
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Download packages-common
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-common
path: packages/common/dist
- name: Download packages-cardano
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-cardano
path: packages/cardano/dist
- name: Download packages-translation
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-translation
path: packages/translation/dist
- name: Download packages-core
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-core
path: packages/core/dist
- name: Download packages-staking
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-staking
path: packages/staking/dist
- name: Chromatic packages-staking
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: ./.github/actions/chromatic
with:
DIR: packages/staking
NAME: packages-staking
TOKEN: ${{ secrets.CHROMATIC_LACE_STAKING_TOKEN }}
- name: Skip
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 0 }}
run: echo "Chromatic check for packages/staking not needed"
exit 0