Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework CI #1097

Merged
merged 4 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Root Level
* @input-output-hk/lace-tech-leads
yarn.lock @input-output-hk/lace-core

# Packages Teams
/packages/cardano/ @input-output-hk/lace-core
/packages/common/ @input-output-hk/lace-core
/packages/core/ @input-output-hk/lace-core
/packages/e2e-tests/ @input-output-hk/lace-test-engineers
/packages/icons/ @input-output-hk/lace-core
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been missed when icons package has been created.

/packages/staking/ @input-output-hk/lace-core
/packages/ui/ @input-output-hk/lace-core

Expand Down
60 changes: 60 additions & 0 deletions .github/actions/build/app/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: buildapp
description: Build app

inputs:
DIR:
description: 'app directory'
required: true
NAME:
description: 'app name'
required: true
LACE_EXTENSION_KEY:
description: 'Public extended manifest key'
required: true
BUILD_DEV_PREVIEW:
description: 'Build developer preview of Lace'
required: false
default: 'false'
POSTHOG_PRODUCTION_TOKEN_MAINNET:
description: 'Post hog production mainnet token'
required: false
default: ''
POSTHOG_PRODUCTION_TOKEN_PREPROD:
description: 'Post hog production preprod token'
required: false
default: ''
POSTHOG_PRODUCTION_TOKEN_PREVIEW:
description: 'Post hog production preview token'
required: false
default: ''
PRODUCTION_MODE_TRACKING:
description: 'Enable analytics tracking in production'
required: false
default: 'false'

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 }}
env:
LACE_EXTENSION_KEY: ${{ inputs.LACE_EXTENSION_KEY }}
BUILD_DEV_PREVIEW: ${{ inputs.BUILD_DEV_PREVIEW }}
POSTHOG_PRODUCTION_TOKEN_MAINNET: ${{ inputs.POSTHOG_PRODUCTION_TOKEN_MAINNET }}
POSTHOG_PRODUCTION_TOKEN_PREPROD: ${{ inputs.POSTHOG_PRODUCTION_TOKEN_PREPROD }}
POSTHOG_PRODUCTION_TOKEN_PREVIEW: ${{ inputs.POSTHOG_PRODUCTION_TOKEN_PREVIEW }}
PRODUCTION_MODE_TRACKING: ${{ inputs.PRODUCTION_MODE_TRACKING }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.NAME }}
path: ${{ inputs.DIR }}/dist
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
26 changes: 26 additions & 0 deletions .github/actions/check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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 }}
42 changes: 42 additions & 0 deletions .github/actions/chromatic/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: deploy chromatic
description: Deploy storybook to Chromatic

inputs:
TOKEN:
description: 'Chromatic token'
required: true
DIR:
description: 'Package directory'
required: true
NAME:
description: 'Package name'
required: true

runs:
using: 'composite'

steps:
- name: Tests
working-directory: ./${{ inputs.DIR }}
run: yarn test-storybook:ci
shell: bash

- name: Publish to Chromatic
if: github.ref != 'refs/heads/main'
uses: chromaui/action@v1
with:
projectToken: ${{ inputs.TOKEN }}
workingDir: ./${{ inputs.DIR }}
buildScriptName: build-storybook
onlyChanged: true
exitOnceUploaded: true

- name: Publish to Chromatic and auto accept changes
if: github.ref == 'refs/heads/main'
uses: chromaui/action@v1
with:
projectToken: ${{ inputs.TOKEN }}
autoAcceptChanges: true
workingDir: ./${{ inputs.DIR }}
onlyChanged: true
exitOnceUploaded: true
35 changes: 35 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: setup and install
description: Setup Node.js and install dependencies

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

runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Node modules cache
uses: actions/cache@v4
with:
path: |
node_modules
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}

- name: Install dependencies
run: yarn install --immutable --inline-builds
shell: bash

- name: Decrypt test data
working-directory: ./packages/e2e-tests
run: ./decrypt_secret.sh
shell: bash
env:
WALLET_1_PASSWORD: ${{ inputs.WALLET_PASSWORD }}
123 changes: 123 additions & 0 deletions .github/actions/test/smoke/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
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

BRANCH:
description: 'Branch'
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
env:
DISPLAY: ${{ inputs.DISPLAY }}
run: |
Xvfb :99 &

- name: Execute e2e smoke 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 }}
TAGS: ${{ inputs.TAGS }}
BROWSER: ${{ inputs.BROWSER }}
RUN: ${{ inputs.RUN }}
DISPLAY: ${{ inputs.DISPLAY }}
BRANCH: ${{ inputs.BRANCH }}
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 "
branch=${{ inputs.BRANCH }}
browser=${{ inputs.BROWSER }}
tags=${{ inputs.TAGS }}
platform=Linux
" > environment.properties

- name: Publish allure report to S3
uses: andrcuns/[email protected]
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
14 changes: 14 additions & 0 deletions .github/actions/test/unit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: unit
description: Execute unit tests

runs:
using: 'composite'

steps:
- name: Unit tests
run: yarn test
shell: bash
env:
AVAILABLE_CHAINS: 'Preprod,Preview,Mainnet'
DEFAULT_CHAIN: 'Preprod'
NODE_OPTIONS: '--max_old_space_size=8192'
8 changes: 6 additions & 2 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ branches:
strict: false
# Required. The list of status checks to require in order to merge into this branch
checks:
- context: Build & Test
- context: block-fixup
- context: Build Staking Center
- context: Prepare
- context: Unit tests
- context: Smoke tests
mchappell marked this conversation as resolved.
Show resolved Hide resolved
- context: Chromatic Core
- context: Chromatic Staking
- context: Chromatic UI
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
enforce_admins:
# Prevent merge commits from being pushed to matching branches
Expand Down
Loading
Loading