Skip to content

Commit

Permalink
Merge pull request #430 from marceljay/improve-actions-split
Browse files Browse the repository at this point in the history
CI: Split frontend tests from SDK workflow
  • Loading branch information
marceljay committed Oct 2, 2023
2 parents 550f936 + 90e7a4b commit 6808119
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/generic-skip.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test contracts (Generic Skip)
name: Generic Skip for [test-contracts]
# Handles skipped but required checks

on:
Expand All @@ -7,7 +7,7 @@ on:
- "packages/contracts/**"

jobs:
test:
test-contracts:
runs-on: ubuntu-latest
steps:
- run: 'echo "No tests required" '
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
name: Release SDK & UI
name: Release and test SDK & UI

env:
CI: true
FORCE_COLOR: true

on:
push:
branches: ['main', 'dev']
paths-ignore:
- 'docs/**'
- 'packages/dev-frontend/**'
- 'packages/contracts/**'
- 'README.md'
- 'LICENSE'
- 'papers/**'
- 'images/**'
pull_request:
branches: ['main', 'dev']
paths-ignore:

- 'docs/**'
- 'packages/dev-frontend/**'
- 'packages/contracts/**'
- 'README.md'
- 'LICENSE'
Expand All @@ -43,8 +46,8 @@ jobs:
echo "{publish}={false}" >> $GITHUB_OUTPUT
fi
test:
name: Run SDK, Frontend tests
test-sdk:
name: Run SDK
runs-on: ubuntu-latest
needs: workflow-setup
steps:
Expand All @@ -59,48 +62,20 @@ jobs:

- run: yarn install --frozen-lockfile
- run: yarn build
- name: Install linux deps
run: |
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
- name: Run SDK tests
run: |
yarn test:lib-base &
yarn test:lib-ethers
- name: Run e2e tests (synpress-action)
run: |
Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac &
fluxbox &
yarn test:dev-frontend
env:
SECRET_WORDS: 'test test test test test test test test test test test junk'
NETWORK_NAME: 'Localhost'
RPC_URL: 'http://127.0.0.1:8545'
CHAIN_ID: 17
SYMBOL: 'ETH'
DISPLAY: :0.0

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

# - name: Test SDK integration against live contracts
# if: ${{ github.ref == 'refs/heads/main' }}
# run: yarn test-live

release:
release-sdk:
name: Publish SDK to NPM and build Frontend image
if: needs.workflow-setup.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [ workflow-setup, test ]
needs: [ workflow-setup, test-sdk ]
steps:
- uses: actions/checkout@v4

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ env:

on:
push:
branches: ['main', 'dev']
paths:
- ".github/workflows/test-contracts.yml"
- "packages/contracts/**"
pull_request:
branches: ['main', 'dev']
paths:
- ".github/workflows/test-contracts.yml"
- "packages/contracts/**"

jobs:
test:
test-contracts:
runs-on: ubuntu-latest

# This condition checks if the pull request is not a draft
Expand All @@ -38,7 +40,7 @@ jobs:
env:
NODE_OPTIONS: --max-old-space-size=4096

coverage:
test-coverage:
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'coverage') }}
continue-on-error: true
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/test-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Test Frontend (e2e)

env:
CI: true
FORCE_COLOR: true

on:
pull_request:
branches: ['main', 'dev']
paths:
- ".github/workflows/test-frontend.yml"
- 'packages/dev-frontend/**'
- 'packages/lib-react/**'
- 'packages/lib-ethers/**'
- 'packages/providers/**'
jobs:

test-frontend:
# This condition checks if the pull request is not a draft
if: github.event.pull_request.draft == false

name: Run Frontend Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
env:
FORCE_COLOR: 0
with:
node-version: 18.17.1
cache: 'yarn'

- run: yarn install --frozen-lockfile
- run: yarn build
- name: Install linux deps
run: |
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
- name: Run e2e tests (synpress-action)
run: |
Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac &
fluxbox &
yarn test:dev-frontend
env:
SECRET_WORDS: 'test test test test test test test test test test test junk'
NETWORK_NAME: 'Localhost'
RPC_URL: 'http://127.0.0.1:8545'
CHAIN_ID: 17
SYMBOL: 'ETH'
DISPLAY: :0.0

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


0 comments on commit 6808119

Please sign in to comment.