diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 2a05f11..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,74 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "master" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "master" ] - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Use only 'java' to analyze code written in Java, Kotlin or both - # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 99408f2..7ff7b2a 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -3,7 +3,6 @@ name: CI on: push: branches: [ master ] - pull_request: branches: [ master ] @@ -13,5 +12,7 @@ jobs: uses: node-modules/github-actions/.github/workflows/node-test-mysql.yml@master with: os: 'ubuntu-latest' - version: '16, 18, 20' - mysql_version: '5, 8' + version: '16, 18, 20, 22' + mysql_version: '5, 8, 9' + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index c52989f..e6a1aa0 100644 --- a/README.md +++ b/README.md @@ -433,19 +433,33 @@ const session = new db.literals.Literal('session()'); +---------------+ ``` +## For the local dev + +Run docker compose to start test mysql service + +```bash +docker compose -f docker-compose.yml up -d +# if you run the first time, should wait for ~20s to let mysql service init started +``` + +Run the unit tests + +```bash +npm test +``` + +Stop test mysql service + +```bash +docker compose -f docker-compose.yml down +``` + ## License [MIT](LICENSE) - - ## Contributors -|[
fengmk2](https://github.com/fengmk2)
|[
semantic-release-bot](https://github.com/semantic-release-bot)
|[
dead-horse](https://github.com/dead-horse)
|[
AntiMoron](https://github.com/AntiMoron)
|[
gxkl](https://github.com/gxkl)
|[
nodejh](https://github.com/nodejh)
| -| :---: | :---: | :---: | :---: | :---: | :---: | -|[
fangk](https://github.com/fangk)
|[
xujihui1985](https://github.com/xujihui1985)
|[
csbun](https://github.com/csbun)
|[
popomore](https://github.com/popomore)
|[
hoythan](https://github.com/hoythan)
|[
deadhorse123](https://github.com/deadhorse123)
| -[
killagu](https://github.com/killagu)
|[
qile222](https://github.com/qile222)
|[
RaoHai](https://github.com/RaoHai)
- -This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Tue Jan 30 2024 21:16:24 GMT+0800`. +[![Contributors](https://contrib.rocks/image?repo=node-modules/rds)](https://github.com/node-modules/rds/graphs/contributors) - +Made with [contributors-img](https://contrib.rocks). diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5bd3ce9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +name: eggjs_rds_dev_services_mysql + +services: + mysql: + image: mysql:9 + environment: + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-} + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: ${MYSQL_DATABASE:-test} + ports: + - 3306:3306 + healthcheck: + test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost'] + interval: 10s + timeout: 5s + retries: 5 + restart: unless-stopped diff --git a/package.json b/package.json index f38eafa..e9921de 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "prepublishOnly": "npm run clean && npm run build" }, "dependencies": { - "mysql2": "^3.9.1" + "mysql2": "^3.9.1", + "sqlstring": "^2.3.3" }, "devDependencies": { "@eggjs/tsconfig": "^1.3.2", @@ -26,7 +27,6 @@ "egg-bin": "^6.1.2", "eslint": "^8.29.0", "eslint-config-egg": "^12.1.0", - "git-contributor": "^2.0.0", "mm": "^3.3.0", "typescript": "^5.1.3" }, diff --git a/test/config.ts b/test/config.ts index 79a2b93..cef0352 100644 --- a/test/config.ts +++ b/test/config.ts @@ -1,7 +1,7 @@ export default { - host: process.env.TEST_ALI_RDS_HOST || '127.0.0.1', - port: parseInt(process.env.TEST_ALI_RDS_PORT || '3306'), - user: process.env.TEST_ALI_RDS_USER || 'root', - password: process.env.TEST_ALI_RDS_PASSWORD || '', - database: process.env.TEST_ALI_RDS_DATABASE || 'test', + host: process.env.TEST_ALI_RDS_HOST ?? '127.0.0.1', + port: parseInt(process.env.TEST_ALI_RDS_PORT ?? '3306'), + user: process.env.TEST_ALI_RDS_USER ?? 'root', + password: process.env.TEST_ALI_RDS_PASSWORD ?? '', + database: process.env.TEST_ALI_RDS_DATABASE ?? 'test', };