Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

e2e: use etherscanWaitForTxSuccess + update [email protected] #440

Open
wants to merge 59 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
b92deb6
chore: nvmrc => node@14
drptbl Jul 12, 2021
9c69288
deps: [email protected]
drptbl Jul 12, 2021
19120ee
po: use etherscanWaitForTxSuccess
drptbl Jul 12, 2021
fe5cb63
e2e: use etherscanWaitForTxSuccess
drptbl Jul 12, 2021
a08fe0d
ci: add e2e tests flow back in
drptbl Jul 12, 2021
859d726
ci: use older docker container for e2e tests
drptbl Jul 12, 2021
840147d
ci: caching improvements
drptbl Jul 21, 2021
2c23716
ci: increase allocated ram for build stage
drptbl Aug 2, 2021
9b6a0a7
ci: use debian-stable instead of alpine
drptbl Aug 2, 2021
a752f71
ci: add --max_old_space_size=7168
drptbl Aug 2, 2021
66fc41b
ci: use alpine img
drptbl Aug 2, 2021
37caae1
ci: fix cache permissions
drptbl Aug 2, 2021
097b2b7
ci: fix cache permissions
drptbl Aug 2, 2021
6b834af
ci: remove permission error fix
drptbl Aug 2, 2021
ef62a8b
ci: switch to debian-stable
drptbl Aug 2, 2021
4a05d58
ci: add --cache
drptbl Aug 3, 2021
0089454
ci: specify docker user
drptbl Aug 3, 2021
e983f5a
ci: ignore-scripts
drptbl Aug 3, 2021
d008395
ci: get rid of husky
drptbl Aug 3, 2021
59db3af
ci: dont ignore scripts
drptbl Aug 3, 2021
6ca7be6
Revert "ci: dont ignore scripts"
drptbl Aug 3, 2021
7517157
Revert "ci: get rid of husky"
drptbl Aug 3, 2021
c9e73b8
ci: unsafe-perm
drptbl Aug 3, 2021
591f03d
ci: dump debug logs
drptbl Aug 3, 2021
3434319
ci: add caching path
drptbl Aug 3, 2021
3e9030f
ci: update logs path
drptbl Aug 3, 2021
8456d3d
ci: try npm with sudo
drptbl Aug 3, 2021
50e0eb2
ci: remove sudo
drptbl Aug 3, 2021
8e45f00
ci: print node/npm versions
drptbl Aug 3, 2021
97830ec
ci: clean cache
drptbl Aug 3, 2021
5603939
chore: chown
drptbl Aug 3, 2021
ac53835
ci: continue on error
drptbl Aug 3, 2021
c14258d
ci: update containers
drptbl Aug 9, 2021
3188192
ci: update node and npm
drptbl Aug 9, 2021
f06ab60
ci: add NODE_OPTIONS
drptbl Aug 9, 2021
8b67861
ci: add caching and improve npm i
drptbl Aug 10, 2021
52c5df6
ci: set npm-cache path
drptbl Aug 10, 2021
437c737
fix: cache path
drptbl Aug 10, 2021
3f2b201
ci: try not to chown
drptbl Aug 10, 2021
1b6df15
ci: try not to chown
drptbl Aug 10, 2021
084d083
test: run e2e
drptbl Aug 10, 2021
a798ed2
ci: chown
drptbl Aug 10, 2021
8c63516
test: e2e
drptbl Aug 10, 2021
29288c3
ci: test e2e
drptbl Aug 10, 2021
f262132
ci: caching improvements
drptbl Aug 10, 2021
c099e13
ci: install optional deps
drptbl Aug 10, 2021
983567e
e2e: wait for rates request before test starts
drptbl Aug 23, 2021
6034115
deps: [email protected]
drptbl Aug 23, 2021
a320103
merge dev to fix-e2e
drptbl Aug 23, 2021
0de4746
chore: add data-testid's for notifications
drptbl Aug 23, 2021
ee1bc7f
e2e: getTransactionUrl => getTransactionId
drptbl Aug 24, 2021
4a2210a
po: fix for notifications
drptbl Aug 24, 2021
ca6e8d9
e2e: getTransactionUrl => getTransactionId
drptbl Aug 24, 2021
adb540b
ci: fix caching
drptbl Aug 25, 2021
8a4b62f
chore: ignore cache folder
drptbl Aug 29, 2021
e913be9
e2e: remove unnecessary intercepts
drptbl Sep 3, 2021
638f604
ci: pass ETHERSCAN_KEY
drptbl Sep 3, 2021
03b5529
deps: synpress bump
drptbl Sep 3, 2021
cb87114
chore: synpress update
drptbl Sep 3, 2021
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
148 changes: 126 additions & 22 deletions .github/workflows/audit_build_verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ on:
jobs:
audit:
# run only on master/dev branch and pull requests
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
# if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
if: always()
runs-on: ubuntu-latest

