Skip to content

Commit

Permalink
#: Init Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
zdu-strong committed Oct 5, 2024
0 parents commit d4ebc00
Show file tree
Hide file tree
Showing 880 changed files with 35,574 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Docker Image CI

on:
push:
branches: [ "master", "database/cockroachdb", "database/spanner" ]
pull_request:
branches: [ "master" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@main
- name: Build the AliyunCloud
run: docker build . --file docker/src/AliyunCloud/Dockerfile --tag my-image-name:$(date +%s) && docker image prune --all --force

- uses: actions/checkout@main
- name: Build the client
run: docker build . --file docker/src/client/Dockerfile --tag my-image-name:$(date +%s) && docker image prune --all --force

- uses: actions/checkout@main
- name: Build the server
run: docker build . --file docker/src/server/Dockerfile --tag my-image-name:$(date +%s) && docker image prune --all --force

- uses: actions/checkout@main
- name: Build the ffcreator
run: docker build . --file docker/src/ffcreator/Dockerfile --tag my-image-name:$(date +%s) && docker image prune --all --force

- uses: actions/checkout@main
- name: Build the capacitor
run: docker build . --file docker/src/capacitor/Dockerfile --tag my-image-name:$(date +%s) && docker image prune --all --force

- uses: actions/checkout@main
- name: Build the electron
run: docker build . --file docker/src/electron/Dockerfile --tag my-image-name:$(date +%s) && docker image prune --all --force

- uses: actions/checkout@main
- name: Build the rust
run: docker build . --file docker/src/rust/Dockerfile --tag my-image-name:$(date +%s) && docker image prune --all --force
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## MIT License

Copyright (c) 2022 zdu https://github.com/zdu-strong/Technical_Backup

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Getting Started

This project is to do some knowledge backup.<br/>
If you have any questions, please contact [email protected].<br/>

### `Environmental description`

This repository uses git as its version management tool.

1. From https://git-scm.com install git.
2. Set Git user name and email:<br/>

git config --global user.name "your username"
git config --global user.email "your email"

3. Use git gui to clone the source code.

### `springboot`

Use java, springboot and mysql to build back-end projects.

### `react`

Use typescript and react to build front-end projects.

### `docker`

Use docker and rockylinux to build docker images of all projects.

### `electron`

Use typescript, electron and react to build desktop programs for mac, linux, windows.

### `capacitor`

Use typescript, capacitor and react to build ios apps and android apps.

### `react-cypress`

use typescript and cypress to write end-to-end tests for react project

### `capacitor-cypress`

use typescript and cypress to write automated tests for capacitor project

### `electron-playwright`

use typescript and playwright to write automated tests for electron project

### `ffcreator`

use typescript and ffcreator to generate cool videos

### `rust`

use rust to generate executable program

## Notes - Easier to use git

Sometimes, you'll see a prompt like this: This repository currently has approximately 1500 loose objects.<br/>
The warning dialog can be disabled with the following command.<br/>

git config --global gui.gcwarning false
30 changes: 30 additions & 0 deletions capacitor-cypress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# package lock file
/package-lock.json

# cypress
/cypress/videos
/cypress/screenshots
22 changes: 22 additions & 0 deletions capacitor-cypress/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"files.exclude": {
".gitignore": true,
"package-lock.json": true,
"tsconfig.json": true,
".vscode": true,
"bin": true,
"cypress/tsconfig.json": true,
"cypress/plugins": true,
"cypress/support": true,
"cypress.config.ts": true,
},
"files.autoSave": "onFocusChange",
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.codeActionsOnSave": {
"source.organizeImports": "never"
},
"extensions.ignoreRecommendations": true,
"git.enabled": false,
}
63 changes: 63 additions & 0 deletions capacitor-cypress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Getting Started

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). If you have any questions, please contact [email protected].<br/>

## Development environment setup
1. From https://code.visualstudio.com install Visual Studio Code.<br/>
2. From https://nodejs.org install nodejs v20.<br/>

## Available Scripts

In the project directory, you can run:<br/>

### `npm start`

