Skip to content

Contracts Testing #9452

Contracts Testing

Contracts Testing #9452

name: Contracts Testing
on:
workflow_dispatch:
merge_group:
push:
branches:
- master
- dev
paths-ignore:
- "kleros-sdk/**"
- "services/**"
- "subgraph/**"
- "web/**"
pull_request:
branches:
- "*"
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
contracts-testing:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/[email protected]
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
binaries.soliditylang.org:443
classic.yarnpkg.com:443
github.com:443
nightly.yarnpkg.com:443
nodejs.org:443
objects.githubusercontent.com:443
registry.yarnpkg.com:443
registry.npmjs.org:443
54.185.253.63:443
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18.x
- uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
#- name: Install parent dependencies
# run: |
# echo "current dir: $PWD"
# yarn install
- name: Install contracts dependencies
run: |
yarn workspace @kleros/kleros-v2-contracts install
- name: Compile
run: |
yarn hardhat compile
working-directory: contracts
- name: Test with coverage
run: |
yarn hardhat coverage --solcoverjs ./.solcover.js --temp artifacts --testfiles './test/**/*.ts' --show-stack-traces
working-directory: contracts
- name: Upload a build artifact
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: contracts/coverage