From 255764de0992a001951b530123c42c97e8deeaa0 Mon Sep 17 00:00:00 2001 From: microshine Date: Wed, 25 Nov 2020 13:18:52 +0300 Subject: [PATCH] ci: Use github actions --- .circleci/config.yml | 29 ------------------------ .github/workflows/test.yml | 45 ++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 46 insertions(+), 29 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/test.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 4e63641..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: 2 -jobs: - build: - working_directory: ~/mern-starter # directory where steps will run - docker: # run the steps with Docker - - image: circleci/node:10.15.0 - steps: - - checkout - - run: - name: update-npm - command: 'sudo npm install -g npm@latest' - - restore_cache: # special step to restore the dependency cache - key: dependency-cache-{{ checksum "package.json" }} - - run: - name: install-deps - command: npm install - - save_cache: # special step to save the dependency cache - key: dependency-cache-{{ checksum "package.json" }} - paths: - - ./node_modules - - run: # lint - name: lint - command: npm run lint - - run: # run tests with code coverage - name: test-code-coverage - command: npm run coverage - - run: # run coveralls report - name: test-report-coveralls - command: npm run coveralls diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..69bf991 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: Node.js CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x] + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Install dependencies + run: npm install + + - name: Run linter + run: npm run lint + + - name: Run test with coverage + run: npm run coverage + + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index a34e91f..35970e6 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "**/*.d.ts" ], "reporter": [ + "lcov", "text-summary", "html" ]