Merge branch 'master' into codeformat

pull/5370/head
bunsenstraat 2 years ago committed by GitHub
commit 52f9fed04e
  1. 1
      apps/remix-ide/src/app/tabs/locales/en-US.js
  2. 23
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  3. 6
      libs/remix-ui/workspace/src/lib/contexts/index.ts
  4. 2
      libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css
  5. 9
      libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
  6. 36
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -45,6 +45,7 @@ export default {
'filePanel.workspace.restore': 'Restore Workspace Backup', 'filePanel.workspace.restore': 'Restore Workspace Backup',
'filePanel.workspace.clone': 'Clone Git Repository', 'filePanel.workspace.clone': 'Clone Git Repository',
'filePanel.workspace.enterGitUrl': 'Enter git repository url', '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.newFile': 'New File',
'filePanel.newFolder': 'New Folder', 'filePanel.newFolder': 'New Folder',
'filePanel.rename': 'Rename', 'filePanel.rename': 'Rename',

@ -611,6 +611,29 @@ export const createNewBranch = async (branch: string) => {
return promise 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) => { export const checkoutRemoteBranch = async (branch: string, remote: string) => {
const localChanges = await hasLocalChanges() const localChanges = await hasLocalChanges()

@ -36,6 +36,8 @@ export const FileSystemContext = createContext<{
dispatchShowAllBranches: () => Promise<void>, dispatchShowAllBranches: () => Promise<void>,
dispatchSwitchToBranch: (branch: string) => Promise<void>, dispatchSwitchToBranch: (branch: string) => Promise<void>,
dispatchCreateNewBranch: (branch: string) => Promise<void>, dispatchCreateNewBranch: (branch: string) => Promise<void>,
dispatchCheckoutRemoteBranch: (branch: string, remote: string) => Promise<void> dispatchCheckoutRemoteBranch: (branch: string, remote: string) => Promise<void>,
}>(null) dispatchCreateSolidityGithubAction: () => Promise<void>
}>(null)

@ -108,7 +108,7 @@
} }
.remixui_menuwidth { .remixui_menuwidth {
width: 8rem; /* width: 8rem; */
} }
#workspacesMenuDropdown > div.custom-dropdown-items { #workspacesMenuDropdown > div.custom-dropdown-items {

@ -8,7 +8,7 @@ import { browserReducer, browserInitialState } from '../reducers/workspace'
import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder,
deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace,
fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles, restoreBackupZip, cloneRepository, moveFile, moveFolder, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles, restoreBackupZip, cloneRepository, moveFile, moveFolder,
showAllBranches, switchBranch, createNewBranch, checkoutRemoteBranch showAllBranches, switchBranch, createNewBranch, checkoutRemoteBranch, createSolidityGithubAction
} from '../actions' } from '../actions'
import { Modal, WorkspaceProps, WorkspaceTemplate } from '../types' import { Modal, WorkspaceProps, WorkspaceTemplate } from '../types'
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -155,6 +155,10 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
await checkoutRemoteBranch(branch, remote) await checkoutRemoteBranch(branch, remote)
} }
const dispatchCreateSolidityGithubAction = async () => {
await createSolidityGithubAction()
}
useEffect(() => { useEffect(() => {
dispatchInitWorkspace() dispatchInitWorkspace()
}, []) }, [])
@ -263,7 +267,8 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
dispatchShowAllBranches, dispatchShowAllBranches,
dispatchSwitchToBranch, dispatchSwitchToBranch,
dispatchCreateNewBranch, dispatchCreateNewBranch,
dispatchCheckoutRemoteBranch dispatchCheckoutRemoteBranch,
dispatchCreateSolidityGithubAction
} }
return ( return (
<FileSystemContext.Provider value={value}> <FileSystemContext.Provider value={value}>

@ -99,6 +99,10 @@ export function Workspace () {
) )
} }
const addGithubAction = () => {
global.dispatchCreateSolidityGithubAction()
}
const downloadWorkspaces = async () => { const downloadWorkspaces = async () => {
try { try {
await global.dispatchHandleDownloadFiles() await global.dispatchHandleDownloadFiles()
@ -549,6 +553,38 @@ export function Workspace () {
<span className="pl-3"><FormattedMessage id='filePanel.restore' defaultMessage='Restore' /></span> <span className="pl-3"><FormattedMessage id='filePanel.restore' defaultMessage='Restore' /></span>
</div> </div>
</CustomTooltip>, </CustomTooltip>,
<Dropdown.Divider className="border mt-0 mb-0 remixui_menuhr" style={{ pointerEvents: 'none' }}/>,
<CustomTooltip
placement="right-start"
tooltipId="createSolGHActionTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id='filePanel.workspace.solghaction' defaultMessage='Add the solidity GitHub action file. Push to a repository to start running it in the GitHub CI.' />}
>
<div
data-id='soliditygithubaction'
onClick={(e) => {
e.stopPropagation()
addGithubAction()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addSolidityTesting'])
hideIconsMenu(!showIconsMenu)
}}
>
<span
hidden={currentWorkspace === LOCALHOST}
id='soliditygithubaction'
data-id='soliditygithubaction'
onClick={(e) => {
e.stopPropagation()
addGithubAction()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addSolidityTesting'])
hideIconsMenu(!showIconsMenu)
}}
className='fab fa-github pl-2'
>
</span>
<span className="pl-3">{'Add Solidity GitHub action'}</span>
</div>
</CustomTooltip>
] ]
const menuLength = workspaceMenuIcons.length const menuLength = workspaceMenuIcons.length
let count = 0 let count = 0

Loading…
Cancel
Save