remove old code && add gh actions

pull/5042/head
yann300 6 months ago committed by Aniket
parent 8c6411887c
commit 5155adb760
  1. 7
      apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx
  2. 518
      apps/remix-ide/src/app/plugins/templates-selection/templates.ts
  3. 29
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  4. 35
      libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx
  5. 2
      libs/remix-ui/workspace/src/lib/contexts/index.ts
  6. 24
      libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
  7. 20
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  8. 73
      libs/remix-ui/workspace/src/lib/utils/constants.ts
  9. 3
      libs/remix-ws-templates/src/index.ts
  10. 6
      libs/remix-ws-templates/src/script-templates/run-js-test-action/index.ts
  11. 26
      libs/remix-ws-templates/src/script-templates/run-js-test-action/run-js-test.yml
  12. 6
      libs/remix-ws-templates/src/script-templates/slither-action/index.ts
  13. 15
      libs/remix-ws-templates/src/script-templates/slither-action/run-slither-action.yml
  14. 6
      libs/remix-ws-templates/src/script-templates/solidity-test-action/index.ts
  15. 25
      libs/remix-ws-templates/src/script-templates/solidity-test-action/run-solidity-unittesting.yml

@ -145,7 +145,7 @@ export class TemplatesSelectionPlugin extends ViewPlugin {
return <RemixUIGridSection return <RemixUIGridSection
plugin={this} plugin={this}
title={template.name} title={template.name}
hScrollable= {true} hScrollable= {false}
> >
{template.items.map(item => { {template.items.map(item => {
return <RemixUIGridCell return <RemixUIGridCell
@ -155,7 +155,10 @@ export class TemplatesSelectionPlugin extends ViewPlugin {
<div> <div>
{item.displayName} {item.displayName}
{JSON.stringify(item.opts)} {JSON.stringify(item.opts)}
<div><button data-id={`create-${item.value}${item.opts ? JSON.stringify(item.opts) : ''}`} onClick={async () => createWorkspace(item)} className="btn btn-secondary" >Create a new workspace</button><button data-id={`add-${item.value}`} onClick={async () => addToCurrentWorkspace(item)} className="btn btn-primary" >Add to current workspace</button></div> <div>
{!template.IsArtefact && <button data-id={`create-${item.value}${item.opts ? JSON.stringify(item.opts) : ''}`} onClick={async () => createWorkspace(item)} className="btn btn-secondary" >Create a new workspace</button>}
<button data-id={`add-${item.value}`} onClick={async () => addToCurrentWorkspace(item)} className="btn btn-primary" >Add to current workspace</button>
</div>
</div> </div>
</RemixUIGridCell> </RemixUIGridCell>
})} })}

@ -1,258 +1,268 @@
export const templates = (intl) => { export const templates = (intl) => {
return [ return [
{ {
name: "Generic", name: "Generic",
items: [ items: [
{ value: "remixDefault", displayName: intl.formatMessage({ id: 'filePanel.basic' }) }, { value: "remixDefault", displayName: intl.formatMessage({ id: 'filePanel.basic' }) },
{ value: "blank", displayName: intl.formatMessage({ id: 'filePanel.blank' }) } { value: "blank", displayName: intl.formatMessage({ id: 'filePanel.blank' }) }
] ]
}, },
{ {
name: "OpenZeppelin", name: "OpenZeppelin",
items: [ items: [
{ {
value: "ozerc20", value: "ozerc20",
displayName: "ERC20" displayName: "ERC20"
}, },
{ {
value: "ozerc721", value: "ozerc721",
displayName: "ERC721 (NFT)" displayName: "ERC721 (NFT)"
}, },
{ {
value: "ozerc1155", value: "ozerc1155",
displayName: "ERC1155" displayName: "ERC1155"
}, },
{ {
value: "ozerc20", value: "ozerc20",
displayName: "ERC20", displayName: "ERC20",
opts: { opts: {
mintable: true mintable: true
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
mintable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
mintable: true
}
},
{
value: "ozerc20",
displayName: "ERC20",
opts: {
mintable: true,
burnable: true
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
mintable: true,
burnable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
mintable: true,
burnable: true
}
},
{
value: "ozerc20",
displayName: "ERC20",
opts: {
mintable: true,
pausable: true
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
mintable: true,
pausable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
mintable: true,
pausable: true
}
} }
] },
}, {
{ value: "ozerc721",
name: "OpenZeppelin Proxy", displayName: "ERC721 (NFT)",
items: [ opts: {
{ mintable: true
value: "ozerc20",
displayName: "ERC20",
opts: {
upgradeable: 'uups'
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
upgradeable: 'uups'
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
upgradeable: 'uups'
}
},
{
value: "ozerc20",
displayName: "ERC20",
opts: {
upgradeable: 'uups',
mintable: true
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
upgradeable: 'uups',
mintable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
upgradeable: 'uups',
mintable: true
}
},
{
value: "ozerc20",
displayName: "ERC20",
opts: {
upgradeable: 'uups',
mintable: true,
burnable: true
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
upgradeable: 'uups',
mintable: true,
burnable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
upgradeable: 'uups',
mintable: true,
burnable: true
}
},
{
value: "ozerc20",
displayName: "ERC20",
opts: {
upgradeable: 'uups',
mintable: true,
pausable: true
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
upgradeable: 'uups',
mintable: true,
pausable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
upgradeable: 'uups',
mintable: true,
pausable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
upgradeable: 'uups',
mintable: true,
burnable: true,
pausable: true
}
} }
] },
}, {
{ value: "ozerc1155",
name: "OxProject", displayName: "ERC1155",
items: [ opts: {
{ value: "zeroxErc20", displayName: "ERC20" } mintable: true
] }
}, },
{ {
name: "Gnosis Safe", value: "ozerc20",
items: [ displayName: "ERC20",
{ value: "gnosisSafeMultisig", displayName: intl.formatMessage({ id: 'filePanel.multiSigWallet' }) } opts: {
] mintable: true,
}, burnable: true
{ }
name: "Circom ZKP", },
items: [ {
{ value: "semaphore", displayName: intl.formatMessage({ id: 'filePanel.semaphore' }) }, value: "ozerc721",
{ value: "hashchecker", displayName: intl.formatMessage({ id: 'filePanel.hashchecker' }) }, displayName: "ERC721 (NFT)",
{ value: "rln", displayName: intl.formatMessage({ id: 'filePanel.rln' }) } opts: {
] mintable: true,
}, burnable: true
{ }
name: "Generic ZKP", },
items: [ {
{ value: "sindriScripts", displayName: intl.formatMessage({ id: 'filePanel.addscriptsindri' }) }, value: "ozerc1155",
] displayName: "ERC1155",
}, opts: {
{ mintable: true,
name: "Uniswap V4", burnable: true
items: [ }
{ value: "uniswapV4Template", displayName: intl.formatMessage({ id: 'filePanel.uniswapV4Template' }) }, },
{ value: "breakthroughLabsUniswapv4Hooks", displayName: intl.formatMessage({ id: 'filePanel.breakthroughLabsUniswapv4Hooks' }) }, {
{ value: "uniswapV4HookBookMultiSigSwapHook", displayName: intl.formatMessage({ id: 'filePanel.uniswapV4HookBookMultiSigSwapHook' }) } value: "ozerc20",
] displayName: "ERC20",
}, opts: {
{ mintable: true,
name: "Solidity CREATE2", pausable: true
items: [ }
{ value: "contractCreate2Factory", displayName: intl.formatMessage({ id: 'filePanel.addcreate2solidityfactory' }) }, },
{ value: "contractDeployerScripts", displayName: intl.formatMessage({ id: 'filePanel.addscriptdeployer' }) } {
] value: "ozerc721",
}, displayName: "ERC721 (NFT)",
{ opts: {
name: "Contract Verification", mintable: true,
items: [ pausable: true
{ value: "etherscanScripts", displayName: intl.formatMessage({ id: 'filePanel.addscriptetherscan' }) }, }
] },
} {
] value: "ozerc1155",
displayName: "ERC1155",
opts: {
mintable: true,
pausable: true
}
}
]
},
{
name: "OpenZeppelin Proxy",
items: [
{
value: "ozerc20",
displayName: "ERC20",
opts: {
upgradeable: 'uups'
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
upgradeable: 'uups'
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
upgradeable: 'uups'
}
},
{
value: "ozerc20",
displayName: "ERC20",
opts: {
upgradeable: 'uups',
mintable: true
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
upgradeable: 'uups',
mintable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
upgradeable: 'uups',
mintable: true
}
},
{
value: "ozerc20",
displayName: "ERC20",
opts: {
upgradeable: 'uups',
mintable: true,
burnable: true
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
upgradeable: 'uups',
mintable: true,
burnable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
upgradeable: 'uups',
mintable: true,
burnable: true
}
},
{
value: "ozerc20",
displayName: "ERC20",
opts: {
upgradeable: 'uups',
mintable: true,
pausable: true
}
},
{
value: "ozerc721",
displayName: "ERC721 (NFT)",
opts: {
upgradeable: 'uups',
mintable: true,
pausable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
upgradeable: 'uups',
mintable: true,
pausable: true
}
},
{
value: "ozerc1155",
displayName: "ERC1155",
opts: {
upgradeable: 'uups',
mintable: true,
burnable: true,
pausable: true
}
}
]
},
{
name: "OxProject",
items: [
{ value: "zeroxErc20", displayName: "ERC20" }
]
},
{
name: "Gnosis Safe",
items: [
{ value: "gnosisSafeMultisig", displayName: intl.formatMessage({ id: 'filePanel.multiSigWallet' }) }
]
},
{
name: "Circom ZKP",
items: [
{ value: "semaphore", displayName: intl.formatMessage({ id: 'filePanel.semaphore' }) },
{ value: "hashchecker", displayName: intl.formatMessage({ id: 'filePanel.hashchecker' }) },
{ value: "rln", displayName: intl.formatMessage({ id: 'filePanel.rln' }) }
]
},
{
name: "Generic ZKP",
items: [
{ value: "sindriScripts", displayName: intl.formatMessage({ id: 'filePanel.addscriptsindri' }) },
]
},
{
name: "Uniswap V4",
items: [
{ value: "uniswapV4Template", displayName: intl.formatMessage({ id: 'filePanel.uniswapV4Template' }) },
{ value: "breakthroughLabsUniswapv4Hooks", displayName: intl.formatMessage({ id: 'filePanel.breakthroughLabsUniswapv4Hooks' }) },
{ value: "uniswapV4HookBookMultiSigSwapHook", displayName: intl.formatMessage({ id: 'filePanel.uniswapV4HookBookMultiSigSwapHook' }) }
]
},
{
name: "Solidity CREATE2",
items: [
{ value: "contractCreate2Factory", displayName: intl.formatMessage({ id: 'filePanel.addcreate2solidityfactory' }) },
{ value: "contractDeployerScripts", displayName: intl.formatMessage({ id: 'filePanel.addscriptdeployer' }) }
]
},
{
name: "Contract Verification",
items: [
{ value: "etherscanScripts", displayName: intl.formatMessage({ id: 'filePanel.addscriptetherscan' }) },
],
},
{
name: 'Github Actions',
items: [
{ value: "runJsTestAction", displayName: intl.formatMessage({ id: 'filePanel.tssoltestghaction' }) },
{ value: "runSolidityUnittestingAction", displayName: intl.formatMessage({ id: 'filePanel.tssoltestghaction' }) },
{ value: "runSlitherAction", displayName: intl.formatMessage({ id: 'filePanel.slitherghaction' }) }
],
IsArtefact: true
}
]
} }

@ -38,7 +38,7 @@ import { addSlash, checkSlash, checkSpecialChars } from '@remix-ui/helper'
import { FileTree, JSONStandardInput, WorkspaceTemplate } from '../types' import { FileTree, JSONStandardInput, WorkspaceTemplate } from '../types'
import { QueryParams } from '@remix-project/remix-lib' import { QueryParams } from '@remix-project/remix-lib'
import * as templateWithContent from '@remix-project/remix-ws-templates' import * as templateWithContent from '@remix-project/remix-ws-templates'
import { ROOT_PATH, slitherYml, solTestYml, tsSolTestYml } from '../utils/constants' import { ROOT_PATH } from '../utils/constants'
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries // eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import { IndexedDBStorage } from '../../../../../../apps/remix-ide/src/app/files/filesystems/indexedDB' import { IndexedDBStorage } from '../../../../../../apps/remix-ide/src/app/files/filesystems/indexedDB'
import { getUncommittedFiles } from '../utils/gitStatusFilter' import { getUncommittedFiles } from '../utils/gitStatusFilter'
@ -880,33 +880,6 @@ export const createNewBranch = async (branch: string) => {
return promise return promise
} }
export const createSolidityGithubAction = async () => {
const path = '.github/workflows/run-solidity-unittesting.yml'
await plugin.call('fileManager', 'writeFile', path, solTestYml)
plugin.call('fileManager', 'open', path)
}
export const createTsSolGithubAction = async () => {
const path = '.github/workflows/run-js-test.yml'
await plugin.call('fileManager', 'writeFile', path, tsSolTestYml)
plugin.call('fileManager', 'open', path)
}
export const createSlitherGithubAction = async () => {
const path = '.github/workflows/run-slither-action.yml'
await plugin.call('fileManager', 'writeFile', path, slitherYml)
plugin.call('fileManager', 'open', path)
}
export const createHelperScripts = async (script: string) => {
if (!templates[script]) return
await templates[script](plugin)
plugin.call('notification', 'toast', `'${script}' added to the workspace.`)
}
export const updateGitSubmodules = async () => { export const updateGitSubmodules = async () => {
dispatch(cloneRepositoryRequest()) dispatch(cloneRepositoryRequest())
const config = plugin.registry.get('config').api const config = plugin.registry.get('config').api

@ -16,10 +16,6 @@ export interface HamburgerMenuProps {
downloadWorkspaces: () => void downloadWorkspaces: () => void
restoreBackup: () => void restoreBackup: () => void
hideIconsMenu: (showMenu: boolean) => void hideIconsMenu: (showMenu: boolean) => void
addGithubAction: () => void
addTsSolTestGithubAction: () => void
addSlitherGithubAction: () => void
addHelperScripts: (script: string) => void
showIconsMenu: boolean showIconsMenu: boolean
hideWorkspaceOptions: boolean hideWorkspaceOptions: boolean
hideLocalhostOptions: boolean hideLocalhostOptions: boolean
@ -132,37 +128,6 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
}} }}
platforms={[appPlatformTypes.web]} platforms={[appPlatformTypes.web]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<Dropdown.Divider className="border mt-0 mb-0 remixui_menuhr" style={{ pointerEvents: 'none' }} />
<HamburgerMenuItem
kind="solghaction"
fa="fa-kit fa-solidity-mono"
hideOption={hideWorkspaceOptions || hideFileOperations}
actionOnClick={() => {
props.addGithubAction()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={[appPlatformTypes.web, appPlatformTypes.desktop]}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="tssoltestghaction"
fa="fab fa-js"
hideOption={hideWorkspaceOptions || hideFileOperations}
actionOnClick={() => {
props.addTsSolTestGithubAction()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={[appPlatformTypes.web, appPlatformTypes.desktop]}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="slitherghaction"
fa="far fa-shield"
hideOption={hideWorkspaceOptions || hideFileOperations}
actionOnClick={() => {
props.addSlitherGithubAction()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={[appPlatformTypes.web, appPlatformTypes.desktop]}
></HamburgerMenuItem>
</> </>
) )
} }

@ -54,5 +54,5 @@ export const FileSystemContext = createContext<{
dispatchGetElectronRecentFolders: () => Promise<void> dispatchGetElectronRecentFolders: () => Promise<void>
dispatchRemoveRecentFolder: (path: string) => Promise<void> dispatchRemoveRecentFolder: (path: string) => Promise<void>
dispatchUpdateGitSubmodules: () => Promise<void> dispatchUpdateGitSubmodules: () => Promise<void>
}>(null) }>(null)

@ -44,10 +44,6 @@ import {
switchBranch, switchBranch,
createNewBranch, createNewBranch,
checkoutRemoteBranch, checkoutRemoteBranch,
createSolidityGithubAction,
createTsSolGithubAction,
createSlitherGithubAction,
createHelperScripts,
openElectronFolder, openElectronFolder,
getElectronRecentFolders, getElectronRecentFolders,
removeRecentElectronFolder, removeRecentElectronFolder,
@ -234,22 +230,6 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
await checkoutRemoteBranch(branch) await checkoutRemoteBranch(branch)
} }
const dispatchCreateSolidityGithubAction = async () => {
await createSolidityGithubAction()
}
const dispatchCreateTsSolGithubAction = async () => {
await createTsSolGithubAction()
}
const dispatchCreateSlitherGithubAction = async () => {
await createSlitherGithubAction()
}
const dispatchCreateHelperScripts = async (script: string) => {
await createHelperScripts(script)
}
const dispatchOpenElectronFolder = async (path: string) => { const dispatchOpenElectronFolder = async (path: string) => {
await openElectronFolder(path) await openElectronFolder(path)
} }
@ -387,10 +367,6 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
dispatchSwitchToBranch, dispatchSwitchToBranch,
dispatchCreateNewBranch, dispatchCreateNewBranch,
dispatchCheckoutRemoteBranch, dispatchCheckoutRemoteBranch,
dispatchCreateSolidityGithubAction,
dispatchCreateTsSolGithubAction,
dispatchCreateSlitherGithubAction,
dispatchCreateHelperScripts,
dispatchOpenElectronFolder, dispatchOpenElectronFolder,
dispatchGetElectronRecentFolders, dispatchGetElectronRecentFolders,
dispatchRemoveRecentFolder, dispatchRemoveRecentFolder,

@ -374,22 +374,6 @@ export function Workspace() {
) )
} }
const addGithubAction = () => {
global.dispatchCreateSolidityGithubAction()
}
const addTsSolTestGithubAction = () => {
global.dispatchCreateTsSolGithubAction()
}
const addSlitherGithubAction = () => {
global.dispatchCreateSlitherGithubAction()
}
const addHelperScripts = (script: string) => {
global.dispatchCreateHelperScripts(script)
}
const downloadWorkspaces = async () => { const downloadWorkspaces = async () => {
try { try {
await global.dispatchHandleDownloadFiles() await global.dispatchHandleDownloadFiles()
@ -896,10 +880,6 @@ export function Workspace() {
downloadWorkspaces={downloadWorkspaces} downloadWorkspaces={downloadWorkspaces}
restoreBackup={restoreBackup} restoreBackup={restoreBackup}
hideIconsMenu={hideIconsMenu} hideIconsMenu={hideIconsMenu}
addGithubAction={addGithubAction}
addSlitherGithubAction={addSlitherGithubAction}
addHelperScripts={addHelperScripts}
addTsSolTestGithubAction={addTsSolTestGithubAction}
showIconsMenu={showIconsMenu} showIconsMenu={showIconsMenu}
hideWorkspaceOptions={currentWorkspace === LOCALHOST} hideWorkspaceOptions={currentWorkspace === LOCALHOST}
hideLocalhostOptions={currentWorkspace === NO_WORKSPACE} hideLocalhostOptions={currentWorkspace === NO_WORKSPACE}

@ -1,78 +1,5 @@
import { TemplateType } from '../types' import { TemplateType } from '../types'
export const ROOT_PATH = '/' export const ROOT_PATH = '/'
export const solTestYml = `
name: Running Solidity Unit Tests
on: [push]
jobs:
run_sol_contracts_job:
runs-on: ubuntu-latest
name: A job to run solidity unit tests on github actions CI
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Environment Setup
uses: actions/setup-node@v3
with:
node-version: 20.0.0
- name: Run SUT Action
uses: EthereumRemix/sol-test@v1.1
with:
test-path: 'tests'
compiler-version: '0.8.15'
// evm-version: 'paris'
// optimize: true
// optimizer-runs: 200
// node-url: 'https://mainnet.infura.io/v3/08b2a484451e4635a28b3d8234f24332'
// block-number: 'latest'
// hard-fork: 'merge'
`
export const tsSolTestYml = `
name: Running Mocha Chai Solidity Unit Tests
on: [push]
jobs:
run_sample_test_job:
runs-on: ubuntu-latest
name: A job to run mocha and chai tests for solidity on github actions CI
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Environment Setup
uses: actions/setup-node@v3
with:
node-version: 20.0.0
- name: Run Mocha Chai Unit Test Action
uses: EthereumRemix/ts-sol-test@v1.3.1
with:
test-path: 'tests'
contract-path: 'contracts'
compiler-version: '0.8.7'
// evm-version: 'paris'
// optimize: true
// optimizer-runs: 200
// node-url: 'https://mainnet.infura.io/v3/08b2a484451e4635a28b3d8234f24332'
// block-number: 'latest'
// hard-fork: 'merge'
`
export const slitherYml = `
name: Slither Analysis
on: [push]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install
- uses: crytic/slither-action@v0.2.0
with:
target: 'contracts'
slither-args: '--solc-remaps "@openzeppelin/contracts=./node_modules/@openzeppelin/contracts hardhat=./node_modules/hardhat"'
fail-on: 'low'
solc-version: '0.8.2'
`
export const TEMPLATE_NAMES = { export const TEMPLATE_NAMES = {
'remixDefault': 'Basic', 'remixDefault': 'Basic',

@ -14,4 +14,7 @@ export { contractDeployerScripts } from './script-templates/contract-deployer'
export { etherscanScripts } from './script-templates/etherscan' export { etherscanScripts } from './script-templates/etherscan'
export { sindriScripts } from './script-templates/sindri' export { sindriScripts } from './script-templates/sindri'
export { contractCreate2Factory } from './script-templates/create2-solidity-factory' export { contractCreate2Factory } from './script-templates/create2-solidity-factory'
export { runSolidityUnittestingAction } from './script-templates/solidity-test-action'
export { runSlitherAction } from './script-templates/slither-action'
export { runJsTestAction } from './script-templates/run-js-test-action'

@ -0,0 +1,6 @@
export const runJsTestAction = async (opts, plugin) => {
await plugin.call('fileManager', 'writeFile',
'.github/workflows/run-js-test.yml' ,
// @ts-ignore
(await import('!!raw-loader!./run-js-test.yml')).default)
}

@ -0,0 +1,26 @@
name: Running Mocha Chai Solidity Unit Tests
on: [push]
jobs:
run_sample_test_job:
runs-on: ubuntu-latest
name: A job to run mocha and chai tests for solidity on github actions CI
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Environment Setup
uses: actions/setup-node@v3
with:
node-version: 20.0.0
- name: Run Mocha Chai Unit Test Action
uses: EthereumRemix/ts-sol-test@v1.3.1
with:
test-path: 'tests'
contract-path: 'contracts'
compiler-version: '0.8.7'
// evm-version: 'paris'
// optimize: true
// optimizer-runs: 200
// node-url: 'https://mainnet.infura.io/v3/08b2a484451e4635a28b3d8234f24332'
// block-number: 'latest'
// hard-fork: 'merge'

@ -0,0 +1,6 @@
export const runSlitherAction = async (opts, plugin) => {
await plugin.call('fileManager', 'writeFile',
'.github/workflows/run-slither-action.yml' ,
// @ts-ignore
(await import('!!raw-loader!./run-slither-action.yml')).default)
}

@ -0,0 +1,15 @@
name: Slither Analysis
on: [push]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install
- uses: crytic/slither-action@v0.2.0
with:
target: 'contracts'
slither-args: '--solc-remaps "@openzeppelin/contracts=./node_modules/@openzeppelin/contracts hardhat=./node_modules/hardhat"'
fail-on: 'low'
solc-version: '0.8.2'

@ -0,0 +1,6 @@
export const runSolidityUnittestingAction = async (opts, plugin) => {
await plugin.call('fileManager', 'writeFile',
'.github/workflows/run-solidity-unittesting.yml' ,
// @ts-ignore
(await import('!!raw-loader!./run-solidity-unittesting.yml')).default)
}

@ -0,0 +1,25 @@
name: Running Solidity Unit Tests
on: [push]
jobs:
run_sol_contracts_job:
runs-on: ubuntu-latest
name: A job to run solidity unit tests on github actions CI
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Environment Setup
uses: actions/setup-node@v3
with:
node-version: 20.0.0
- name: Run SUT Action
uses: EthereumRemix/sol-test@v1.1
with:
test-path: 'tests'
compiler-version: '0.8.15'
// evm-version: 'paris'
// optimize: true
// optimizer-runs: 200
// node-url: 'https://mainnet.infura.io/v3/08b2a484451e4635a28b3d8234f24332'
// block-number: 'latest'
// hard-fork: 'merge'
Loading…
Cancel
Save