Skip to content

Commit ee715f6

Browse files
committed
Switch to Github Actions
1 parent a1af638 commit ee715f6

10 files changed

+168
-193
lines changed

.github/workflows/lint.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: sails-mongo lint
2+
3+
on:
4+
push
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-22.04
9+
10+
strategy:
11+
matrix:
12+
node-version: [20]
13+
14+
steps:
15+
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Install dependencies
20+
run: |
21+
npm install --no-audit --no-fund
22+
23+
- name: Lint the code
24+
run: |
25+
npm run lint-test

.github/workflows/test-ubuntu.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: sails-mongo test (Ubuntu)
2+
3+
on:
4+
push
5+
6+
env:
7+
WATERLINE_ADAPTER_TESTS_URL: mongo/testdb:27027
8+
WATERLINE_ADAPTER_TESTS_HOST: mongo
9+
WATERLINE_ADAPTER_TESTS_DATABASE: sails-mongo
10+
NODE_ENV: test
11+
12+
jobs:
13+
test-ubuntu:
14+
runs-on: ubuntu-22.04
15+
container: node:${{ matrix.node-version }}
16+
17+
strategy:
18+
matrix:
19+
node-version: [16, 18, 20]
20+
mongodb-version: ['4.4', '5', '6', '7']
21+
22+
services:
23+
mongo:
24+
image: mongo:${{ matrix.mongodb-version }}
25+
ports:
26+
- 27027:27017
27+
28+
steps:
29+
30+
- name: Checkout repository
31+
uses: actions/checkout@v3
32+
33+
- name: Install dependencies
34+
run: |
35+
node --eval "console.log('Running Node.js: ' + process.version)"
36+
node --eval "console.log('Current directory: ' + process.cwd())"
37+
node --eval "console.log('Files in directory: ' + require('fs').readdirSync(process.cwd()))"
38+
npm install --no-audit --no-fund
39+
40+
- name: Test it out
41+
run: |
42+
npm run custom-tests

.github/workflows/test-windows.yaml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: sails-mongo test (Windows)
2+
3+
on:
4+
push
5+
6+
env:
7+
WATERLINE_ADAPTER_TESTS_URL: 127.0.0.1/testdb
8+
WATERLINE_ADAPTER_TESTS_HOST: 127.0.0.1
9+
WATERLINE_ADAPTER_TESTS_DATABASE: sails-mongo
10+
NODE_ENV: test
11+
12+
jobs:
13+
test-windows:
14+
runs-on: windows-2022
15+
16+
strategy:
17+
matrix:
18+
node-version: [16.x, 18.x, 20.x]
19+
mongodb-version: ['5.0']
20+
21+
steps:
22+
- uses: ankane/setup-mongodb@ce30d9041565cb469945895d5bde3384a254dd2e # use commit ID until action is versioned, see https://github.com/ankane/setup-mongodb/issues/2
23+
with:
24+
mongodb-version: ${{ matrix.mongodb-version }}
25+
26+
- name: Wait for MongoDB to start
27+
run: |
28+
while ($true) {
29+
$status = Get-Service MongoDB | Select-Object -ExpandProperty Status
30+
if ($status -eq "Running") {
31+
Write-Host "MongoDB is running."
32+
break
33+
}
34+
Write-Host "Waiting for MongoDB to start..."
35+
Start-Sleep -Seconds 5
36+
}
37+
shell: pwsh
38+
39+
- name: Install Mongodb Shell
40+
run: |
41+
choco install mongodb-shell -y
42+
shell: pwsh
43+
44+
- name: Check connection to Mongodb using mongodb shell
45+
run: |
46+
mongosh --eval "db.adminCommand('listDatabases')"
47+
48+
- name: Use Node.js ${{ matrix.node-version }}
49+
uses: actions/setup-node@v3
50+
with:
51+
node-version: ${{ matrix.node-version }}
52+
53+
- name: Checkout repository
54+
uses: actions/checkout@v3
55+
56+
- name: Install dependencies
57+
run: |
58+
npm install --no-audit --no-fund
59+
60+
- name: Test code
61+
run: |
62+
npm run custom-tests

.travis.yml

-70
This file was deleted.

appveyor.yml

-67
This file was deleted.

docker-compose.yml