Launches the test runner in the interactive watch mode.<br/>
See the section about [running tests](https://www.cypress.io) for more information.<br/>

### `npm test`

Run all unit tests.<br/>
See the section about [running tests](https://www.cypress.io) for more information.<br/>

## Install new dependencies

npm install react --save-dev

After installing new dependencies, please make sure that the project runs normally.<br/>
After installing new dependencies, please make sure that the dependent versions in package.json are all accurate versions.<br/>

## Upgrade dependency

You can use this command to check if a new version is available:<br/>

npx -y -p npm-check npm-check --update

After upgrading the dependencies, please make sure that the project runs normally.<br/>
After upgrading the dependencies, please make sure that the dependent versions in package.json are all accurate versions.<br/>

The following dependencies are currently unable to continue to be upgraded:<br/>
eslint<br/>
execa (Current project not support ES module)<br/>
get-port (Current project not support ES module)<br/>
typescript<br/>

## Notes - xpath - Select the node whose text contains "abc"

html:
<div>
<div class="flex">
abcd
</div>
<div class="flex">
hijk
</div>
</div>

xpath: //div[contains(@class, 'flex')][contains(., 'abc')]
count: 1

## Learn More

1. Cypress (https://www.cypress.io)<br/>
2. Xpath (https://www.w3schools.com/xml/xpath_syntax.asp)<br/>
46 changes: 46 additions & 0 deletions capacitor-cypress/bin/pre_load_configuration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const fs = require('fs')
const path = require('path')
const { execSync } = require('child_process')

async function main() {
await deletePackageLockFile();
await deleteBuildFolder();
await installDependencies();
await eslint()
process.exit()
}

async function installDependencies() {
execSync(
[
"npm install",
].join(" "),
{
stdio: "inherit",
cwd: path.join(__dirname, ".."),
env: {
...process.env,
"npm_config_package_lock": "false",
},
}
);
}

async function deletePackageLockFile() {
const filePathOfPackageLockFile = path.join(__dirname, "..", "package-lock.json");
await fs.promises.rm(filePathOfPackageLockFile, { recursive: true, force: true });
}

async function deleteBuildFolder() {
const folderPath = path.join(__dirname, "..", "build");
await fs.promises.rm(folderPath, { recursive: true, force: true });
}

async function eslint() {
execSync("eslint cypress", {
stdio: "inherit",
cwd: path.join(__dirname, "..")
})
}

module.exports = main()
63 changes: 63 additions & 0 deletions capacitor-cypress/bin/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const execa = require('execa')
const getPort = require('get-port')
const treeKill = require('tree-kill')
const util = require('util')
const path = require('path')
const waitOn = require('wait-on')
const { timer } = require('rxjs')

async function main() {
const { avaliablePort, childProcessOfReact } = await startReact();
const { childProcessOfCypress } = await startCypress(avaliablePort);

await Promise.race([childProcessOfReact, childProcessOfCypress]);
await util.promisify(treeKill)(childProcessOfReact.pid).catch(async () => null);
await util.promisify(treeKill)(childProcessOfCypress.pid).catch(async () => null);

process.exit();
}

async function startCypress(avaliablePort) {
const childProcessOfCypress = execa.command(
[
'cypress open',
"--e2e"
].join(' '),
{
stdio: 'inherit',
cwd: path.join(__dirname, '..'),
extendEnv: true,
env: {
"CYPRESS_BASE_URL": `http://127.0.0.1:${avaliablePort}`,
"CYPRESS_VERIFY_TIMEOUT": "120000",
},
}
);
return { childProcessOfCypress };
}

async function startReact() {
const avaliablePort = await getPort();
const childProcessOfReact = execa.command(
[
'npm start',
].join(' '),
{
stdio: 'inherit',
cwd: path.join(__dirname, '../../capacitor'),
extendEnv: true,
env: {
"PORT": `${avaliablePort}`,
'CAPACITOR_CYPRESS_IS_TEST': "true",
},
}
);

await Promise.race([childProcessOfReact, waitOn({ resources: [`http://127.0.0.1:${avaliablePort}`] })]);
for (let i = 1000; i > 0; i--) {
await timer(1).toPromise();
}
return { avaliablePort, childProcessOfReact };
}

module.exports = main()
Loading

0 comments on commit d4ebc00

Please sign in to comment.