Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/actions/catch-install-pnpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ runs:

- name: Install dependencies
shell: bash
run: pnpm install
run: pnpm install --frozen-lockfile
184 changes: 141 additions & 43 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
jobs:
checker:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
if: ${{ !contains(github.event.pull_request.title, '[skip checker]') }}
steps:
- name: Checkout repository
Expand All @@ -18,85 +21,176 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/catch-install-pnpm

- name: Build dms-kit (required for checker)
run: pnpm turbo run build --filter=@actiontech/dms-kit

- name: Code lint checker
run: pnpm checker
run: pnpm run checker

test-ee:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
JEST_TEST_VERSION_ENV: ee
if: ${{ !contains(github.event.pull_request.title, '[skip checker]') }}
strategy:
matrix:
shard: [1, 2, 3, 4]
package: [base, '@actiontech/dms-kit', '@actiontech/shared', sqle]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/catch-install-pnpm

- name: Coverage test report ee
run: sh ./scripts/jest/run-ci-ee.sh ${{ matrix.shard }} ${{ strategy.job-total }}
- name: Build dms-kit (required for tests)
run: pnpm turbo run build --filter=@actiontech/dms-kit

- name: Coverage test report ee - ${{ matrix.package }}
run: pnpm turbo run test:coverage:ci --filter=${{ matrix.package }}

