Skip to content

Commit

Permalink
Merge branch 'main' into display-fees-original-transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Comont committed Jul 21, 2023
2 parents 73c8254 + e33d9cd commit 79b7f60
Show file tree
Hide file tree
Showing 192 changed files with 19,839 additions and 8,209 deletions.
35 changes: 35 additions & 0 deletions .env.e2e.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Env
NODE_ENV="test"
LOG_LEVEL="error"

# APIs
PARTNER_ADMIN_API_URL="https://api.swan.io/sandbox-partner-admin/graphql"
PARTNER_API_URL="https://api.swan.io/sandbox-partner/graphql"
UNAUTHENTICATED_API_URL="https://api.swan.io/sandbox-unauthenticated/graphql"

OAUTH_SERVER_URL="https://oauth.swan.io"
OAUTH_CLIENT_ID="" # Your E2E project client ID
OAUTH_CLIENT_SECRET="" # Your E2E project client secret

# Key to encrypt cookies
COOKIE_KEY="" # Your cookie key

# URLs to expose your interfaces on
BANKING_URL="http://banking.swan.localhost:8080"
ONBOARDING_URL="http://onboarding.swan.localhost:8080"

# Extra keys for the client
CLIENT_GOOGLE_MAPS_API_KEY="" # Your google maps API key

TEST_KEY=""

# You E2E user credentials
PHONE_NUMBER=""
PASSCODE=""

SANDBOX_USER_BENADY_ID=""
SANDBOX_USER_SAISON_ID=""

TWILIO_ACCOUNT_ID=""
TWILIO_AUTH_TOKEN=""
WEBHOOK_SITE_API_KEY=""
13 changes: 9 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@ NODE_ENV="development"
LOG_LEVEL="error"

# APIs
PARTNER_ADMIN_API_URL="https://api.swan.io/sandbox-partner-admin/graphql"
PARTNER_API_URL="https://api.swan.io/sandbox-partner/graphql"
UNAUTHENTICATED_API_URL="https://api.swan.io/sandbox-unauthenticated/graphql"

OAUTH_SERVER_URL="https://oauth.swan.io"
OAUTH_CLIENT_ID="YOUR_CLIENT_ID"
OAUTH_CLIENT_SECRET="YOUR_CLIENT_SECRET"
OAUTH_CLIENT_ID="" # Your client ID
OAUTH_CLIENT_SECRET="" # Your client secret

# Key to encrypt cookies
COOKIE_KEY="YOUR_COOKIE_KEY"
COOKIE_KEY="" # Your cookie key

# URLs to expose your interfaces on
BANKING_URL="https://banking.swan.local:8080"
ONBOARDING_URL="https://onboarding.swan.local:8080"

# Extra keys for the client
CLIENT_GOOGLE_MAPS_API_KEY="YOUR_GOOGLE_MAPS_API_KEY"
CLIENT_GOOGLE_MAPS_API_KEY="" # Your google maps API key