container:
image: ghcr.io/synthetixio/docker-sec-tools/base:14.17
image: ghcr.io/synthetixio/docker-sec-tools/alpine:14.17
credentials:
username: synthetixio
password: ${{ secrets.GH_PACKAGES_READ_ONLY }}
Expand All @@ -30,42 +31,55 @@ jobs:
build:
needs: audit
# run only on audit success or audit skipped
if: always() && (needs.audit.result == 'success' || needs.audit.result == 'skipped')
# if: always() && (needs.audit.result == 'success' || needs.audit.result == 'skipped')
if: always()
runs-on: ubuntu-latest

container:
image: ghcr.io/synthetixio/docker-node/alpine:14.17
credentials:
username: synthetixio
password: ${{ secrets.GH_PACKAGES_READ_ONLY }}
options: --shm-size=7gb

steps:
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2

- name: Cache node modules
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
with:
path: ~/.npm
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-cache-
- name: Set npm cache directory
run: npm config set cache .npm-cache --global
continue-on-error: true

- name: Building on Node.js ${{ matrix.node-version }} 🛠️
uses: actions/setup-node@v2
- uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
with:
node-version: '14.17.1'
path: |
.npm-cache
node_modules
key: ${{ runner.os }}-alpine-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-alpine-node-
continue-on-error: true

- name: npm update
run: npm install -g [email protected]
# fixes permission issues on docker+npm@7
- name: Chown workspace
run: chown -R $(whoami) .

- name: Install dependencies
run: npm ci --no-audit --legacy-peer-deps
run: npm install --prefer-offline --no-audit
env:
NODE_OPTIONS: --max_old_space_size=7168

- name: Lint
# run only on master/dev branch and pull requests
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
# if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
if: always()
run: npm run lint:sarif

- name: Upload lint results
# run if lint failed and only on master/dev branch and pull requests
if: always() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request')
uses: github/codeql-action/upload-sarif@33f3438c1d59883f5e769fdf2b6adb6794d91d0f # pin@codeql-bundle-20210517
# if: always() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request')
if: always()
uses: github/codeql-action/upload-sarif@21830ef0c1f0f06f2d82ba3f1f07cb3ffe543ed7 # pin@codeql-bundle-20210517
with:
sarif_file: lint-results.sarif
continue-on-error: true
Expand All @@ -74,9 +88,9 @@ jobs:
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
with:
path: .next/cache
key: ${{ runner.os }}-next.js-cache-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-alpine-next-cache-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-next.js-cache-
${{ runner.os }}-alpine-next-cache-
continue-on-error: true

- name: Build
Expand All @@ -86,8 +100,98 @@ jobs:
run: tar -zcvf build.tar.gz .next

- name: Archive build
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
# if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
if: always()
uses: actions/upload-artifact@27121b0bdffd731efa15d66772be8dc71245d074 # pin@v2
with:
name: build
path: build.tar.gz

e2e:
needs: build
# run only on master/dev branch
# if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
if: always()
runs-on: ubuntu-latest
strategy:
# when one test fails, DO NOT cancel the other containers, because this will kill Cypress processes leaving the Dashboard hanging
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
containers: [1, 2]

container:
image: ghcr.io/synthetixio/docker-e2e/ubuntu:14.17
credentials:
username: synthetixio
password: ${{ secrets.GH_PACKAGES_READ_ONLY }}
options: --shm-size=7gb

steps:
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2

- name: Set npm cache directory
run: npm config set cache .npm-cache --global
continue-on-error: true

- uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
with:
path: |
.npm-cache
node_modules
key: ${{ runner.os }}-ubuntu-e2e-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-ubuntu-e2e-
continue-on-error: true

# fixes permission issues on docker+npm@7
- name: Chown workspace
run: chown -R $(whoami) .

- name: Install dependencies
run: npm install --prefer-offline --no-audit
env:
NODE_OPTIONS: --max_old_space_size=7168
CYPRESS_CACHE_FOLDER: node_modules/.cache/Cypress