- name: Collect coverage artifacts
if: always()
run: |
mkdir -p coverage-artifacts
# Map package names to directory names
PACKAGE_DIR=""
case "${{ matrix.package }}" in
"base")
PACKAGE_DIR="base"
;;
"@actiontech/dms-kit")
PACKAGE_DIR="dms-kit"
;;
"@actiontech/shared")
PACKAGE_DIR="shared"
;;
"sqle")
PACKAGE_DIR="sqle"
;;
esac
# Copy coverage files from package directory or root coverage directory
if [ -n "$PACKAGE_DIR" ] && [ -d "packages/$PACKAGE_DIR/coverage" ]; then
cp -r packages/$PACKAGE_DIR/coverage/* coverage-artifacts/ 2>/dev/null || true
fi
if [ -d "coverage" ]; then
find coverage -maxdepth 1 -type f -name "*.json" -exec cp {} coverage-artifacts/ \; 2>/dev/null || true
fi
# Rename files to include package name (sanitize for filename)
PACKAGE_NAME_SANITIZED=$(echo "${{ matrix.package }}" | tr '/' '-' | tr '@' '')
if [ -f "coverage-artifacts/report.json" ]; then
mv coverage-artifacts/report.json coverage-artifacts/report-${PACKAGE_NAME_SANITIZED}-ee.json
fi
if [ -f "coverage-artifacts/coverage-final.json" ]; then
mv coverage-artifacts/coverage-final.json coverage-artifacts/coverage-final-${PACKAGE_NAME_SANITIZED}-ee.json
fi

- name: Set artifact name
if: always()
id: set-artifact-name
run: |
PACKAGE_NAME_SANITIZED=$(echo "${{ matrix.package }}" | tr '/' '-' | tr '@' '')
echo "name=coverage-artifacts-${PACKAGE_NAME_SANITIZED}-ee" >> $GITHUB_OUTPUT

- uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-artifacts-${{ matrix.shard }}
path: coverage/
name: ${{ steps.set-artifact-name.outputs.name }}
path: coverage-artifacts/

test-ce:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
JEST_TEST_VERSION_ENV: ce
if: ${{ !contains(github.event.pull_request.title, '[skip checker]') }}
strategy:
matrix:
package: [base, '@actiontech/dms-kit', '@actiontech/shared', sqle]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/catch-install-pnpm

- name: Coverage test report ce
run: sh ./scripts/jest/run-ci-ce.sh
- name: Build dms-kit (required for tests)
run: pnpm turbo run build --filter=@actiontech/dms-kit

- name: Coverage test report ce - ${{ matrix.package }}
run: pnpm turbo run test:coverage:ci --filter=${{ matrix.package }}

- name: Collect coverage artifacts
if: always()
run: |
mkdir -p coverage-artifacts
# Map package names to directory names
PACKAGE_DIR=""
case "${{ matrix.package }}" in
"base")
PACKAGE_DIR="base"
;;
"@actiontech/dms-kit")
PACKAGE_DIR="dms-kit"
;;
"@actiontech/shared")
PACKAGE_DIR="shared"
;;
"sqle")
PACKAGE_DIR="sqle"
;;
esac
# Copy coverage files from package directory or root coverage directory
if [ -n "$PACKAGE_DIR" ] && [ -d "packages/$PACKAGE_DIR/coverage" ]; then
cp -r packages/$PACKAGE_DIR/coverage/* coverage-artifacts/ 2>/dev/null || true
fi
if [ -d "coverage" ]; then
find coverage -maxdepth 1 -type f -name "*.json" -exec cp {} coverage-artifacts/ \; 2>/dev/null || true
fi
if [ -d "ce_coverage" ]; then
find ce_coverage -maxdepth 1 -type f -name "*.json" -exec cp {} coverage-artifacts/ \; 2>/dev/null || true
fi
# Rename files to include package name (sanitize for filename)
PACKAGE_NAME_SANITIZED=$(echo "${{ matrix.package }}" | tr '/' '-' | tr '@' '')
if [ -f "coverage-artifacts/report.json" ]; then
mv coverage-artifacts/report.json coverage-artifacts/report-${PACKAGE_NAME_SANITIZED}-ce.json
fi
if [ -f "coverage-artifacts/coverage-final.json" ]; then
mv coverage-artifacts/coverage-final.json coverage-artifacts/coverage-final-${PACKAGE_NAME_SANITIZED}-ce.json
fi

- name: Set artifact name
if: always()
id: set-artifact-name
run: |
PACKAGE_NAME_SANITIZED=$(echo "${{ matrix.package }}" | tr '/' '-' | tr '@' '')
echo "name=coverage-artifacts-${PACKAGE_NAME_SANITIZED}-ce" >> $GITHUB_OUTPUT

- uses: actions/upload-artifact@v4
if: always()
with:
name: ce-coverage-artifacts
path: ce_coverage/
name: ${{ steps.set-artifact-name.outputs.name }}
path: coverage-artifacts/

report:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
if: ${{ !contains(github.event.pull_request.title, '[skip checker]') }}
needs: [test-ee, test-ce]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get CE Coverage
uses: actions/download-artifact@v4
with:
name: ce-coverage-artifacts
path: ce_coverage

- name: Get EE Coverage 1
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-1
path: coverage

- name: Get EE Coverage 2
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-2
path: coverage

- name: Get EE Coverage 3
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-3
path: coverage

- name: Get EE Coverage 4
- name: Download all coverage artifacts
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-4
path: coverage
pattern: coverage-artifacts-*
path: coverage-all
merge-multiple: false

- name: Install dependencies
uses: ./.github/actions/catch-install-pnpm
Expand All @@ -111,12 +205,16 @@ jobs:
base-coverage-file: coverage-merged.json
coverage-file: coverage-merged.json

- name: Delete artifact
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v5
continue-on-error: true
with:
name: |
ce-coverage-artifacts
coverage-artifacts-1
coverage-artifacts-2
coverage-artifacts-3
coverage-artifacts-4
coverage-artifacts-base-ce
coverage-artifacts-base-ee
coverage-artifacts-actiontech-dms-kit-ce
coverage-artifacts-actiontech-dms-kit-ee
coverage-artifacts-actiontech-shared-ce
coverage-artifacts-actiontech-shared-ee
coverage-artifacts-sqle-ce
coverage-artifacts-sqle-ee
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# dependencies
/packages/*/node_modules
/scripts/**/node_modules
/cli/**/node_modules
/node_modules
/.pnpm-store
/.pnp
Expand All @@ -15,7 +15,7 @@ dist

