From 9bd29152ad44f44e77fe47cb1ece93c0d9c8159c Mon Sep 17 00:00:00 2001 From: "Chakhsu.Lau" Date: Mon, 13 Nov 2023 18:05:57 +0800 Subject: [PATCH] feat: add test github ci --- .github/workflows/tests.yml | 35 +++++++++++++++++++++++++++++++++++ package.json | 3 +++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..734bb49 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,35 @@ +name: Test CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + test: + name: Test on Node.js ${{ matrix.node-version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + node-version: [16.x, 18.x, 20.x] + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + cache: 'npm' + node-version: ${{ matrix.node-version }} + # Use separate run commands so command status handled correctly on Windows + - name: npm install + run: npm ci + - name: npm test + run: npm test + - name: npm run lint + run: npm run lint \ No newline at end of file diff --git a/package.json b/package.json index 34ee82b..f02923d 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,9 @@ "lint": "standard -v 'lib/**/*.js' 'test/**/*.js' | snazzy", "type-gen": "tsc -d --allowJs --outDir types index.js" }, + "engines": { + "node": ">=16" + }, "dependencies": { "@grpc/grpc-js": "^1.9.7", "@grpc/proto-loader": "^0.7.10",