- name: Set deployment url
shell: bash
run: |
if [ ${{ github.event_name }} == pull_request ]
then
export BRANCH_NAME=$(echo ${GITHUB_HEAD_REF#refs/heads/} | sed -e 's/\//-/g')
echo "BASE_URL=https://${{ secrets.VERCEL_PREFIX }}-$BRANCH_NAME-${{ secrets.VERCEL_DOMAIN }}" >> $GITHUB_ENV
else
export BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed -e 's/\//-/g')
echo "BASE_URL=https://${{ secrets.VERCEL_PREFIX }}-$BRANCH_NAME-${{ secrets.VERCEL_DOMAIN }}" >> $GITHUB_ENV
fi

- name: Download build
uses: actions/download-artifact@3be87be14a055c47b01d3bd88f8fe02320a9bb60 # pin@v2
with:
name: build

- name: Extract build
run: tar -xf build.tar.gz

- name: Run e2e tests
run: npm run test:e2e:ci
env:
SECRET_WORDS: ${{ secrets.SECRET_WORDS }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_CACHE_FOLDER: node_modules/.cache/Cypress

- name: Archive e2e artifacts
uses: actions/upload-artifact@27121b0bdffd731efa15d66772be8dc71245d074 # pin@v2
if: always()
with:
name: e2e-artifacts
path: |
tests/e2e/videos
tests/e2e/screenshots
continue-on-error: true
2 changes: 1 addition & 1 deletion .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

container:
image: ghcr.io/synthetixio/docker-e2e/base:12.20
image: ghcr.io/synthetixio/docker-e2e/ubuntu:14.17
credentials:
username: synthetixio
password: ${{ secrets.GH_PACKAGES_READ_ONLY }}
Expand Down
49 changes: 41 additions & 8 deletions .github/workflows/updateDependency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,50 @@ jobs:
update_version:
name: Update contracts-interface version
runs-on: ubuntu-latest

container:
image: ghcr.io/synthetixio/docker-sec-tools/alpine:14.17
credentials:
username: synthetixio
password: ${{ secrets.GH_PACKAGES_READ_ONLY }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2

- name: Set npm cache directory
run: npm config set cache ${{ github.workspace }}/.npm-cache --global
continue-on-error: true

- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
continue-on-error: true

- uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
id: npm-cache
with:
node-version: '14.17.1'
- name: npm update
run: npm install -g [email protected]
path: |
${{ steps.npm-cache-dir.outputs.dir }}
${{ github.workspace }}/node_modules
key: ${{ runner.os }}-alpine-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-alpine-node-
continue-on-error: true

# fixes permission issues on docker+npm@7
- name: Chown workspace
run: chown -R $(whoami) .

- name: Install dependencies
run: npm install --prefer-offline --no-audit
env:
NODE_OPTIONS: --max_old_space_size=7168

- name: Update @synthetixio/contracts-interface dependency
run: |
npm install --legacy-peer-deps
npm install @synthetixio/contracts-interface@${{ github.event.client_payload.version }} --save-exact
run: npm install @synthetixio/contracts-interface@${{ github.event.client_payload.version }} --save-exact

- name: Commit changes
run: |
git config --global user.email "[email protected]" && git config --global user.name "Synthetix Team"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/node_modules
/.pnp
.pnp.js
.npm-cache

# testing
/coverage
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.17.1
14
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ENS link: [kwenta.eth](https://app.ens.domains/name/kwenta.eth).
### Install dependencies

```bash
npm i
npm i --legacy-peer-deps
```

### Set up environment variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type NotificationProps = {

const NotificationPending = () => {
return (
<NotificationContainer>
<NotificationContainer data-testid="notification-pending">
<IconContainer>
<StyledImg width={25} src={Spinner} />
</IconContainer>
Expand All @@ -26,7 +26,7 @@ const NotificationPending = () => {

const NotificationSuccess = () => {
return (
<NotificationContainer>
<NotificationContainer data-testid="notification-success">
<IconContainer>
<StyledImg width={35} src={Success} />
</IconContainer>
Expand All @@ -37,7 +37,7 @@ const NotificationSuccess = () => {

const NotificationError = ({ failureReason }: NotificationProps) => {
return (
<NotificationContainer>
<NotificationContainer data-testid="notification-error">
<IconContainer>
<StyledImg width={35} src={Failure} />
</IconContainer>
Expand Down
Loading