Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add operate setup test #172

Merged
merged 33 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6cb4e9e
test: operate installation e2e
angrybayblade Jun 5, 2024
97a3142
chore: add e2e test workflow
angrybayblade Jun 5, 2024
812f872
fix: test job
angrybayblade Jun 5, 2024
8a2fe9a
feat: add macos arm runner
angrybayblade Jun 5, 2024
aa6dddd
feat: add IPC channel mock
angrybayblade Jun 5, 2024
cc67cd1
fix: macos arm version
angrybayblade Jun 5, 2024
6d236e1
fix: uninstall brew
angrybayblade Jun 5, 2024
23e3c99
fix: use sudo for uninstalling brew
angrybayblade Jun 5, 2024
2187725
chore: add brew installation logging
angrybayblade Jun 5, 2024
d6256b9
feat: add brew installation script and fix tendermint installation
angrybayblade Jun 5, 2024
c037b3e
fix: __dirname typo
angrybayblade Jun 5, 2024
1abb697
fix: raise condition for command exec result
angrybayblade Jun 5, 2024
0f6803c
fix: skip tendermint installation in CI
angrybayblade Jun 5, 2024
3c42801
feat: extend e2e tests
angrybayblade Jun 5, 2024
91b980d
chore: ignore jinja safety warning
angrybayblade Jun 5, 2024
734b967
chore: ignore gitleaks warnings
angrybayblade Jun 5, 2024
e67e092
chore: remove debug statement
angrybayblade Jun 5, 2024
e879153
feat: bump to rc37
angrybayblade Jun 5, 2024
5f3095e
fix: write script to temporary file for installing brew
angrybayblade Jun 5, 2024
4de8070
feat: bump to v0.1.0-rc38
angrybayblade Jun 5, 2024
14615fe
fix: use js strings to store brew installation script
angrybayblade Jun 5, 2024
27c1508
Merge branch 'main' into fix/brew-installation
angrybayblade Jun 5, 2024
879862f
fix: script multiline
angrybayblade Jun 5, 2024
8783c07
feat: bump to v0.1.0-rc39
angrybayblade Jun 5, 2024
579fd78
fix: store the temporary brew script in homedir instead of tempdir
angrybayblade Jun 6, 2024
47d4ab2
feat: install brew from source
angrybayblade Jun 6, 2024
5d7333b
fix: homebrew source extraction and sudo cmd exec
angrybayblade Jun 6, 2024
259ef3c
fix: env name typo
angrybayblade Jun 6, 2024
5237df7
fix: remove unwanted code
angrybayblade Jun 6, 2024
3962a76
fix: tendermint installation
angrybayblade Jun 6, 2024
b7bb6c6
fix: remove homebrew leftovers from uninstall
angrybayblade Jun 6, 2024
c848a8f
feat: bump to v0.1.0-rc40
angrybayblade Jun 6, 2024
01084f7
fix: use rmDirSync instead of rmSync
angrybayblade Jun 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Test Operate Installation E2E"
on:
push:
branches:
- develop
- main
pull_request:
jobs:
test:
continue-on-error: False
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-12, macos-14]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macos-12 is amd based and macos-14 is arm based

timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20.11"
- name: Setup
run: |
npm install
# Uninstall brew
sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
- name: Run Test
run: |
node electron/test.js
8 changes: 7 additions & 1 deletion .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ e7de9ce0b902ed6d68f8c5b033d044f39b08f5a1:operate/data/contracts/service_staking_
d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-key:405
d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-key:406
d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-key:454
d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-key:455
d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-key:455
d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-key:45591ec07457f69e9a29f63693ac8ef887e4b5f49f0:operate/services/manage.py:generic-api-key:454
99c0f139b037da2587708212fcf6d0e20786d0ba:operate/services/manage.py:generic-api-key:405
99c0f139b037da2587708212fcf6d0e20786d0ba:operate/services/manage.py:generic-api-key:406
99c0f139b037da2587708212fcf6d0e20786d0ba:operate/services/manage.py:generic-api-key:454
99c0f139b037da2587708212fcf6d0e20786d0ba:operate/services/manage.py:generic-api-key:455
91ec07457f69e9a29f63693ac8ef887e4b5f49f0:operate/services/manage.py:generic-api-key:454
37 changes: 18 additions & 19 deletions electron/install.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Installation helpers.