# API key for automated translations
OPENAI_API_KEY=""
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.d.ts
**/*.js
**/*.mjs
*.d.ts
clients/**/graphql/*.ts
docs/
docs/
playwright.config.ts
54 changes: 31 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
name: Build & test
name: Test & build

on:
push:
branches:
- "*"

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
test:
name: Build & test
test-and-build:
name: Test & build
runs-on: ubuntu-latest
permissions:
contents: read # This is required for actions/checkout
id-token: write # This is required for requesting the JWT
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
node-version: lts/*
cache: yarn

- name: Install dependencies
run: yarn
run: yarn install --pure-lockfile

- name: Check licenses
run: yarn license-check

- name: GraphQL Codegen
run: yarn graphql-codegen
Expand All @@ -35,43 +39,47 @@ jobs:
run: yarn test

- name: Compile project
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: yarn build

- name: Push translation keys
if: "github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref)"
run: yarn lokalise sync
env:
LOKALISE_API_KEY: ${{ secrets.LOKALISE_API_KEY }}
- name: Push onboarding translation keys
if: ${{ github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref) }}
run: yarn localazy upload onboarding -r ${{ secrets.LOCALAZY_ONBOARDING_READ_KEY }} -w ${{ secrets.LOCALAZY_ONBOARDING_WRITE_KEY }}

- name: Push banking translation keys
if: ${{ github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref)}}
run: yarn localazy upload banking -r ${{ secrets.LOCALAZY_BANKING_READ_KEY }} -w ${{ secrets.LOCALAZY_BANKING_WRITE_KEY }}

- name: Configure AWS Credentials
if: "github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref) || contains(github.event.head_commit.message, '[dockerize]')"
if: ${{ github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref) || contains(github.event.head_commit.message, '[dockerize]')}}
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: eu-west-1

- name: Login to Docker Registry
if: "github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref) || contains(github.event.head_commit.message, '[dockerize]')"
if: ${{ github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref) || contains(github.event.head_commit.message, '[dockerize]') }}
uses: docker/login-action@v2
with:
registry: ${{ secrets.DOCKER_REGISTRY }}

- name: Dockerize & Push to Registry
if: "github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref) || contains(github.event.head_commit.message, '[dockerize]')"
if: ${{ github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref) || contains(github.event.head_commit.message, '[dockerize]') }}
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-swan
push: true
tags: |
${{ secrets.DOCKER_REGISTRY }}/swan-partner-frontend:${{ github.sha }}
${{ secrets.DOCKER_REGISTRY }}/swan-partner-frontend:${{ github.ref_name }}
${{ secrets.DOCKER_REGISTRY }}/swan-partner-frontend:master-${{ github.sha }}
${{ secrets.DOCKER_REGISTRY }}/swan-partner-frontend:master-${{ github.ref_name }}
- name: Deploy
if: "github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref)"
if: ${{ github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref) }}
run: yarn deploy-ci
env:
TAG: ${{ github.sha }}
TAG: master-${{ github.sha }}
DEPLOY_SWAN_TOKEN: ${{ secrets.DEPLOY_SWAN_TOKEN }}
DEPLOY_SWAN_REPOSITORY: ${{ secrets.DEPLOY_SWAN_REPOSITORY }}
DEPLOY_GIT_USER: ${{ secrets.DEPLOY_GIT_USER }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
name: Docs
name: Build docs

on:
push:
branches:
- "main"

jobs:
test:
name: Build & test
docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
node-version: lts/*
cache: yarn

- name: Install & build
run: cd docs && yarn && yarn build
run: cd docs && yarn install --pure-lockfile && yarn build

- name: Deploy
if: "contains('refs/heads/main', github.ref)"
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/download-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Download translations

on:
schedule:
- cron: "0 0 * * *" # every day at midnight

permissions:
contents: write
pull-requests: write

jobs:
download-translations:
name: Download translations
runs-on: ubuntu-latest
permissions:
contents: read # This is required for actions/checkout

steps:
- uses: actions/checkout@v3

- name: Download onboarding translation keys
uses: localazy/download@v1
with:
read_key: ${{ secrets.LOCALAZY_ONBOARDING_READ_KEY }}
write_key: ${{ secrets.LOCALAZY_ONBOARDING_WRITE_KEY }}
groups: onboarding

- name: Download banking translation keys
uses: localazy/download@v1
with:
read_key: ${{ secrets.LOCALAZY_BANKING_READ_KEY }}
write_key: ${{ secrets.LOCALAZY_BANKING_WRITE_KEY }}
groups: banking

- uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.CREATE_PR_TOKEN }}
title: Update translations
branch: update-translations
commit-message: update translations from localazy
body: Update translations
80 changes: 80 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: E2E tests

on:
push:
branches: ["*"]

jobs:
test:
name: E2E tests
runs-on: ubuntu-latest
timeout-minutes: 60
if: ${{ github.repository == 'swan-io/swan-partner-frontend' && contains('refs/heads/main', github.ref) || contains(github.event.head_commit.message, '[E2E]') }}
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn

- name: Edit /etc/hosts
run: |
sudo echo "127.0.0.1 banking.swan.localhost" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 onboarding.swan.localhost" | sudo tee -a /etc/hosts
- name: Write .env.e2e file
run: |
echo "NODE_ENV=test" > .env.e2e
echo "LOG_LEVEL=error" >> .env.e2e
echo "PARTNER_ADMIN_API_URL=${{ secrets.E2E_PARTNER_ADMIN_API_URL }}" >> .env.e2e
echo "PARTNER_API_URL=${{ secrets.E2E_PARTNER_API_URL }}" >> .env.e2e
echo "UNAUTHENTICATED_API_URL=${{ secrets.E2E_UNAUTHENTICATED_API_URL }}" >> .env.e2e
echo "OAUTH_SERVER_URL=${{ secrets.E2E_OAUTH_SERVER_URL }}" >> .env.e2e
echo "OAUTH_CLIENT_ID=${{ secrets.E2E_OAUTH_CLIENT_ID }}" >> .env.e2e
echo "OAUTH_CLIENT_SECRET=${{ secrets.E2E_OAUTH_CLIENT_SECRET }}" >> .env.e2e
echo "COOKIE_KEY=${{ secrets.E2E_COOKIE_KEY }}" >> .env.e2e
echo "BANKING_URL=http://banking.swan.localhost:8080" >> .env.e2e
echo "ONBOARDING_URL=http://onboarding.swan.localhost:8080" >> .env.e2e
echo "CLIENT_GOOGLE_MAPS_API_KEY=${{ secrets.E2E_GOOGLE_MAPS_API_KEY }}" >> .env.e2e
echo "TEST_KEY=${{ secrets.E2E_TEST_KEY }}" >> .env.e2e
echo "PHONE_NUMBER=${{ secrets.E2E_PHONE_NUMBER }}" >> .env.e2e
echo "PASSCODE=${{ secrets.E2E_PASSCODE }}" >> .env.e2e
echo "SANDBOX_USER_BENADY_ID=${{ secrets.E2E_SANDBOX_USER_BENADY_ID }}" >> .env.e2e
echo "SANDBOX_USER_SAISON_ID=${{ secrets.E2E_SANDBOX_USER_SAISON_ID }}" >> .env.e2e
echo "TWILIO_ACCOUNT_ID=${{ secrets.E2E_TWILIO_ACCOUNT_ID }}" >> .env.e2e
echo "TWILIO_AUTH_TOKEN=${{ secrets.E2E_TWILIO_AUTH_TOKEN }}" >> .env.e2e
echo "WEBHOOK_SITE_API_KEY=${{ secrets.E2E_WEBHOOK_SITE_API_KEY }}" >> .env.e2e
- name: Install dependencies
run: yarn install --pure-lockfile

- name: Get playwright version
run: |
PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//')
echo "Playwright version: $PLAYWRIGHT_VERSION"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache playwright
id: cache-playwright
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: playwright-${{ env.PLAYWRIGHT_VERSION }}

- name: Setup playwright
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: yarn playwright install --with-deps

- name: GraphQL Codegen
run: yarn graphql-codegen

- name: Run E2E tests
run: CI=true yarn test-e2e

- uses: actions/upload-artifact@v3
if: failure()
with:
name: tests-results
path: tests/results/
retention-days: 7
Loading

0 comments on commit 79b7f60

Please sign in to comment.