Skip to content

Merge pull request #48 from vechain/last-version-alignment #72

Merge pull request #48 from vechain/last-version-alignment

Merge pull request #48 from vechain/last-version-alignment #72

name: Unit Testing & Sonar
on:
workflow_dispatch:
pull_request:
paths: ['packages/ethers/**', 'packages/vechain/**', 'packages/web3/**', '.github/workflows/**', 'package.json', 'sonar-project.properties', 'tsconfig.json']
branches:
- main
push:
paths: ['packages/ethers/**', 'packages/vechain/**', 'packages/web3/**', '.github/workflows/**', 'package.json', 'sonar-project.properties', 'tsconfig.json']
branches:
- main
jobs:
run-tests-and-scan:
name: Runs tests and upload coverage report to Sonar and quality gate check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node v18
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@vechainfoundation'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: |
yarn install
yarn build
- name: Unit tests and coverage
run: |
docker-compose -f packages/vechain/test/docker-compose.yaml up -d
yarn workspace @vechain/hardhat-vechain test-coverage
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}