Skip to content

Commit

Permalink
Merge pull request #649 from Synthetixio/dev
Browse files Browse the repository at this point in the history
promote dev to master
  • Loading branch information
drptbl authored Mar 6, 2023
2 parents 76c959e + abd2dde commit 68a5fbb
Show file tree
Hide file tree
Showing 30 changed files with 1,570 additions and 483 deletions.
75 changes: 5 additions & 70 deletions .github/workflows/audit_and_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ on:
branches: [master, dev]

concurrency:
group: ${{ github.head_ref || github.run_id }}
group:
'${{ github.workflow }} @ ${{ github.event.pull_request.head.label ||
github.head_ref || github.ref }}'
cancel-in-progress: true

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'
Expand All @@ -36,7 +37,6 @@ jobs:

build:
needs: audit
# run only on audit success or audit skipped
if:
always() && (needs.audit.result == 'success' || needs.audit.result ==
'skipped')
Expand All @@ -53,7 +53,7 @@ jobs:
run: yarn config set cache-folder .yarn-cache
continue-on-error: true

- uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # pin@v2
- uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # pin@v2
with:
path: |
.yarn-cache
Expand All @@ -67,81 +67,16 @@ jobs:
run: yarn --frozen-lockfile --prefer-offline --no-audit

- 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'
run: yarn 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@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # pin@codeql-bundle-20210517
uses: github/codeql-action/upload-sarif@32dc499307d133bb5085bae78498c0ac2cf762d5 # pin@codeql-bundle-20210517
with:
sarif_file: lint-results.sarif
continue-on-error: true

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'
runs-on: ubuntu-latest
strategy:
matrix:
resolution: ['low', 'medium', 'high']

steps:
- name: Chown workspace
run: chown -R $(whoami) .

- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # pin@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # pin@v1

- name: Cache Docker layers
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # pin@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Run e2e tests (${{ matrix.resolution }} res)
run: |
docker-compose -f docker-compose.ci.yml --env-file ${{ matrix.resolution }}-res.env --profile foundry up --build --exit-code-from synpress
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
DOCKER_DEFAULT_PLATFORM: linux/amd64
NGROK_AUTH: ${{ secrets.NGROK_AUTH }}
CYPRESS_PRIVATE_KEY_WITH_FUNDS:
${{ secrets.CYPRESS_PRIVATE_KEY_WITH_FUNDS }}
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_USERNAME: ${{ secrets.GH_USERNAME }}
# cypress dashboard
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}

- name: Archive e2e artifacts (${{ matrix.resolution }} res)
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@v2
if: always()
with:
name: e2e-artifacts-${{ matrix.resolution }}-res
path: |
docker/videos
docker/videos-ci
docker/screenshots
continue-on-error: true
10 changes: 8 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
schedule:
- cron: '0 6 * * 3'

concurrency:
group:
'${{ github.workflow }} @ ${{ github.event.pull_request.head.label ||
github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
analyze:
runs-on: ubuntu-latest
Expand All @@ -17,10 +23,10 @@ jobs:
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@17573ee1cc1b9d061760f3a006fc4aac4f944fd5
uses: github/codeql-action/init@32dc499307d133bb5085bae78498c0ac2cf762d5
with:
queries: security-and-quality
languages: javascript

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@17573ee1cc1b9d061760f3a006fc4aac4f944fd5
uses: github/codeql-action/analyze@32dc499307d133bb5085bae78498c0ac2cf762d5
86 changes: 86 additions & 0 deletions .github/workflows/disabled/e2e_headless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# https://developer.chrome.com/articles/new-headless/
# warning: sadly, notification of metamask is blank on UNIX which is a blocker to run headless mode on CI

name: E2E (headless)

on:
push:
pull_request:
branches: [master, dev]

concurrency:
group:
'${{ github.workflow }} @ ${{ github.event.pull_request.head.label ||
github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
e2e:
if:
github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' ||
github.event_name == 'pull_request'
runs-on: ubuntu-latest

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

- name: Run anvil
run: |
docker-compose -f docker-compose.ci.yml --profile foundry up --build --detach
env:
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}

- name: Set yarn cache directory
run: yarn config set cache-folder .yarn-cache
continue-on-error: true

- uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # pin@v2
with:
path: |
.yarn-cache
node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-yarn-v1-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-v1-
continue-on-error: true

- name: Install dependencies
run: yarn --frozen-lockfile --prefer-offline --no-audit

- name: Install linux deps
run: |
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
# headless mode needs chrome v112 to work, currently gh actions comes with chrome v110
# after gh actions default chrome is v112, this step may be removed
- name: Update Chrome version
uses: browser-actions/setup-chrome@cf2b0c420c6c1fa44af1daf4e0e4dd5880d52e18 # [email protected]
with:
chrome-version: dev

- name: Run e2e tests (headless)
run: |
Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac &
fluxbox &
yarn test:e2e:headless:anvil
env:
NGROK_AUTH: ${{ secrets.NGROK_AUTH }}
CYPRESS_PRIVATE_KEY_WITH_FUNDS:
${{ secrets.CYPRESS_PRIVATE_KEY_WITH_FUNDS }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_USERNAME: ${{ secrets.GH_USERNAME }}
DISPLAY: :0.0

- name: Archive e2e artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@v2
if: always()
with:
name: e2e-artifacts
path: |
tests/e2e/videos
tests/e2e/screenshots
continue-on-error: true
86 changes: 86 additions & 0 deletions .github/workflows/e2e_cypress-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: E2E (cypress-action)

on:
push:
pull_request:
branches: [master, dev]

concurrency:
group:
'${{ github.workflow }} @ ${{ github.event.pull_request.head.label ||
github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
e2e:
if:
github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' ||
github.event_name == 'pull_request'
runs-on: ubuntu-latest

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

- name: Run anvil
run: |
docker-compose -f docker-compose.ci.yml --profile foundry up --build --detach
env:
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}

- name: Set yarn cache directory
run: yarn config set cache-folder .yarn-cache
continue-on-error: true

- uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # pin@v2
with:
path: |
.yarn-cache
node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-yarn-v1-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-v1-
continue-on-error: true

- name: Install dependencies
run: yarn --frozen-lockfile --prefer-offline --no-audit

- name: Install linux deps
run: |
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
- name: Run xvfb and fluxbox
run: |
Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac &
fluxbox &
env:
DISPLAY: :0.0

- name: Run e2e tests (cypress-action)
uses: cypress-io/github-action@cdbbcd60fb5d967d7a37d8eb148add76a7ded7b6 # [email protected]
with:
start: yarn start:server
command: yarn test:e2e:ci:cypress-action
wait-on: 'http://localhost:3000'
wait-on-timeout: 120
browser: chrome
spec: tests/e2e/specs/*
env:
CYPRESS_PRIVATE_KEY_WITH_FUNDS:
${{ secrets.CYPRESS_PRIVATE_KEY_WITH_FUNDS }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_USERNAME: ${{ secrets.GH_USERNAME }}
DISPLAY: :0.0

- name: Archive e2e artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@v2
if: always()
with:
name: e2e-artifacts
path: |
tests/e2e/videos
tests/e2e/screenshots
continue-on-error: true
Loading

0 comments on commit 68a5fbb

Please sign in to comment.