add unit tests #46418
Workflow file for this run
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: Solidity-Hardhat | |
on: | |
merge_group: | |
push: | |
env: | |
NODE_OPTIONS: --max_old_space_size=8192 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
changes: | |
name: Detect changes | |
runs-on: ubuntu-latest | |
outputs: | |
changes: ${{ steps.changes.outputs.src }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: changes | |
with: | |
filters: | | |
src: | |
- 'contracts/src/!(v0.8/(ccip|functions|keystone|l2ep|liquiditymanager|llo-feeds|transmission|vrf)/**)/**/*' | |
- 'contracts/test/**/*' | |
- 'contracts/package.json' | |
- 'contracts/pnpm-lock.yaml' | |
- 'contracts/hardhat.config.ts' | |
- '.github/workflows/solidity-hardhat.yml' | |
hardhat-test: | |
needs: [changes] | |
if: needs.changes.outputs.changes == 'true' | |
name: Solidity ${{ fromJSON('["(skipped)", ""]')[needs.changes.outputs.changes == 'true'] }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
- name: Setup NodeJS | |
uses: ./.github/actions/setup-nodejs | |
- name: Setup Hardhat | |
uses: ./.github/actions/setup-hardhat | |
with: | |
namespace: coverage | |
- name: Run tests | |
working-directory: contracts | |
run: pnpm test | |
- name: Collect Metrics | |
id: collect-gha-metrics | |
uses: smartcontractkit/push-gha-metrics-action@d9da21a2747016b3e13de58c7d4115a3d5c97935 # v3.0.1 | |
with: | |
id: hardhat-test | |
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} | |
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} | |
continue-on-error: true | |
solidity: | |
needs: [changes, hardhat-test] | |
name: Solidity | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- run: echo 'Solidity tests finished!' | |
- name: Check test results | |
run: | | |
if [[ "${{ needs.changes.result }}" = "failure" || "${{ needs.solidity-splits.result }}" = "failure" ]]; then | |
echo "One or more changes / solidity-splits jobs failed" | |
exit 1 | |
else | |
echo "All test jobs passed successfully" | |
fi | |
- name: Collect Metrics | |
if: always() | |
id: collect-gha-metrics | |
uses: smartcontractkit/push-gha-metrics-action@d9da21a2747016b3e13de58c7d4115a3d5c97935 # v3.0.1 | |
with: | |
id: solidity-tests | |
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} | |
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} | |
this-job-name: Solidity | |
continue-on-error: true |