Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/contracts-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Contracts Testing

on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- "*"

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: 16.x

- uses: actions/[email protected]

- name: Cache node modules
uses: actions/[email protected]
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

#- 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: |
npx hardhat compile
working-directory: contracts

- name: Test with coverage
run: |
npx hardhat coverage --solcoverjs ./.solcover.js --temp artifacts --testfiles \"./test/**/*.ts\"
working-directory: contracts

- name: Upload a build artifact
uses: actions/[email protected]
with:
name: code-coverage-report
path: contracts/coverage
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</p>

<p align="center">
<a href="https://github.com/kleros/kleros-v2/actions/workflows/contracts-testing.yml"><img src="https://github.com/kleros/kleros-v2/actions/workflows/contracts-testing.yml/badge.svg" alt="Unit testing"></a>
<a href="https://conventionalcommits.org"><img src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg" alt="Conventional Commits"></a>
<a href="http://commitizen.github.io/cz-cli/"><img src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg" alt="Commitizen Friendly"></a>
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="Styled with Prettier"></a>
Expand Down
1 change: 1 addition & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Hardhat files
cache
artifacts
coverage.json

## Hardhat typechain bindings/types
typechain
Expand Down
19 changes: 19 additions & 0 deletions contracts/.solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-disable node/no-extraneous-require */

const shell = require("shelljs");

// The environment variables are loaded in hardhat.config.ts

module.exports = {
istanbulReporter: ["html"],
onCompileComplete: async function (_config) {
await run("typechain");
},
onIstanbulComplete: async function (_config) {
// We need to do this because solcover generates bespoke artifacts.
shell.rm("-rf", "./artifacts");
shell.rm("-rf", "./typechain");
},
providerOptions: {},
skipFiles: ["mocks", "test"],
};
122 changes: 0 additions & 122 deletions contracts/coverage.json

This file was deleted.