Skip to content

feat: forge - preload data into the smart contract - for new directory structure #194

feat: forge - preload data into the smart contract - for new directory structure

feat: forge - preload data into the smart contract - for new directory structure #194

Workflow file for this run

name: Test
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
push:
branches:
- main
env:
FOUNDRY_PROFILE: ci
# This enables colored output for tests run by `mocha`.
# `FORCE_COLOR` is used by `chalk`, which is used internally by `mocha`.
# https://github.com/chalk/chalk#supportscolor
# https://github.com/orgs/community/discussions/26944#discussioncomment-3254075
FORCE_COLOR: 3
jobs:
type-check:
name: TypeScript Type-Check
runs-on: smart-contracts-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive
- name: Set up Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: '20'
- name: Install Dependencies
run: npm ci
- name: Run TypeScript Type-Check
run: npm run type-check
- name: Run ESLint
run: npm run lint
unit-test:
name: 'NPM Unit Tests'
runs-on: smart-contracts-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive
- name: Set up Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: '20'
- name: Install Dependencies
run: npm ci
- name: Run Unit Tests
run: npm run test --workspace=@hts-forking
sol-tests-local-storage:
name: 'Forge tests w/storage emulation'
runs-on: smart-contracts-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive
- name: Install Foundry
uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1
with:
version: nightly
- name: Run Forge build
run: |
forge --version
forge build --sizes
- name: Run Forge tests using local storage emulation (without forking)
run: |
forge test -vvv
sol-tests-json-rpc-mock:
name: 'Forge tests w/RPC mock server'
runs-on: smart-contracts-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive
- name: Set up Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: '20'
- name: Install Dependencies
run: npm ci
- name: Install Foundry
uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1
with:
version: nightly
- name: Run Forge build
run: |
forge --version
forge build --sizes
- name: Start JSON-RPC mock server
working-directory: ./@hts-forking
run: node scripts/json-rpc-mock.js &
- name: Run Forge tests using JSON-RPC mock server for storage emulation (with forking)
run: |
forge test -vvv --fork-url http://localhost:7546 --no-storage-caching --match-contract ^TokenTest$
forge test -vvv --fork-url http://localhost:7546 --no-storage-caching --match-contract ^HTSTest$
- name: Run Forge tests using JSON-RPC Mainnet and Testnet servers (with forking)
run: |
forge test -vvv --fork-url https://mainnet.hashio.io/api --chain 295 --no-storage-caching --match-contract ^DealCheatCodeIssueTest$
forge test -vvv --fork-url https://testnet.hashio.io/api --chain 296 --no-storage-caching --match-contract ^TokenForkTest$