未验证 提交 54a61b76 编写于 作者: A Antonio Davi Macedo Coelho de Castro 提交者: GitHub

GitHub actions (#7035)

* Trying to setup GitHub Actions

* Try to fix the workflow steps

* Fix NODE_VERSION

* Fix services

* Fix services 2

* Fix redis service, remove docker service

* Missing npm install

* Fix Use Node.js step name

* Remove greenkeeper

* I believe we do not need this command

* Try to include postgres

* Fix postgres script

* Remove before install script

* Fix postgres before script

* Try to fix connection to postgres

* Fix postgress port

* Postgres host

* Still trying to connect on postgres

* Still trying to connect on postgres - localhost

* Split postgres in a separate job

* Add postgres healthcheck

* Set postgres just like github example

* Fix postgres scripts with new credentials

* Still trying to fix postgres connection

* Now it looks only the username is wrong

* Passing postgres password in the right way

* try to install postgis

* New attempt to install postgis

* Fix postgis image name

* Try to output tests

* We need to start mongo

* Increase tests timeout

* Fix flaky test

* Add GitHub Actions badge

* Badge as html

* Fix badge link

* Remove Travis

* try to fix coverage

* Fix flaky test

* Improve ci workflow

* Change the mongo default test version

* Fix the job name in the if clause

* Ubuntu18.0.4

* Downgrade to 4.0.21

* Fix cache keys:

* Trying with mongo 4.0.4

* Rever os and mongo versions

* remove latest node
上级 da905a35
name: ci
on:
push:
branches:
- master
pull_request:
branches:
- '**'
env:
COVERAGE_OPTION: ./node_modules/.bin/nyc
NODE_VERSION: 10
PARSE_SERVER_TEST_TIMEOUT: 20000
jobs:
check-mongo:
strategy:
matrix:
include:
- name: Mongo 4.0.4, ReplicaSet, WiredTiger
MONGODB_VERSION: 4.0.4
MONGODB_TOPOLOGY: replicaset
MONGODB_STORAGE_ENGINE: wiredTiger
NODE_VERSION: 10
- name: Mongo 3.6.21
MONGODB_VERSION: 3.6.21
NODE_VERSION: 10
- name: Redis Cache
PARSE_SERVER_TEST_CACHE: redis
NODE_VERSION: 10
- name: Node 12.12.0
NODE_VERSION: 12.12.0
name: ${{ matrix.name }}
timeout-minutes: 30
runs-on: ubuntu-18.04
services:
redis:
image: redis
ports:
- 6379:6379
env:
MONGODB_VERSION: ${{ matrix.MONGODB_VERSION }}
MONGODB_TOPOLOGY: ${{ matrix.MONGODB_TOPOLOGY }}
MONGODB_STORAGE_ENGINE: ${{ matrix.MONGODB_STORAGE_ENGINE }}
PARSE_SERVER_TEST_CACHE: ${{ matrix.PARSE_SERVER_TEST_CACHE }}
NODE_VERSION: ${{ matrix.NODE_VERSION }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.NODE_VERSION }}
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-
- name: Install dependencies
run: npm ci
- if: ${{ matrix.name == 'Mongo 3.6.21' }}
run: npm run lint
- run: npm run pretest
- run: npm run coverage
env:
CI: true
- run: bash <(curl -s https://codecov.io/bash)
check-postgres:
name: Postgresql
timeout-minutes: 30
runs-on: ubuntu-18.04
services:
redis:
image: redis
ports:
- 6379:6379
postgres:
image: postgis/postgis:11-3.0
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
PARSE_SERVER_TEST_DB: postgres
POSTGRES_MAJOR_VERSION: 11
PARSE_SERVER_TEST_DATABASE_URI: postgres://postgres:postgres@localhost:5432/parse_server_postgres_adapter_test_database
steps:
- uses: actions/checkout@v2
- name: Use Node.js 10
uses: actions/setup-node@v1
with:
node-version: 10
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-
- name: Install dependencies
run: npm ci
- run: bash scripts/before_script_postgres.sh
- run: npm run coverage
env:
CI: true
- run: bash <(curl -s https://codecov.io/bash)
\ No newline at end of file
language: node_js
os: linux
dist: xenial
services:
- redis
- docker
branches:
only:
- master
- "/^[0-9]+.[0-9]+.[0-9]+(-.*)?$/"
- 3.x
- 4.x
- "/^greenkeeper/.*$/"
cache:
directories:
- "$HOME/.npm"
- ".eslintcache"
env:
global:
- COVERAGE_OPTION='./node_modules/.bin/nyc'
jobs:
- MONGODB_VERSION=4.0.4 MONGODB_TOPOLOGY=replicaset MONGODB_STORAGE_ENGINE=wiredTiger
- MONGODB_VERSION=3.6.9
- PARSE_SERVER_TEST_CACHE=redis
- NODE_VERSION=12.12.0
before_install:
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
- npm install -g greenkeeper-lockfile@1
before_script:
- node -e 'require("./lib/index.js")'
- greenkeeper-lockfile-update
script:
- npm run lint
- npm run pretest && npm run coverage
after_script:
- greenkeeper-lockfile-upload
- bash <(curl -s https://codecov.io/bash)
jobs:
allow_failures:
- env: NODE_VERSION=12.12.0
include:
- stage:
addons:
postgresql: '11'
apt:
packages:
- postgresql-11-postgis-3
- postgresql-11-postgis-3-scripts
env: POSTGRES_MAJOR_VERSION=11 PARSE_SERVER_TEST_DB=postgres PARSE_SERVER_TEST_DATABASE_URI=postgres://localhost:5433/parse_server_postgres_adapter_test_database
before_install: bash scripts/before_install_postgres.sh
before_script: bash scripts/before_script_postgres.sh
script:
- npm run lint
- npm run coverage
- stage: release
node_js: '10'
env:
before_script: skip
after_script: skip
script:
- "./release_docs.sh"
deploy:
- provider: pages
skip_cleanup: true
token:
secure: YU2lUqmW036AHBRu7xO/AwEeQ900Q/5O6FL96ZqWEfD7Gadaq4iapkNvhPR0HcZYRHqQV2/2LCHVnhd0dbj0ShkmVIHdQE7O+MF+j0v0GIVc8FPTPe1/d2Hy4apSWNe6FeCrYKVeliAu+ZqvNuFLhVmYvIeJdlJrMGOb6P76UZXRDv2srXhq4uBcCVUJuTajyyd5ttJfcNapymTP+xzEDYc7Hr4LJaubmv/wVD/xwPBbvfYFuBqysUpkPKi/ODlQbB0ybYh2fFnX71WUyFUGbtB5xI9ma951Zp4v3t73c31uUl27dJaHzO62EtVTdcUKAa804EtAtsvpeJWMVWKUgigm9UZcXdEwKa79fl5nLaq34lrSktAYOkexwPqYj+vbS6sn52JrluSxLE+4cEke7tYbnJ9X12SAQXKgcXY3n30+6gKf9RVqYdlNsYpEAqKVIDb6SlEkk86dP+uIg/XXb5RKEwxbDXnb6xdl9JRc+GTbeeY3/vg2h9QTdmFVblPtBhHrNenQYP/BS0n+EfUnAIBKqRmQgyhao3SiY5FMACM8higI2Lvvhpq46pDhXqsexYCz5F008C6YXGDh5gC93rJFec0pjh55DNdQu6uw3YMQ5jtf3QUXoPAoMFud3cTulMlnjC1WZG8QbqER8dzUZ4TcaQUdzribJI/mRriheBg=
local_dir: docs/
on:
all_branches: true
- provider: npm
skip_cleanup: true
api_token:
secure: Yrng6jsnMAtzrrln9DwRuY4xpcxl/WYS/1A5fckyQF6DsLmNlvqVtu3MWF+zdJgANF63G3jIee11tNBpYRecHl8FjPGwO0kc1vEgvIRVnveyR0bwIIDH6s/mR9dg4rZikflwG4XExsLyaQd7ko8aTIOIayfxJiv/u0yqwuBuBW2bFrL/41b1cKGK5+Iq2a+PdFENUPenKXISkACGaMnQF4Y/KVF98UwCiGLf957yFWc2sD6TFbjNDbAENSccvg1J3fBb+djbtzKzldl29ntp2mKVGSVASiKCRa6hSfgQulHiidFqFIKgpYJ1uATRr3UFr/NRVt1WbrgLnzY74OCX7y02c/xiYQMMEPRl/P8hHJu+KjQ3PBWsBvmsRN0QMUJv3PEjUPE3AY8sw49NoxiJZzJr7574vUBuM/dk0byYI6K/gwmUrPIhQjljzZqinS8JJJ4FjGjCdzXRhT5Q+PZvt5bF1rMOZXayNJZa+cICtmiJoU3vO2Yf6TXC3wY1veKvmcs24nws5lp4keJePTKAi1Ig7VoSxwAlgs3EGANIh7oBKx9zWnXQYMdmxbYsvLXAWcnnM+PcSCvooLmXWso3BQBeRuUUSS2oLaBpsFMsiniLNbA1cW4fwMkgUGz4oEDRi8wTD89E/1J2oNxzqtWRPawcVKpMpnBbDJHrWJPEHMw=
email:
secure: lomzDl71N995SzRczm7VE9OZE+PzMo4X8t3zU97agu/FMH5Qcj8BLwE+uVDTnA9Vblyj62ZsFKsNjP2Qp53Vcd+jHM4EJNWNRZYpEMIRO3LngX43r83qoFEHUvPu9s1oaa04a6FojcsJx0wl6B6Ke2AX74MXnJDLb9iZBy1mkpLUMVccVhSfhdoIzhkq3dhUw+6d8C024tNMHcgDW3VnRAsWFtiL7dCMpjLOdI+UxlkeGkQkxXXuRsZ0ZdjoSoM8NSkiYMc8x6EnekyRDoHTujX3OFxuU6+GAjrUmVzNmJWrBIqHVb0DXBQxjEaG3d/cNu5UsQyZYq5sxRRH0BaLs7F4oIQg95etasEtTtUkmsZ3pshVlsweiLU366UdbfuAf5hrJjqLrU12BKZyLjaAwyeKz031r8dA4sJtGIp5uVdXobQQTH6r958A88byJ20uaYSqhqjhZo3hkWXIQP0WQN2Ej/g57HbVNLB/nPKkMILfk/tpp7nBDLT0QrjbZxeo1dwCHqsBEV6z7ZyWyFf4xwpDsir4txL4t8ElzeGdlACjCqAJvIh5w9YzfrwijtoVMvvP6pWvn/iI640d4rsdIDe8egxgqZ1R/TMd/tdHYX+eI+ZfFmCVGj36/uXwdG7KIoIZVjRQ2tvWr9ZuydEPWPSRVGT4ycFeu6wbm3elM3I=
on:
tags: true
all_branches: true
repo: parse-community/parse-server
......@@ -10,7 +10,9 @@
<p align="center">
<a href="https://twitter.com/intent/follow?screen_name=parseplatform"><img alt="Follow on Twitter" src="https://img.shields.io/twitter/follow/parseplatform?style=social&label=Follow"></a>
<a href="https://travis-ci.org/parse-community/parse-server"><img alt="Build status" src="https://img.shields.io/travis/parse-community/parse-server/master.svg?style=flat"></a>
<a href="https://github.com/parse-community/parse-server/actions?query=workflow%3Aci+branch%3Amaster">
<img alt="Build status" src="https://github.com/parse-community/parse-server/workflows/ci/badge.svg?branch=master">
</a>
<a href="https://codecov.io/github/parse-community/parse-server?branch=master"><img alt="Coverage status" src="https://img.shields.io/codecov/c/github/parse-community/parse-server/master.svg"></a>
<a href="https://www.npmjs.com/package/parse-server"><img alt="npm version" src="https://img.shields.io/npm/v/parse-server.svg?style=flat"></a>
<a href="https://community.parseplatform.org/"><img alt="Join the conversation" src="https://img.shields.io/discourse/https/community.parseplatform.org/topics.svg"></a>
......
#!/bin/bash
set -e
source ~/.nvm/nvm.sh
echo "[SCRIPT] Before Install Script :: Setup Postgres ${POSTGRES_MAJOR_VERSION}"
nvm install $NODE_VERSION
nvm use $NODE_VERSION
npm install -g greenkeeper-lockfile@1
if [[ $POSTGRES_MAJOR_VERSION -lt 11 ]]; then
# Setup postgres 9 or 10
sudo sed -i 's/port = 5432/port = 5433/' /etc/postgresql/${POSTGRES_MAJOR_VERSION}/main/postgresql.conf
# Stop the current running service
sudo service postgresql stop
# Remove correct version of postgres
if [[ $POSTGRES_MAJOR_VERSION -lt 10 ]]; then
sudo apt-get remove -q 'postgresql-10.*'
else
sudo apt-get remove -q 'postgresql-9.*'
fi
sudo service postgresql start
else
# Setup postgres 11 or higher
#Copy defauilt hba config file and tell postgres to restart
sudo cp /etc/postgresql/{10,${POSTGRES_MAJOR_VERSION}}/main/pg_hba.conf
sudo systemctl restart postgresql@${POSTGRES_MAJOR_VERSION}-main
fi
......@@ -4,10 +4,7 @@ set -e
echo "[SCRIPT] Before Script :: Setup Parse DB for Postgres ${POSTGRES_MAJOR_VERSION}"
node -e 'require("./lib/index.js")'
greenkeeper-lockfile-update
psql -v ON_ERROR_STOP=1 -p 5433 --username "postgres" --dbname "${POSTGRES_DB}" <<-EOSQL
PGPASSWORD=postgres psql -v ON_ERROR_STOP=1 -h localhost -U postgres <<-EOSQL
CREATE DATABASE parse_server_postgres_adapter_test_database;
\c parse_server_postgres_adapter_test_database;
CREATE EXTENSION postgis;
......
......@@ -1633,9 +1633,8 @@ describe('Cloud Code', () => {
it('should set the message / success on the job', done => {
Parse.Cloud.job('myJob', req => {
req.message('hello');
const promise = req
.message()
.message('hello')
.then(() => {
return getJobStatus(req.jobId);
})
......@@ -1716,9 +1715,15 @@ describe('Cloud Code', () => {
throw new Parse.Error(101, 'Something went wrong');
});
const job = await Parse.Cloud.startJob('myJobError');
const jobStatus = await Parse.Cloud.getJobStatus(job);
let jobStatus, status;
while (status !== 'failed') {
if (jobStatus) {
await new Promise(resolve => setTimeout(resolve, 10));
}
jobStatus = await Parse.Cloud.getJobStatus(job);
status = jobStatus.get('status');
}
expect(jobStatus.get('message')).toEqual('Something went wrong');
expect(jobStatus.get('status')).toEqual('failed');
});
function getJobStatus(jobId) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册