diff --git a/apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx b/apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx index 569cb98bfe..285c66362b 100644 --- a/apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx +++ b/apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx @@ -145,7 +145,7 @@ export class TemplatesSelectionPlugin extends ViewPlugin { return {template.items.map(item => { return {item.displayName} {JSON.stringify(item.opts)} -
+
+ {!template.IsArtefact && } + +
})} diff --git a/apps/remix-ide/src/app/plugins/templates-selection/templates.ts b/apps/remix-ide/src/app/plugins/templates-selection/templates.ts index 8312611b1a..3ca0fc201c 100644 --- a/apps/remix-ide/src/app/plugins/templates-selection/templates.ts +++ b/apps/remix-ide/src/app/plugins/templates-selection/templates.ts @@ -1,258 +1,268 @@ export const templates = (intl) => { - return [ - { - name: "Generic", - items: [ - { value: "remixDefault", displayName: intl.formatMessage({ id: 'filePanel.basic' }) }, - { value: "blank", displayName: intl.formatMessage({ id: 'filePanel.blank' }) } - ] - }, - { - name: "OpenZeppelin", - items: [ - { - value: "ozerc20", - displayName: "ERC20" - }, - { - value: "ozerc721", - displayName: "ERC721 (NFT)" - }, - { - value: "ozerc1155", - displayName: "ERC1155" - }, - { - value: "ozerc20", - displayName: "ERC20", - opts: { - 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 - } + return [ + { + name: "Generic", + items: [ + { value: "remixDefault", displayName: intl.formatMessage({ id: 'filePanel.basic' }) }, + { value: "blank", displayName: intl.formatMessage({ id: 'filePanel.blank' }) } + ] + }, + { + name: "OpenZeppelin", + items: [ + { + value: "ozerc20", + displayName: "ERC20" + }, + { + value: "ozerc721", + displayName: "ERC721 (NFT)" + }, + { + value: "ozerc1155", + displayName: "ERC1155" + }, + { + value: "ozerc20", + displayName: "ERC20", + opts: { + mintable: 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 - } + }, + { + value: "ozerc721", + displayName: "ERC721 (NFT)", + opts: { + mintable: 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' }) }, - ] - } - ] + }, + { + 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 + } + } + ] + }, + { + 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 + } + ] } \ No newline at end of file diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index e510aefbdd..74e1fc4a75 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -38,7 +38,7 @@ import { addSlash, checkSlash, checkSpecialChars } from '@remix-ui/helper' import { FileTree, JSONStandardInput, WorkspaceTemplate } from '../types' import { QueryParams } from '@remix-project/remix-lib' 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 import { IndexedDBStorage } from '../../../../../../apps/remix-ide/src/app/files/filesystems/indexedDB' import { getUncommittedFiles } from '../utils/gitStatusFilter' @@ -880,33 +880,6 @@ export const createNewBranch = async (branch: string) => { 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 () => { dispatch(cloneRepositoryRequest()) const config = plugin.registry.get('config').api diff --git a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx index 04072a8f1a..95de007539 100644 --- a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx +++ b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx @@ -16,10 +16,6 @@ export interface HamburgerMenuProps { downloadWorkspaces: () => void restoreBackup: () => void hideIconsMenu: (showMenu: boolean) => void - addGithubAction: () => void - addTsSolTestGithubAction: () => void - addSlitherGithubAction: () => void - addHelperScripts: (script: string) => void showIconsMenu: boolean hideWorkspaceOptions: boolean hideLocalhostOptions: boolean @@ -132,37 +128,6 @@ export function HamburgerMenu(props: HamburgerMenuProps) { }} platforms={[appPlatformTypes.web]} > - - { - props.addGithubAction() - props.hideIconsMenu(!showIconsMenu) - }} - platforms={[appPlatformTypes.web, appPlatformTypes.desktop]} - > - { - props.addTsSolTestGithubAction() - props.hideIconsMenu(!showIconsMenu) - }} - platforms={[appPlatformTypes.web, appPlatformTypes.desktop]} - > - { - props.addSlitherGithubAction() - props.hideIconsMenu(!showIconsMenu) - }} - platforms={[appPlatformTypes.web, appPlatformTypes.desktop]} - > ) } diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index 0840a9163f..4e533871a6 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -54,5 +54,5 @@ export const FileSystemContext = createContext<{ dispatchGetElectronRecentFolders: () => Promise dispatchRemoveRecentFolder: (path: string) => Promise dispatchUpdateGitSubmodules: () => Promise - }>(null) +}>(null) diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index 7494e39e3d..7e5ede0d7b 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -44,10 +44,6 @@ import { switchBranch, createNewBranch, checkoutRemoteBranch, - createSolidityGithubAction, - createTsSolGithubAction, - createSlitherGithubAction, - createHelperScripts, openElectronFolder, getElectronRecentFolders, removeRecentElectronFolder, @@ -234,22 +230,6 @@ export const FileSystemProvider = (props: WorkspaceProps) => { 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) => { await openElectronFolder(path) } @@ -387,10 +367,6 @@ export const FileSystemProvider = (props: WorkspaceProps) => { dispatchSwitchToBranch, dispatchCreateNewBranch, dispatchCheckoutRemoteBranch, - dispatchCreateSolidityGithubAction, - dispatchCreateTsSolGithubAction, - dispatchCreateSlitherGithubAction, - dispatchCreateHelperScripts, dispatchOpenElectronFolder, dispatchGetElectronRecentFolders, dispatchRemoveRecentFolder, diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 8b5823848b..3a83530198 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -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 () => { try { await global.dispatchHandleDownloadFiles() @@ -896,10 +880,6 @@ export function Workspace() { downloadWorkspaces={downloadWorkspaces} restoreBackup={restoreBackup} hideIconsMenu={hideIconsMenu} - addGithubAction={addGithubAction} - addSlitherGithubAction={addSlitherGithubAction} - addHelperScripts={addHelperScripts} - addTsSolTestGithubAction={addTsSolTestGithubAction} showIconsMenu={showIconsMenu} hideWorkspaceOptions={currentWorkspace === LOCALHOST} hideLocalhostOptions={currentWorkspace === NO_WORKSPACE} diff --git a/libs/remix-ui/workspace/src/lib/utils/constants.ts b/libs/remix-ui/workspace/src/lib/utils/constants.ts index 9257c6a381..fcde9c1830 100644 --- a/libs/remix-ui/workspace/src/lib/utils/constants.ts +++ b/libs/remix-ui/workspace/src/lib/utils/constants.ts @@ -1,78 +1,5 @@ import { TemplateType } from '../types' 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 = { 'remixDefault': 'Basic', diff --git a/libs/remix-ws-templates/src/index.ts b/libs/remix-ws-templates/src/index.ts index 0ccb356460..18569e12eb 100644 --- a/libs/remix-ws-templates/src/index.ts +++ b/libs/remix-ws-templates/src/index.ts @@ -14,4 +14,7 @@ export { contractDeployerScripts } from './script-templates/contract-deployer' export { etherscanScripts } from './script-templates/etherscan' export { sindriScripts } from './script-templates/sindri' 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' diff --git a/libs/remix-ws-templates/src/script-templates/run-js-test-action/index.ts b/libs/remix-ws-templates/src/script-templates/run-js-test-action/index.ts new file mode 100644 index 0000000000..0a49193733 --- /dev/null +++ b/libs/remix-ws-templates/src/script-templates/run-js-test-action/index.ts @@ -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) +} \ No newline at end of file diff --git a/libs/remix-ws-templates/src/script-templates/run-js-test-action/run-js-test.yml b/libs/remix-ws-templates/src/script-templates/run-js-test-action/run-js-test.yml new file mode 100644 index 0000000000..f05f2964c6 --- /dev/null +++ b/libs/remix-ws-templates/src/script-templates/run-js-test-action/run-js-test.yml @@ -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' \ No newline at end of file diff --git a/libs/remix-ws-templates/src/script-templates/slither-action/index.ts b/libs/remix-ws-templates/src/script-templates/slither-action/index.ts new file mode 100644 index 0000000000..ab439a0080 --- /dev/null +++ b/libs/remix-ws-templates/src/script-templates/slither-action/index.ts @@ -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) +} \ No newline at end of file diff --git a/libs/remix-ws-templates/src/script-templates/slither-action/run-slither-action.yml b/libs/remix-ws-templates/src/script-templates/slither-action/run-slither-action.yml new file mode 100644 index 0000000000..b67465b6cb --- /dev/null +++ b/libs/remix-ws-templates/src/script-templates/slither-action/run-slither-action.yml @@ -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' \ No newline at end of file diff --git a/libs/remix-ws-templates/src/script-templates/solidity-test-action/index.ts b/libs/remix-ws-templates/src/script-templates/solidity-test-action/index.ts new file mode 100644 index 0000000000..2245391da8 --- /dev/null +++ b/libs/remix-ws-templates/src/script-templates/solidity-test-action/index.ts @@ -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) +} \ No newline at end of file diff --git a/libs/remix-ws-templates/src/script-templates/solidity-test-action/run-solidity-unittesting.yml b/libs/remix-ws-templates/src/script-templates/solidity-test-action/run-solidity-unittesting.yml new file mode 100644 index 0000000000..9c1caafd56 --- /dev/null +++ b/libs/remix-ws-templates/src/script-templates/solidity-test-action/run-solidity-unittesting.yml @@ -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' \ No newline at end of file