Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mchappell committed May 31, 2023
0 parents commit 5a538cc
Show file tree
Hide file tree
Showing 1,926 changed files with 134,306 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
@@ -0,0 +1,13 @@
root=true

[*]
charset=utf-8
end_of_line=lf
indent_size=2
indent_style=space
insert_final_newline=true
trim_trailing_whitespace=true

[*.md]
max_line_length=off
trim_trailing_whitespace=false
6 changes: 6 additions & 0 deletions .eslintignore
@@ -0,0 +1,6 @@
.eslintrc.js
*.d.ts
*jest.config.js
dist/*
**/*.js
apps/desktop/wdio-logs/*
56 changes: 56 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,56 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['lodash'],
extends: [
'@atixlabs/eslint-config/configurations/react',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript'
],
settings: {
'import/resolver': { typescript: { project: ['packages/*/src/tsconfig.json', 'apps/*/src/tsconfig.json'] } },
// Fixes eslint not being able to detect react version
react: { pragma: 'React', fragment: 'Fragment', version: 'detect' }
},
rules: {
quotes: ['error', 'single', { avoidEscape: true }],
'new-cap': ['error', { properties: false }],
// needed for Cardano.*
'unicorn/filename-case': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/prefer-object-from-entries': 'off',
'unicorn/prefer-node-protocol': 'off',
'unicorn/no-array-for-each': 'off',
'unicorn/prefer-module': 'off',
'promise/always-return': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'no-invalid-this': 0,
'react/prop-types': 'off',
'max-len': 'off', // prettier is already handling this automatically,
'no-console': 'off', // Fine to disable here, prod webpack config strips console logs
'lodash/import-scope': ['error', 'method']
},
overrides: [
{
files: ['stories/desktop/**/*.stories.{ts,tsx}', 'stories/desktop/decorators/**'],
rules: {
'react/no-multi-comp': [0, { ignoreStateless: true }]
}
},
{
files: '**/*jest.config.js',
rules: {
'@typescript-eslint/no-var-requires': 'off'
}
},
{
// https://github.com/SonarSource/eslint-plugin-sonarjs/issues/176
files: ['**/*.{test,integration,spec}.{ts,tsx}'],
rules: {
'sonarjs/no-duplicate-string': 'off'
}
}
]
};
13 changes: 13 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
@@ -0,0 +1,13 @@
# Root Level
* @input-output-hk/lace-admins @input-output-hk/lace-tech-leads

# Packages Teams
/packages/ui @input-output-hk/lace-ui
/packages/staking @input-output-hk/lace-staking
/packages/cardano @input-output-hk/lace-core
/packages/common @input-output-hk/lace-core
/packages/core @input-output-hk/lace-core
/packages/e2e-test @input-output-hk/lace-test-engineers

# Apps
/apps @input-output-hk/lace-core
13 changes: 13 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,13 @@
version: 2
updates:

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: '00:00'
timezone: UTC
open-pull-requests-limit: 10
commit-message:
prefix: "chore"
include: "scope"
12 changes: 12 additions & 0 deletions .github/labeler.yml
@@ -0,0 +1,12 @@
# Browser extension target
browser:
- any: ['apps/browser-extension-wallet/**/*']
# Staking & Multi-delegation
staking:
- any: ['packages/staking/**/*']
# E2E targets
e2e:
- any: ['features/**/*', 'packages/e2e-tests/**/*']
# Docs targets
documentation:
- any: ['docs/**/*', '**/*.md']
21 changes: 21 additions & 0 deletions .github/pull_request_template.md
@@ -0,0 +1,21 @@
# Checklist

- [ ] JIRA - \<link>
- [ ] Proper tests implemented
- [ ] Screenshots added.

---

## Proposed solution

Explain how does this PR solves the problem stated in JIRA ticket.
You can also enumerate different alternatives considered while approaching this task.

## Testing

Describe here, how the new implementation can be tested.
Provide link or briefly describe User Acceptance Criteria/Tests that need to be met

## Screenshots

Attach screenshots here if implementation involves some UI changes
3 changes: 3 additions & 0 deletions .github/scripts/audit.sh
@@ -0,0 +1,3 @@
#!/bin/bash

yarn audit --groups dependencies --level high; [[ $? -ge 8 ]] && exit 1 || exit 0;
13 changes: 13 additions & 0 deletions .github/settings.yml
@@ -0,0 +1,13 @@
repository:
allow_merge_commit: true
allow_rebase_merge: false
allow_squash_merge: false
default_branch: main
delete_branch_on_merge: true
has_downloads: false
has_issues: true
has_projects: false
has_wiki: false
name: lace
private: true
topics: lace
29 changes: 29 additions & 0 deletions .github/shared/build/action.yml
@@ -0,0 +1,29 @@
name: Shared Build
description: Shared build config for both Chromium and Safari workflows
inputs:
LACE_EXTENSION_KEY:
description: 'Public extended manifest key'
required: true
runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Node modules cache
uses: actions/cache@v3
with:
path: |
node_modules
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
shell: bash
run: yarn install --frozen-lockfile --non-interactive --logevel=error
- name: Build dist version
shell: bash
env:
LACE_EXTENSION_KEY: ${{ inputs.LACE_EXTENSION_KEY }}
run: yarn browser build
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,40 @@
name: CI

