From 68f92bc46f7ee0cc4239b4a76c09df476f2b3e9b Mon Sep 17 00:00:00 2001 From: Alice Rose Murphy Date: Thu, 15 Aug 2024 16:52:29 +0300 Subject: [PATCH] use GH actions instead of Travis CI --- .editorconfig | 2 +- .github/workflows/main.yml | 46 ++++++++++++++++++++++++++++++++ .github/workflows/node-ci.js.yml | 27 ------------------- .travis.yml | 5 ---- package.json | 4 +-- 5 files changed, 49 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/node-ci.js.yml delete mode 100644 .travis.yml diff --git a/.editorconfig b/.editorconfig index 8311fe1..c04c4c1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,7 +8,7 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -[package.json] +[*.{json,yml}] indent_style = space indent_size = 2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ff30b5f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,46 @@ +name: CI +on: + - push + - pull_request +env: + latest-node: 22.x + +jobs: + test: + name: Test + runs-on: ubuntu-latest + + strategy: + matrix: + node: + - version: 18.x + - version: 20.x + - version: ${{ env.latest-node }} + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node.version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node.version }} + cache: "npm" + - run: npm ci + - run: npm test + + coverage: + name: Coverage + runs-on: ubuntu-latest + needs: test + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.latest-node }} + cache: "npm" + + - name: Coverage + run: npm run coverage:lcov + + - name: Coveralls + uses: coverallsapp/github-action@v2.3.0 diff --git a/.github/workflows/node-ci.js.yml b/.github/workflows/node-ci.js.yml deleted file mode 100644 index 7b96e31..0000000 --- a/.github/workflows/node-ci.js.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Node.js CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.x, 20.x, 22.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: npm test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0bb482f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - '14' -after_script: - - npm run coveralls diff --git a/package.json b/package.json index 1ada731..5695a42 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ }, "scripts": { "test": "mocha -R spec", - "coverage": "nyc --reporter=html npm run test", - "coveralls": "nyc --reporter=lcovonly npm run test && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage" + "coverage:html": "nyc --reporter=html npm run test", + "coverage:lcov": "nyc --reporter=lcovonly npm run test" }, "files": [ "index.js"