# testing
/ce_coverage
/coverage
**/coverage/*
/report.json
/coverage-merged
/coverage-merged.json
Expand Down Expand Up @@ -53,4 +53,5 @@ verdaccio
ftp-data


/scripts/cli/dms-kit-publish/docs
/scripts/cli/dms-kit-publish/docs
.turbo
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ docker_clean:
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app -w /usr/src/app --rm $(DOCKER_IMAGE) sh -c "git config --global --add safe.directory /usr/src/app && git clean -dfx"

docker_build_ce: pull_image docker_install_node_modules
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app --user $(UID):$(GID) -w /usr/src/app --rm $(DOCKER_IMAGE) sh -c "pnpm build"
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app --user $(UID):$(GID) -w /usr/src/app --rm $(DOCKER_IMAGE) sh -c "node scripts/getGitVersion.mjs ce && pnpm build"

docker_build_ee: pull_image docker_install_node_modules
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app --user $(UID):$(GID) -w /usr/src/app --rm $(DOCKER_IMAGE) sh -c "pnpm build:ee"
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app --user $(UID):$(GID) -w /usr/src/app --rm $(DOCKER_IMAGE) sh -c "node scripts/getGitVersion.mjs ee && pnpm build:ee"

docker_build_demo: pull_image docker_install_node_modules
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app --user $(UID):$(GID) -w /usr/src/app --rm $(DOCKER_IMAGE) sh -c "pnpm build:demo"
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app --user $(UID):$(GID) -w /usr/src/app --rm $(DOCKER_IMAGE) sh -c "node scripts/getGitVersion.mjs trial && pnpm build:demo"

docker_dms_kit_publish: docker_install_node_modules
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app --user $(UID):$(GID) -w /usr/src/app --rm \
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions cli/create-dms-page/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import node from '@actiontech/dms-eslint-config/node';

/** @type {import("eslint").Linter.Config[]} */
export default [
...node,
{
files: ['src/**/*.{ts}']
// 可以在此处添加本包特有的覆盖规则
}
];
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@
],
"scripts": {
"build:watch": "tsc -w",
"build": "tsc"
"build": "tsc",
"eslint": "eslint src",
"eslint:fix": "eslint src --fix",
"ts-check": "tsc --noEmit"
},
"keywords": [],
"license": "ISC",
"devDependencies": {
"@types/babel__generator": "^7.6.8",
"@types/babel__traverse": "^7.20.6"
"@types/babel__traverse": "^7.20.6",
"@actiontech/dms-eslint-config": "workspace:^",
"@actiontech/dms-typescript-config": "workspace:^"
},
"dependencies": {
"@babel/generator": "^7.25.0",
Expand Down
21 changes: 21 additions & 0 deletions cli/create-dms-page/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "@actiontech/dms-typescript-config/base",
"include": ["./src"],
"exclude": ["node_modules", "dist", "./bin"],
"compilerOptions": {
"target": "ES6",
"module": "CommonJS" /* Specify what module code is generated. */,
"rootDir": "./src" /* Specify the root folder within your source files. */,
"moduleResolution": "Node" /* Specify how TypeScript looks up a file from a given module specifier. */,
"baseUrl": "./" /* Specify the base directory to resolve non-relative module names. */,
"resolveJsonModule": true /* Enable importing .json files */,
"allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */,
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true
}
}
13 changes: 13 additions & 0 deletions cli/dms-kit-publish/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import node from '@actiontech/dms-eslint-config/node';

/** @type {import("eslint").Linter.Config[]} */
export default [
...node,
{
files: ['src/**/*.{ts,js}']
// 可以在此处添加本包特有的覆盖规则,例如:
// rules: {
// 'no-console': 'off'
// }
}
];
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"scripts": {
"build:watch": "tsc -w",
"build": "tsc",
"start": "tsc && node dist/index.js"
"start": "tsc && node dist/index.js",
"eslint": "eslint src",
"eslint:fix": "eslint src --fix",
"ts-check": "tsc --noEmit"
},
"dependencies": {
"@octokit/rest": "^20.1.2",
Expand All @@ -27,6 +30,8 @@
"@types/archiver": "^6.0.3",
"@types/node": "^18.0.4",
"@types/nodemailer": "^7.0.3",
"@types/semver": "^7.7.1"
"@types/semver": "^7.7.1",
"@actiontech/dms-eslint-config": "workspace:^",
"@actiontech/dms-typescript-config": "workspace:^"
}
}
Loading
Loading