+23-21
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
adapter:
2-
image: node:12
3-
volumes:
4-
- $PWD:/home/node/sails-mongo
5-
links:
6-
- mongo
7-
environment:
8-
- WATERLINE_ADAPTER_TESTS_DATABASE=sails-mongo
9-
- WATERLINE_ADAPTER_TESTS_URL=mongo/testdb
10-
- WATERLINE_ADAPTER_TESTS_HOST=mongo
11-
- NODE_ENV=test
12-
user: node
13-
working_dir: /home/node/sails-mongo
14-
command:
15-
- bash -c "npm test"
1+
version: "3.8"
2+
services:
3+
adapter:
4+
image: node:20
5+
volumes:
6+
- $PWD:/home/node/sails-mongo
7+
links:
8+
- mongo
9+
environment:
10+
- WATERLINE_ADAPTER_TESTS_DATABASE=sails-mongo
11+
- WATERLINE_ADAPTER_TESTS_URL=mongo/testdb
12+
- WATERLINE_ADAPTER_TESTS_HOST=mongo
13+
- NODE_ENV=test
14+
user: node
15+
working_dir: /home/node/sails-mongo
16+
command:
17+
- bash -c "npm test"
1618

17-
mongo:
18-
image: mongo:4.2
19-
restart: always
20-
command: "--logpath=/dev/null"
21-
ports:
22-
- "27017:27017"
19+
mongo:
20+
image: mongo:7
21+
restart: always
22+
command: "--logpath=/dev/null"
23+
ports:
24+
- "27017:27017"

package.json

+15-13
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
"description": "Mongo DB adapter for Sails.js/Waterline.",
55
"main": "./lib",
66
"scripts": {
7-
"test": "npm run lint && npm run custom-tests",
7+
"test": "npm run lint-test && npm run custom-tests",
88
"custom-tests": "node node_modules/mocha/bin/mocha test/run-adapter-specific-tests && node node_modules/mocha/bin/mocha test/connectable/ && node test/run-standard-tests",
9-
"lint": "node node_modules/eslint/bin/eslint . --max-warnings=0",
10-
"start-mongodb": "docker-compose up -d mongo",
11-
"stop-mongodb": "docker-compose down",
12-
"docker": "docker-compose run adapter bash",
13-
"mongodb-shell": "docker-compose exec mongo mongo",
14-
"docker-test": "docker-compose run adapter bash -c \"npm test\" && docker-compose down"
9+
"lint": "node node_modules/eslint/bin/eslint . --max-warnings=0 ",
10+
"lint-test": "node node_modules/eslint/bin/eslint --rule \"linebreak-style: 0\" --max-warnings=0 . ",
11+
"start-mongodb": "docker compose up -d mongo",
12+
"stop-mongodb": "docker compose down",
13+
"docker": "docker compose run adapter bash",
14+
"mongodb-shell": "docker compose exec mongo mongosh",
15+
"docker-test": "docker compose run adapter bash -c \"npm test\" && docker compose down"
1516
},
1617
"keywords": [
1718
"mongo",
@@ -30,7 +31,7 @@
3031
"url": "git://github.com/balderdashy/sails-mongo.git"
3132
},
3233
"dependencies": {
33-
"@sailshq/lodash": "^3.10.4",
34+
"@sailshq/lodash": "3.10.4",
3435
"async": "3.2.4",
3536
"flaverr": "^1.10.0",
3637
"machine": "^15.2.2",
@@ -39,12 +40,13 @@
3940
},
4041
"devDependencies": {
4142
"benchmark": "2.1.4",
42-
"eslint": "8.41.0",
43-
"eslint-plugin-eslint-comments": "^3.2.0",
43+
"eslint": "8.50.0",
44+
"eslint-plugin-eslint-comments": "3.2.0",
4445
"mocha": "3.0.2",
45-
"waterline": "^0.13.6",
46-
"waterline-adapter-tests": "^1.0.1",
47-
"waterline-utils": "^1.4.2"
46+
"debug": "4.3.4",
47+
"waterline": "0.15.2",
48+
"waterline-adapter-tests": "1.0.1",
49+
"waterline-utils": "1.4.5"
4850
},
4951
"waterlineAdapter": {
5052
"interfaces": [

scripts/appveyor/install_mongodb.ps1

-20
This file was deleted.

scripts/travis/install_mongodb.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
MDB_TGZ=mongodb-linux-x86_64-ubuntu1604-${MONGODB}.tgz
3+
MDB_TGZ=mongodb-linux-x86_64-ubuntu2004-${MONGODB}.tgz
44
MDB_ROOT=${TRAVIS_BUILD_DIR}/mongodb/${MONGODB}
55
MDB_DATA=${TRAVIS_BUILD_DIR}/mongodb-data
66

0 commit comments

Comments
 (0)