Merge pull request #3048 from ethereum/add_fe_items

add "create sol github action" to the FE menu
pull/5370/head
yann300 2 years ago committed by GitHub
commit 7e46a5f538
  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.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',

@ -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()

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

@ -108,7 +108,7 @@
}
.remixui_menuwidth {
width: 8rem;
/* width: 8rem; */
}
#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,
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 (
<FileSystemContext.Provider value={value}>

@ -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 () {
<span className="pl-3"><FormattedMessage id='filePanel.restore' defaultMessage='Restore' /></span>
</div>
</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
let count = 0

Loading…
Cancel
Save