Switched tests to GitHub Actions

no issue
This commit is contained in:
Daniel Lockyer 2020-02-24 20:05:19 +00:00
parent edfc07b9c8
commit 7b32bf9ca5
3 changed files with 45 additions and 28 deletions

44
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,44 @@
name: Test Suite
on:
pull_request:
push:
branches:
- master
- 2.x
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 10, 12 ]
env:
- DB: sqlite3
NODE_ENV: testing
- DB: mysql
NODE_ENV: testing-mysql
env:
DB: ${{ matrix.env.DB }}
NODE_ENV: ${{ matrix.env.NODE_ENV }}
database__connection__password: root
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ghost_testing
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
name: Node ${{ matrix.node }} - ${{ matrix.env.DB }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: yarn
- run: grunt test-acceptance --verbose
- run: grunt test-unit --verbose
- run: grunt test-regression --verbose
if: startsWith(github.head_ref, 'renovate/') || github.event_name != 'pull_request'

View File

@ -1,27 +0,0 @@
dist: xenial
language: node_js
node_js:
- '12'
- '10'
cache: yarn
services:
- mysql
branches:
only:
- master
- 2.x
env:
matrix:
- DB=sqlite3 NODE_ENV=testing
- DB=mysql NODE_ENV=testing-mysql
install:
- yarn
before_script:
- if [ $DB == "mysql" ]; then mysql -e 'create database ghost_testing'; fi
- if [ "$DB" == "sqlite3" ]; then yarn add --force sqlite3; fi
script: |
if [[ "$TRAVIS_PULL_REQUEST_BRANCH" =~ ^renovate || "$TRAVIS_PULL_REQUEST" == "false" ]]; then
grunt test-all --verbose
else
yarn ci
fi

View File

@ -373,7 +373,7 @@ const configureGrunt = function (grunt) {
grunt.registerTask('setTestEnv',
'Use "testing" Ghost config; unless we are running on travis (then show queries for debugging)',
function () {
process.env.NODE_ENV = process.env.TRAVIS ? process.env.NODE_ENV : 'testing';
process.env.NODE_ENV = process.env.NODE_ENV || 'testing';
cfg.express.test.options.node_env = process.env.NODE_ENV;
});