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 0a860c1
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 89 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,6 +15,7 @@ inputs:

runs:
using: 'composite'

steps:
- name: Format check
run: yarn format-check
Expand Down
40 changes: 40 additions & 0 deletions .github/actions/build/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build
description: Build package

inputs:
DIR:
description: 'package directory'
required: true
NAME:
description: 'package name'
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 }}

- 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
16 changes: 0 additions & 16 deletions .github/actions/lint/action.yml

This file was deleted.

95 changes: 95 additions & 0 deletions .github/actions/test/smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: smoketests
description: Execute e2e smoke tests

inputs:
WALLET_PASSWORD:
description: 'Test wallet password'
required: true

TEST_DAPP_URL:
description: 'Test DApp Url'
required: true

GITHUB_TOKEN:
description: 'Github token'
required: true

E2E_AWS_ACCESS_KEY_ID:
description: 'AWS access key id'
required: true

E2E_AWS_SECRET_ACCESS_KEY:
description: 'AWS secret access key'
required: true

E2E_REPORTS_USER:
description: 'E2E reports user'
required: true

E2E_REPORTS_PASSWORD:
description: 'E2E reports password'
required: true

E2E_REPORTS_URL:
description: 'E2E reports url'
required: true

env:
TAGS: '@Smoke and @Testnet'
BROWSER: 'chrome'
RUN: ${{ github.run_number }}
DISPLAY: ':99.0'

runs:
using: 'composite'

steps:
- name: Start XVFB
run: |
Xvfb :99 &
- name: Execute E2E tests
id: e2e-tests
working-directory: ./packages/e2e-tests
env:
WALLET_1_PASSWORD: ${{ inputs.WALLET_PASSWORD }}
TEST_DAPP_URL: ${{ inputs.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: ${{ inputs.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ inputs.E2E_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.E2E_AWS_SECRET_ACCESS_KEY }}
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://${{ inputs.E2E_REPORTS_USER }}:${{ inputs.E2E_REPORTS_PASSWORD }}@${{ inputs.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
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: test
description: Execute tests
name: unittests
description: Execute unit tests

runs:
using: 'composite'

steps:
- name: Unit tests
run: yarn test --runInBand --silent
Expand Down
90 changes: 23 additions & 67 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ name: Pull Request
on:
pull_request:

env:
TAGS: '@Smoke and @Testnet'
BROWSER: 'chrome'
RUN: ${{ github.run_number }}
DISPLAY: ':99.0'

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

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

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

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

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

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

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

- name: Build staking
uses: ./.github/actions/build
uses: ./.github/actions/build/package.yml
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 +105,13 @@ jobs:
name: packages-staking
path: packages/staking/dist

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

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

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

- name: Build Lace
uses: ./.github/actions/build
uses: ./.github/actions/build/app.yml
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.yml
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 0a860c1

Please sign in to comment.