Skip to content

Feat/publish docs

Feat/publish docs #120

Workflow file for this run

name: Unit Testing
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
run-coverage-shards:
name: Run Coverage for Shards
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [shard1, shard2, shard3]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use Node v20
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Compile contracts
run: yarn compile
- name: Set Shard Environment Variable
run: echo "SHARD=${{ matrix.shard }}" >> $GITHUB_ENV
- name: Run Coverage for ${{ matrix.shard }}
run: yarn test:coverage:solidity
- name: Upload Coverage for ${{ matrix.shard }}
uses: actions/upload-artifact@v3
with:
name: coverage-${{ matrix.shard }}
path: coverage/coverage-final.json
combine-coverage:
name: Combine Coverage Reports
runs-on: ubuntu-latest
needs: run-coverage-shards
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Download All Coverage Artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for shard in shard1 shard2 shard3; do
echo "Downloading artifact coverage-$shard"
mkdir -p coverage-shards/$shard
gh run download --name "coverage-$shard" --dir coverage-shards/$shard
done
- name: Merge Coverage Reports
run: |
npx ts-node scripts/helpers/merge-coverage.ts
- name: Create .nyc_output Directory
run: mkdir -p .nyc_output
- name: Generate Final Coverage Report
run: |
yarn coverage:report
- name: Upload Unified Coverage Report to Codecov
uses: codecov/codecov-action@v4
with:
directory: coverage/
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
report-unit-testing:
name: Unit Testing
runs-on: ubuntu-latest
needs: [run-coverage-shards, combine-coverage]
steps:
- name: Success Message
run: echo "All Unit Testing Jobs Completed!"