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 10b70d7
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 101 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 }}
111 changes: 111 additions & 0 deletions .github/actions/test/smoke/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: smoke
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

RUN:
description: 'Runner number'
required: true

TAGS:
description: 'tags'
required: false
default: '@Smoke and @Testnet'

BROWSER:
description: 'browser'
required: false
default: 'chrome'

DISPLAY:
description: ''
required: false
default: ':99.0'

runs:
using: 'composite'

steps:
- name: Start XVFB
shell: bash
run: |
Xvfb :99 &
- name: Execute E2E tests
shell: bash
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.${{ inputs.BROWSER }}.ts --cucumberOpts.tags="@Smoke and not @Pending"

- name: Create allure properties
shell: bash
if: always()
working-directory: ./packages/e2e-tests/reports/allure/results
run: |
echo "
browser=${{ inputs.BROWSER }}
tags=${{ inputs.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/${{ inputs.BROWSER }}/${{ inputs.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: unit
description: Execute unit tests

runs:
using: 'composite'

steps:
- name: Unit tests
run: yarn test --runInBand --silent
Expand Down
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

0 comments on commit 10b70d7

Please sign in to comment.