From b8ec22e0c7a7a470d06ec7638d161f1ea6e42e31 Mon Sep 17 00:00:00 2001 From: Kayo Souza Date: Mon, 31 Jul 2023 09:15:29 -0300 Subject: [PATCH] Add test workflow --- .editorconfig | 4 ++++ .github/workflows/nodejs.yml | 35 +++++++++++++++++++++++++++++++++++ jsconfig.json | 3 ++- package-lock.json | 20 +++++++++++++++++++- package.json | 7 ++++++- 5 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/nodejs.yml diff --git a/.editorconfig b/.editorconfig index 1b83267..c90cf1c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,3 +7,7 @@ end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true + +[*.yml] +indent_size = 2 +indent_style = space diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 0000000..6131604 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,35 @@ +name: Node.js CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + node-version: [16.x, 18.x, 20.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - name: Install dependencies + run: npm ci --fund=false + - name: Type checking + run: npx tsc -p jsconfig.json + - name: Test project + run: npm test + env: + TOKEN: ${{ secrets.TOKEN }} + USER_ID: ${{ secrets.USERID }} + SESSION_ID: ${{ secrets.SESSIONID }} diff --git a/jsconfig.json b/jsconfig.json index c0cddcd..5dc0760 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -13,7 +13,8 @@ "typeRoots": [ "node_modules/@types", "src/typings" - ] + ], + "noEmit": true }, "exclude": [ "node_modules", diff --git a/package-lock.json b/package-lock.json index fa005f6..4a5bc7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,12 @@ "devDependencies": { "@types/mime": "^3.0.1", "@types/node": "^20.4.5", - "@types/sharp": "^0.31.1" + "@types/sharp": "^0.31.1", + "typescript": "^5.1.6" + }, + "engines": { + "node": ">=16", + "npm": ">=8" } }, "node_modules/@types/mime": { @@ -679,6 +684,19 @@ "node": "*" } }, + "node_modules/typescript": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 9bce66e..82ccaf2 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,15 @@ "devDependencies": { "@types/mime": "^3.0.1", "@types/node": "^20.4.5", - "@types/sharp": "^0.31.1" + "@types/sharp": "^0.31.1", + "typescript": "^5.1.6" }, "bin": { "instadl": "src/index.js" }, + "engines": { + "npm": ">=8", + "node": ">=16" + }, "type": "module" }