on:
pull_request:
branches:
- main
push:
branches:
- 'release/**'

jobs:
buildAndTest:
name: Build & Test
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Decrypt test data
working-directory: ./packages/e2e-tests
run: ./decrypt_secret.sh
env:
WALLET_1_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
- name: Audit packages
run: ./.github/scripts/audit.sh
- name: Build dist version of Lace
uses: ./.github/shared/build
with:
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
- name: Check for linter issues
run: yarn lint
- name: Run unit tests
env:
AVAILABLE_CHAINS: 'Preprod,Preview,Mainnet'
DEFAULT_CHAIN: 'Preprod'
run: yarn test --maxWorkers=2
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: lace
path: apps/browser-extension-wallet/dist
139 changes: 139 additions & 0 deletions .github/workflows/e2e-tests-linux.yml
@@ -0,0 +1,139 @@
name: E2E Tests Linux

on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- 'release/**'
workflow_dispatch:
inputs:
tags:
description: 'Test scenario tags (will run all tests if empty)'
required: false
browser:
description: 'Browser to use'
required: true
default: 'chrome'
type: choice
options:
- chrome
- edge
network:
type: choice
description: network to use
options:
- preprod
- mainnet

run-name: "E2E | os: Linux | browser: ${{ github.event.inputs.browser || 'chrome' }} | tags: ${{ github.event.inputs.tags || 'empty' }} | network: ${{ github.event.inputs.network }} | #${{ github.run_number }}"

env:
TAGS: ${{ github.event.inputs.tags || 'empty' }}
BROWSER: ${{ github.event.inputs.browser || 'chrome' }}
NETWORK: ${{ github.event.inputs.network || 'preprod' }}
RUN: ${{ github.run_number }}
DISPLAY: ':99.0'

jobs:
tests:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Decrypt test data
working-directory: ./packages/e2e-tests
run: ./decrypt_secret.sh
env:
WALLET_1_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
- name: Build dist version of Lace
uses: ./.github/shared/build
with:
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
- name: Start XVFB
run: |
Xvfb :99 &
- name: Start Chrome driver
working-directory: /usr/local/share/chrome_driver
run: |
if [ ${BROWSER} == "chrome" ]; then
./chromedriver -port=4444 &
else
echo "Skipping start of ChromeDriver"
fi
- name: Start Edge driver
working-directory: /usr/local/share/edge_driver
run: |
if [ ${BROWSER} == "edge" ]; then
./msedgedriver -port=4444 &
else
echo "Skipping start of EdgeDriver"
fi
- 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 }}
ENV: ${{ env.NETWORK }}
run: |
if [ "$TAGS" == "empty" ]; then
TAGS_TO_RUN="";
else
TAGS_TO_RUN="--cucumberOpts.tagExpression=${TAGS}";
fi
./node_modules/.bin/wdio run wdio.conf.${BROWSER}.ts $TAGS_TO_RUN
- name: Create allure properties
if: always()
working-directory: ./packages/e2e-tests/reports/allure/results
run: |
pendingCount=`grep -r "@Pending" ../../../src/features | wc -l | xargs`
pending=`grep -r -h "@Pending" ../../../src/features -A 2 | grep -v -- "^--$" | sed "s/@Pending//g" | awk '{$1=$1};1' | sed "/^@/s/ /./g;/^#/s/ /./g" | xargs | sed "s/@[^ ]*/\n&/g" | sed "s/ /./"`
echo "
env=${NETWORK}
browser=${BROWSER}
tags=${TAGS}
platform=Linux
Pending.Count=${pendingCount}
@Pending.Scenarios=
${pending}
" > environment.properties
- name: Publish allure report to S3
uses: andrcuns/allure-publish-action@v1.0.1
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_ACCESS_KEY }}
with:
storageType: s3
resultsGlob: './packages/e2e-tests/reports/allure/results/*'
bucket: lightwallet
prefix: 'linux/${BROWSER}/${RUN}'
copyLatest: true
ignoreMissingResults: true
- name: Publish artifacts (logs, reports, screenshots)
uses: actions/upload-artifact@v3
if: always()
with:
name: test-artifacts
path: |
./packages/e2e-tests/screenshots
./packages/e2e-tests/logs
./packages/e2e-tests/reports
retention-days: 10
- name: Add link to summary
if: always()
run: |
echo "TEST RESULTS:"
echo "https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASSWORD }}@${{ secrets.E2E_REPORTS_URL }}/linux/${{ env.BROWSER }}/${{ env.RUN }}/index.html | tags: ${{ env.TAGS }} | browser: ${{ env.BROWSER }} | network: ${{ env.NETWORK }} | platform: linux" >> $GITHUB_STEP_SUMMARY
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2.2.0
if: always()
env:
SLACK_COLOR: ${{ job.status }}
SLACK_ICON_EMOJI: ':lace:'
SLACK_MESSAGE: 'https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASSWORD }}@${{ secrets.E2E_REPORTS_URL }}/linux/${{ env.BROWSER }}/${{ env.RUN }}/index.html | tags: ${{ env.TAGS }} | browser: ${{ env.BROWSER }} | network: ${{ env.NETWORK }} | platform: linux'
SLACK_TITLE: 'Test automation results :rocket:'
SLACK_USERNAME: lace-qa-bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

0 comments on commit 5a538cc

Please sign in to comment.