diff --git a/apps/remix-ide/src/app/tabs/locales/en-US.js b/apps/remix-ide/src/app/tabs/locales/en-US.js index 8111d21cc2..f1dac06709 100644 --- a/apps/remix-ide/src/app/tabs/locales/en-US.js +++ b/apps/remix-ide/src/app/tabs/locales/en-US.js @@ -45,6 +45,7 @@ export default { 'filePanel.workspace.restore': 'Restore Workspace Backup', 'filePanel.workspace.clone': 'Clone Git Repository', 'filePanel.workspace.enterGitUrl': 'Enter git repository url', + 'filePanel.workspace.solghaction': 'Add the solidity GitHub action file. Push to a repository to start running it in the GitHub CI.', 'filePanel.newFile': 'New File', 'filePanel.newFolder': 'New Folder', 'filePanel.rename': 'Rename', diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index 16fea3fc32..86dcdf8594 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -611,6 +611,29 @@ export const createNewBranch = async (branch: string) => { return promise } +export const createSolidityGithubAction = async () => { + const actionYml = ` + 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: Run SUT Action + uses: EthereumRemix/sol-test@v1 + with: + test-path: 'tests' + compiler-version: '0.8.15' + ` + const path = '.github/workflows/run-solidity-unittesting.yml' + await plugin.call('fileManager', 'writeFile', path , actionYml) + plugin.call('fileManager', 'open', path) +} + export const checkoutRemoteBranch = async (branch: string, remote: string) => { const localChanges = await hasLocalChanges() diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index 2e199c2f60..63e0aa94bc 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -36,6 +36,8 @@ export const FileSystemContext = createContext<{ dispatchShowAllBranches: () => Promise, dispatchSwitchToBranch: (branch: string) => Promise, dispatchCreateNewBranch: (branch: string) => Promise, - dispatchCheckoutRemoteBranch: (branch: string, remote: string) => Promise - }>(null) + dispatchCheckoutRemoteBranch: (branch: string, remote: string) => Promise, + dispatchCreateSolidityGithubAction: () => Promise +}>(null) + \ No newline at end of file diff --git a/libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css b/libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css index 13756a9b94..b52432b403 100644 --- a/libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css +++ b/libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css @@ -108,7 +108,7 @@ } .remixui_menuwidth { - width: 8rem; + /* width: 8rem; */ } #workspacesMenuDropdown > div.custom-dropdown-items { diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index 2b01004d50..ed273dc42e 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -8,7 +8,7 @@ import { browserReducer, browserInitialState } from '../reducers/workspace' import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles, restoreBackupZip, cloneRepository, moveFile, moveFolder, - showAllBranches, switchBranch, createNewBranch, checkoutRemoteBranch + showAllBranches, switchBranch, createNewBranch, checkoutRemoteBranch, createSolidityGithubAction } from '../actions' import { Modal, WorkspaceProps, WorkspaceTemplate } from '../types' // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -155,6 +155,10 @@ export const FileSystemProvider = (props: WorkspaceProps) => { await checkoutRemoteBranch(branch, remote) } + const dispatchCreateSolidityGithubAction = async () => { + await createSolidityGithubAction() + } + useEffect(() => { dispatchInitWorkspace() }, []) @@ -263,7 +267,8 @@ export const FileSystemProvider = (props: WorkspaceProps) => { dispatchShowAllBranches, dispatchSwitchToBranch, dispatchCreateNewBranch, - dispatchCheckoutRemoteBranch + dispatchCheckoutRemoteBranch, + dispatchCreateSolidityGithubAction } return ( 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 dad84a3581..49eba6d8e4 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -99,6 +99,10 @@ export function Workspace () { ) } + const addGithubAction = () => { + global.dispatchCreateSolidityGithubAction() + } + const downloadWorkspaces = async () => { try { await global.dispatchHandleDownloadFiles() @@ -549,6 +553,38 @@ export function Workspace () { , + , + } + > +
{ + e.stopPropagation() + addGithubAction() + _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addSolidityTesting']) + hideIconsMenu(!showIconsMenu) + }} + > + + {'Add Solidity GitHub action'} +
+
] const menuLength = workspaceMenuIcons.length let count = 0