From 78c8bbd036b3419e18c43006ac6f8d75cf769774 Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Wed, 31 Mar 2021 16:07:44 +0800 Subject: [PATCH] ci: migrate to GitHub Actions (#247) --- .github/workflows/linter.yml | 20 ++++++++++++++++ .github/workflows/tester.yml | 46 ++++++++++++++++++++++++++++++++++++ .gitignore | 1 + .travis.yml | 23 ------------------ package.json | 2 +- 5 files changed, 68 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/linter.yml create mode 100644 .github/workflows/tester.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 00000000..6dc94c72 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,20 @@ +name: Linter + +on: [push, pull_request] + +jobs: + linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 14.x + uses: actions/setup-node@v2 + with: + node-version: '14.x' + - name: Install Dependencies + run: npm install + - name: Lint + run: | + npm run eslint + env: + CI: true diff --git a/.github/workflows/tester.yml b/.github/workflows/tester.yml new file mode 100644 index 00000000..dd848c87 --- /dev/null +++ b/.github/workflows/tester.yml @@ -0,0 +1,46 @@ +name: Tester + +on: [push, pull_request] + +jobs: + tester: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node-version: ['12.x', '14.x'] + fail-fast: false + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Install Dependencies + run: npm install + - name: Test + run: npm run test + env: + CI: true + coverage: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + node-version: ['14.x'] + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Install Dependencies + run: npm install + - name: Coverage + run: npm run test-cov + env: + CI: true + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} diff --git a/.gitignore b/.gitignore index 1406785e..53390071 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ tmp/ .idea/ .nyc_output/ highlight_alias.json +coverage/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5132d7a9..00000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -os: - - linux - - windows - -language: node_js - -cache: - npm: true - -node_js: - - "10" - - "12" - - "14" - -script: - - if [[ $TRAVIS_OS_NAME == "linux" ]]; then - npm run eslint; - fi - - npm run test-cov - -after_script: - - npm install coveralls - - nyc report --reporter=text-lcov | coveralls diff --git a/package.json b/package.json index 25a94cac..d3e139fb 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "eslint": "eslint lib test", "test": "mocha", - "test-cov": "nyc npm run test", + "test-cov": "nyc --reporter=lcovonly npm run test", "build:highlight": "node scripts/build_highlight_alias.js", "prepare": "npm run build:highlight" },