From fe7c8ff69402302901010d96a8a579264ef3fddf Mon Sep 17 00:00:00 2001 From: Alec Gibson Date: Thu, 26 Nov 2020 09:46:31 +0000 Subject: [PATCH] Move to Github Actions This change is a read-across of: https://github.com/share/sharedb/pull/409 It moves us on to Github Actions, because Travis has been pretty slow lately. Github Actions is also free for public repositories and is (for now) much faster than Travis. While we're here, we also update our tested Node and MongoDB versions in-line with their respective LTS schedules. --- .github/workflows/test.yml | 58 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 28 ------------------ package.json | 4 +-- 3 files changed, 60 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..1a12277d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,58 @@ +name: Test + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + name: Node.js ${{ matrix.node }} + mongoDB ${{ matrix.mongodb }} + runs-on: ubuntu-latest + strategy: + matrix: + node: + - 10 + - 12 + - 14 + mongodb: + - 3.6 + - 4.0 + - 4.2 + - 4.4 + services: + mongodb: + image: mongo:${{ matrix.mongodb }} + ports: + - 27017:27017 + timeout-minutes: 10 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + - name: Install + run: npm install + - name: Lint + run: npm run lint + - name: Test + run: npm run test-cover + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: node-${{ matrix.node }}-mongodb-${{ matrix.mongodb }} + parallel: true + + finish: + needs: test + runs-on: ubuntu-latest + steps: + - name: Submit coverage + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 24395319..00000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: node_js - -node_js: - - "12" - - "10" - - "8" - -services: - - docker - -env: - - MONGODB_VERSION="4.2" - - MONGODB_VERSION="4.0" - - MONGODB_VERSION="3.6" - - MONGODB_VERSION="3.4" - -before_install: - - docker run -d -p 127.0.0.1:27017:27017 mongo:$MONGODB_VERSION - -before_script: - - until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done - -script: - - npm run test-cover - -# Send coverage data to Coveralls -after_script: - - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js diff --git a/package.json b/package.json index 3f4003d9..ceee5967 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "scripts": { "lint": "./node_modules/.bin/eslint --ignore-path .gitignore '**/*.js'", "lint:fix": "npm run lint -- --fix", - "test": "npm run lint && node_modules/.bin/mocha", - "test-cover": "npm run lint && node_modules/nyc/bin/nyc.js --temp-dir=coverage -r text -r lcov node_modules/mocha/bin/_mocha" + "test": "mocha", + "test-cover": "nyc --temp-dir=coverage -r text -r lcov npm test" }, "repository": "git://github.com/share/sharedb-mongo.git", "author": "Nate Smith and Joseph Gentle",