Changed CI for compilation and run tests #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Hardhat and Node.js CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
# Can be called by another workflow | |
workflow_call: | |
# Allows you to run this workflow manually from the Actions tab (only runs on the default branch) | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- name: Install dependencies | |
run: | | |
npm install | |
cd services/ethereum | |
npm install | |
working-directory: ../code | |
- name: Build code directory | |
run: npm run build --if-present | |
working-directory: ../code | |
- name: Test code directory | |
run: npx hardhat test | |
working-directory: ../code/services/ethereum/test |