Skip to content
This repository was archived by the owner on May 31, 2022. It is now read-only.

Commit c356eb1

Browse files
authored
ci: Move CI to GitHub Actions (#331)
* Move CI to GitHub Actions * Remove travis config * Run CI on all PRs * Fix 'add sources' step * Pin ubuntu version * Update action name * Update README badge * Clean up mongo* processes just in case * Use latest Ubuntu and skip installation
1 parent b25a4bf commit c356eb1

File tree

4 files changed

+72
-22
lines changed

4 files changed

+72
-22
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This action runs lint checks and tests against the code.
2+
name: Check and Test
3+
4+
# Controls when the action will run.
5+
on:
6+
# Triggers the workflow on pushes to master and pull requests for any branch
7+
push:
8+
branches: [master]
9+
pull_request:
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
check-and-test:
17+
name: Check and Test
18+
# The type of runner that the job will run on
19+
runs-on: ubuntu-20.04
20+
21+
strategy:
22+
matrix:
23+
mongodb_version: [stable, unstable]
24+
25+
env:
26+
MONGODB_VERSION: ${{ matrix.mongodb_version }}
27+
MONGODB_TOPOLOGY: standalone
28+
29+
# Steps represent a sequence of tasks that will be executed as part of the job
30+
steps:
31+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
32+
- uses: actions/checkout@v2
33+
34+
- name: Setup Node.js environment
35+
uses: actions/setup-node@v2.1.2
36+
with:
37+
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0
38+
node-version: 12.4.0
39+
40+
- name: Cache node modules
41+
uses: actions/cache@v2
42+
env:
43+
cache-name: cache-node-modules
44+
with:
45+
# npm cache files are stored in `~/.npm` on Linux/macOS
46+
path: ~/.npm
47+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
48+
restore-keys: |
49+
${{ runner.os }}-build-${{ env.cache-name }}-
50+
${{ runner.os }}-build-
51+
${{ runner.os }}-
52+
53+
- name: Install Dependencies
54+
run: npm install
55+
56+
- name: Run Checks
57+
run: npm run check
58+
59+
- name: Run Tests
60+
run: npm run test
61+
62+
- name: Maybe Clean-Up
63+
# Apparently sometimes mongodb-runner that is used in tests can leave
64+
# mongo processes still running after tests are done. This step should
65+
# ensure that no mongo process is running anymore
66+
run: |
67+
echo "Terminating rogue mongo servers ..."
68+
killall -v -KILL mongod || true
69+
killall -v -KILL mongos || true

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
.travis.yml
21
examples/
32
test/
43
*.pem

.travis.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# mongodb-connection-model [![][travis_img]][travis_url] [![][npm_img]][npm_url] [![][inch_img]][inch_url]
1+
# mongodb-connection-model [![][workflow_img]][workflow_url] [![][npm_img]][npm_url] [![][inch_img]][inch_url]
22

33
> MongoDB connection model
44
@@ -460,8 +460,8 @@ This will log the following events to the console:
460460

461461
Apache 2.0
462462

463-
[travis_img]: https://img.shields.io/travis/mongodb-js/connection-model.svg?style=flat-square
464-
[travis_url]: https://travis-ci.org/mongodb-js/connection-model
463+
[workflow_img]: https://github.com/mongodb-js/connection-model/workflows/Check%20and%20Test/badge.svg?event=push
464+
[workflow_url]: https://github.com/mongodb-js/connection-model/actions?query=workflow%3A%22Check+and+Test%22
465465
[npm_img]: https://img.shields.io/npm/v/mongodb-connection-model.svg?style=flat-square
466466
[npm_url]: https://www.npmjs.org/package/mongodb-connection-model
467467
[inch_img]: http://inch-ci.org/github/mongodb-js/connection-model.svg?branch=master

0 commit comments

Comments
 (0)