const https = require('https');
const path = require('path');
const fs = require('fs');
const os = require('os');
const sudo = require('sudo-prompt');
Expand Down Expand Up @@ -87,11 +85,9 @@ function runCmdUnix(command, options) {
Error: ${output.error}; Stdout: ${output.stdout}; Stderr: ${output.stderr}`,
);
}
return {
error: output.error,
stdout: output.stdout?.toString(),
stderr: output.stderr?.toString(),
};
console.log(appendLog(`Executed ${command} ${options} with`))
console.log(appendLog(`===== stdout ===== \n${output.stdout}`))
console.log(appendLog(`===== stderr ===== \n${output.stderr}`))
}

function runSudoUnix(command, options) {
Expand Down Expand Up @@ -119,9 +115,8 @@ function isBrewInstalled() {
}

function installBrew() {
return runCmdUnix('bash', [
'-c',
'$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)',
runCmdUnix('bash', [
`${__dirname}/scripts/install_brew.sh`
]);
}

Expand All @@ -143,7 +138,7 @@ async function downloadFile(url, dest) {
writer.on('error', reject);
});
} catch (err) {
fs.unlink(dest, () => {}); // Delete the file if there is an error
fs.unlink(dest, () => { }); // Delete the file if there is an error
console.error('Error downloading the file:', err.message);
}
}
Expand All @@ -161,8 +156,12 @@ async function installTendermintUnix() {
await downloadFile(url, `${TempDir}/tendermint.tar.gz`);

console.log(appendLog(`Installing tendermint binary`));
await runCmdUnix('tar', ['-xvf', 'tendermint.tar.gz']);
await runSudoUnix('install', 'tendermint /usr/local/bin');
runCmdUnix('tar', ['-xvf', 'tendermint.tar.gz']);

// TOFIX: Install tendermint in .operate instead of globally
if (!Env.CI) {
await runSudoUnix('install', 'tendermint /usr/local/bin');
}
process.chdir(cwd);
}

Expand All @@ -171,7 +170,7 @@ function isDockerInstalledDarwin() {
}

function installDockerDarwin() {
return runCmdUnix('brew', ['install', 'docker']);
runCmdUnix('brew', ['install', 'docker']);
}

function isDockerInstalledUbuntu() {
Expand All @@ -187,11 +186,11 @@ function isPythonInstalledDarwin() {
}

function installPythonDarwin() {
return runCmdUnix('brew', ['install', '[email protected]']);
runCmdUnix('brew', ['install', '[email protected]']);
}

function createVirtualEnvUnix(path) {
return runCmdUnix('python3.10', ['-m', 'venv', path]);
runCmdUnix('python3.10', ['-m', 'venv', path]);
}

function isPythonInstalledUbuntu() {
Expand All @@ -211,11 +210,11 @@ function installGitUbuntu() {
}

function createVirtualEnvUbuntu(path) {
return runCmdUnix('python3.10', ['-m', 'venv', path]);
runCmdUnix('python3.10', ['-m', 'venv', path]);
}

function installOperatePackageUnix(path) {
return runCmdUnix(`${path}/venv/bin/python3.10`, [
runCmdUnix(`${path}/venv/bin/python3.10`, [
'-m',
'pip',
'install',
Expand All @@ -225,7 +224,7 @@ function installOperatePackageUnix(path) {

function reInstallOperatePackageUnix(path) {
console.log(appendLog('Reinstalling pearl CLI'));
return runCmdUnix(`${path}/venv/bin/python3.10`, [
runCmdUnix(`${path}/venv/bin/python3.10`, [
'-m',
'pip',
'install',
Expand Down
Loading
Loading