Skip to content

Commit

Permalink
ci: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
pczeglik-iohk committed Apr 25, 2024
1 parent 12df424 commit 35bcff6
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 106 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: build
description: Build package / app
name: buildapp
description: Build app

inputs:
DIR:
description: 'package / app directory'
description: 'app directory'
required: true
NAME:
description: 'package / app name'
description: 'app name'
required: true
KEY:
description: 'manifest key'
Expand All @@ -15,21 +15,12 @@ inputs:

runs:
using: 'composite'
steps:
- name: Format check
run: yarn format-check
shell: bash
working-directory: ${{ inputs.DIR }}

steps:
- name: Code check
run: yarn lint
shell: bash
working-directory: ${{ inputs.DIR }}

- name: Type check
run: yarn type-check
shell: bash
working-directory: ${{ inputs.DIR }}
uses: ./.github/actions/check
with:
DIR: ${{ inputs.DIR }}

- name: Build ${{ inputs.NAME }}
run: yarn build
Expand Down
30 changes: 30 additions & 0 deletions .github/actions/build/package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: build
description: Build package

inputs:
DIR:
description: 'package directory'
required: true
NAME:
description: 'package name'
required: true

runs:
using: 'composite'

steps:
- name: Code check
uses: ./.github/actions/check
with:
DIR: ${{ inputs.DIR }}

- name: Build ${{ inputs.NAME }}
run: yarn build
shell: bash
working-directory: ${{ inputs.DIR }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.NAME }}
path: ${{ inputs.DIR }}/dist
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
name: lint
description: Format and lint
name: check
description: Code check

inputs:
DIR:
description: 'package directory'
required: true

runs:
using: 'composite'

steps:
- name: Format check
run: yarn format-check
shell: bash
working-directory: ${{ inputs.DIR }}

- name: Code check
run: yarn lint
shell: bash
working-directory: ${{ inputs.DIR }}

- name: Type check
run: yarn type-check
shell: bash
working-directory: ${{ inputs.DIR }}
13 changes: 0 additions & 13 deletions .github/actions/verify/action.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/chromatic-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,31 @@ jobs:
wallet-password: ${{ secrets.WALLET_PASSWORD_TESTNET }}

- name: Build icons
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/icons
NAME: packages-icons

- name: Build ui
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/ui
NAME: packages-ui

- name: Build common
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/common
NAME: packages-common

- name: Build cardano
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/cardano
NAME: packages-cardano

- name: Build core
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/core
NAME: packages-core
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/chromatic-staking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,37 @@ jobs:
wallet-password: ${{ secrets.WALLET_PASSWORD_TESTNET }}

- name: Build icons
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/icons
NAME: packages-icons

- name: Build ui
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/ui
NAME: packages-ui

- name: Build common
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/common
NAME: packages-common

- name: Build cardano
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/cardano
NAME: packages-cardano

- name: Build core
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/core
NAME: packages-core

- name: Build staking
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/staking
NAME: packages-staking
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/chromatic-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
wallet-password: ${{ secrets.WALLET_PASSWORD_TESTNET }}

- name: Build icons
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/icons
NAME: packages-icons

- name: Build ui
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/ui
NAME: packages-ui
Expand Down
84 changes: 23 additions & 61 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
DISPLAY: ':99.0'

jobs:
setup:
prepare:
name: Prepare
runs-on: ubuntu-22.04

Expand All @@ -26,45 +26,45 @@ jobs:
wallet-password: ${{ secrets.WALLET_PASSWORD_TESTNET }}

- name: Build icons
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/icons
NAME: packages-icons

- name: Build ui
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/ui
NAME: packages-ui

- name: Build common
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/common
NAME: packages-common

- name: Build cardano
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/cardano
NAME: packages-cardano

- name: Build core
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/core
NAME: packages-core

- name: Build staking
uses: ./.github/actions/build
uses: ./.github/actions/build/package
with:
DIR: packages/staking
NAME: packages-staking

unitTests:
name: Unit tests
runs-on: ubuntu-22.04
needs: setup
needs: prepare

steps:
- name: Checkout repository
Expand Down Expand Up @@ -111,13 +111,13 @@ jobs:
name: packages-staking
path: packages/staking/dist

- name: Test
uses: ./.github/actions/verify
- name: Execute unit tests
uses: ./.github/actions/test/unit

smokeTests:
name: Smoke tests
runs-on: ubuntu-22.04
needs: setup
needs: prepare

steps:
- name: Checkout repository
Expand Down Expand Up @@ -165,58 +165,20 @@ jobs:
path: packages/staking/dist

- name: Build Lace
uses: ./.github/actions/build
uses: ./.github/actions/build/app
with:
DIR: apps/browser-extension-wallet
NAME: apps-lace
NAME: browser-extension-wallet
KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}

- name: Start XVFB
run: |
Xvfb :99 &
- name: Execute E2E tests
id: e2e-tests
working-directory: ./packages/e2e-tests
env:
WALLET_1_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
TEST_DAPP_URL: ${{ secrets.TEST_DAPP_URL }}
run: yarn wdio run wdio.conf.${BROWSER}.ts --cucumberOpts.tags="@Smoke and not @Pending"

- name: Create allure properties
if: always()
working-directory: ./packages/e2e-tests/reports/allure/results
run: |
echo "
browser=${BROWSER}
tags=${TAGS}
platform=Linux
" > environment.properties
- name: Publish allure report to S3
uses: andrcuns/allure-publish-action@v2.4.0
if: always()
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.E2E_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.E2E_AWS_SECRET_ACCESS_KEY }}
- name: Execute smoke tests
uses: ./.github/actions/test/smoke
with:
storageType: s3
resultsGlob: './packages/e2e-tests/reports/allure/results'
bucket: lace-e2e-test-results
prefix: 'smoke/linux/${BROWSER}/${RUN}'
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
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
TEST_DAPP_URL: ${{ secrets.TEST_DAPP_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
E2E_AWS_ACCESS_KEY_ID: ${{ secrets.E2E_AWS_ACCESS_KEY_ID }}
E2E_AWS_SECRET_ACCESS_KEY: ${{ secrets.E2E_AWS_SECRET_ACCESS_KEY }}
E2E_REPORTS_USER: ${{ secrets.E2E_REPORTS_USER }}
E2E_REPORTS_PASSWORD: ${{ secrets.E2E_REPORTS_PASSWORD }}
E2E_REPORTS_URL: ${{ secrets.E2E_REPORTS_URL }}

0 comments on commit 35bcff6

Please sign in to comment.