Skip to content

Commit

Permalink
feat: add missing unit tests and rework CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiendan committed Feb 2, 2024
1 parent 92532b3 commit 53b1b5a
Show file tree
Hide file tree
Showing 20 changed files with 2,593 additions and 291 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/test:coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Run test coverage

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
coverage:
name: Test/Coverage
runs-on: ubuntu-latest-16-core
environment: devnet-1
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'

- name: Install npm packages
run: npm ci

- name: Run Frontend test coverage
run: npm run frontend:test:coverage
env:
VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS: ${{ vars.SUBNET_REGISTRATOR_CONTRACT_ADDRESS }}
VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS: ${{ vars.TOPOS_CORE_PROXY_CONTRACT_ADDRESS }}

- name: Run Backend test coverage
run: npm run backend:test:coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
51 changes: 31 additions & 20 deletions .github/workflows/test:e2e.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
name: Run e2e tests
name: Run tests
on:
# pull_request:
# branches:
# - main
pull_request:
branches:
- main
jobs:
e2e:
runs-on: ubuntu-latest
unit-frontend:
name: Test/Unit/Frontend
runs-on: ubuntu-latest-16-core
environment: devnet-1
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup NodeJS
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'

- name: Install dependencies
- name: Install npm packages
run: npm ci

- name: Build
run: npm run build
- name: Run Frontend unit tests
run: npm run frontend:test
env:
VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS: ${{ vars.SUBNET_REGISTRATOR_CONTRACT_ADDRESS }}
VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS: ${{ vars.TOPOS_CORE_PROXY_CONTRACT_ADDRESS }}

- name: Run E2E tests
run: npm run test:e2e
unit-backend:
name: Test/Unit/Backend
runs-on: ubuntu-latest-16-core
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Archive e2e artifacts
uses: actions/upload-artifact@v3
if: always()
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
name: e2e-artifacts
path: |
cypress/videos
cypress/screenshots
continue-on-error: true
node-version: 18
cache: 'npm'

- name: Install npm packages
run: npm ci

- name: Run Backend unit tests
run: npm run backend:test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Test coverage
**/coverage
Loading

0 comments on commit 53b1b5a

Please sign in to comment.