mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 19:02:29 +03:00
Extracted regression tests to a separate workflow
refs https://github.com/TryGhost/Toolbox/issues/592 - this commit extracts the regression tests into a separate workflow - this means they run in parallel and reduce the time we have to wait for DB tests in general - also fixes a test that was reliant on being run after the E2E tests (!)
This commit is contained in:
parent
082ab6dc3e
commit
01e90dfb65
67
.github/workflows/test.yml
vendored
67
.github/workflows/test.yml
vendored
@ -229,10 +229,6 @@ jobs:
|
||||
working-directory: ghost/core
|
||||
run: yarn test:ci:e2e
|
||||
|
||||
- name: Regression tests
|
||||
working-directory: ghost/core
|
||||
run: yarn test:ci:regression
|
||||
|
||||
- name: Integration tests
|
||||
working-directory: ghost/core
|
||||
run: yarn test:ci:integration
|
||||
@ -295,6 +291,67 @@ jobs:
|
||||
env:
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
|
||||
regression-tests:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/'))
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- node: 18.12.1
|
||||
env:
|
||||
DB: mysql8
|
||||
NODE_ENV: testing-mysql
|
||||
- node: 18.12.1
|
||||
env:
|
||||
DB: sqlite3
|
||||
NODE_ENV: testing
|
||||
env:
|
||||
DB: ${{ matrix.env.DB }}
|
||||
NODE_ENV: ${{ matrix.env.NODE_ENV }}
|
||||
name: Regression Tests (Node ${{ matrix.node }}, ${{ matrix.env.DB }})
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
env:
|
||||
FORCE_COLOR: 0
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
|
||||
- name: Shutdown MySQL
|
||||
run: sudo service mysql stop
|
||||
if: matrix.env.DB == 'mysql8'
|
||||
|
||||
- uses: daniellockyer/mysql-action@main
|
||||
if: matrix.env.DB == 'mysql8'
|
||||
with:
|
||||
authentication plugin: 'caching_sha2_password'
|
||||
mysql version: '8.0'
|
||||
mysql database: 'ghost_testing'
|
||||
mysql root password: 'root'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --prefer-offline
|
||||
|
||||
- name: Set env vars (SQLite)
|
||||
if: contains(matrix.env.DB, 'sqlite')
|
||||
run: echo "database__connection__filename=/dev/shm/ghost-test.db" >> $GITHUB_ENV
|
||||
|
||||
- name: Set env vars (MySQL)
|
||||
if: contains(matrix.env.DB, 'mysql')
|
||||
run: echo "database__connection__password=root" >> $GITHUB_ENV
|
||||
|
||||
- name: Regression tests
|
||||
working-directory: ghost/core
|
||||
run: yarn test:ci:regression
|
||||
|
||||
- uses: tryghost/actions/actions/slack-build@main
|
||||
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
with:
|
||||
status: ${{ job.status }}
|
||||
env:
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
|
||||
ghost-cli:
|
||||
name: Ghost-CLI
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/'))
|
||||
@ -393,7 +450,7 @@ jobs:
|
||||
flags: unit-tests
|
||||
|
||||
canary:
|
||||
needs: [lint, ghost-cli, admin-tests, migrations, unit-tests, database-tests]
|
||||
needs: [lint, ghost-cli, admin-tests, migrations, unit-tests, database-tests, regression-tests]
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
name: Canary
|
||||
secrets: inherit
|
||||
|
@ -1,5 +1,7 @@
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const path = require('path');
|
||||
|
||||
const testUtils = require('../../utils');
|
||||
const localUtils = require('./utils');
|
||||
const configUtils = require('../../utils/configUtils');
|
||||
@ -26,13 +28,10 @@ describe('Integration - Web - vhosts', function () {
|
||||
|
||||
configUtils.set('url', 'http://example.com');
|
||||
configUtils.set('admin:url', null);
|
||||
configUtils.set('paths:adminAssets', path.resolve('test/utils/fixtures/admin-build'));
|
||||
|
||||
app = await localUtils.initGhost({backend: true});
|
||||
});
|
||||
|
||||
before(function () {
|
||||
configUtils.set('url', 'http://example.com');
|
||||
configUtils.set('admin:url', null);
|
||||
urlUtils.stubUrlUtilsFromConfig();
|
||||
});
|
||||
|
||||
@ -134,13 +133,12 @@ describe('Integration - Web - vhosts', function () {
|
||||
|
||||
configUtils.set('url', 'http://example.com');
|
||||
configUtils.set('admin:url', 'https://admin.example.com');
|
||||
configUtils.set('paths:adminAssets', path.resolve('test/utils/fixtures/admin-build'));
|
||||
|
||||
app = await localUtils.initGhost({backend: true});
|
||||
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
});
|
||||
|
||||
before(function () {
|
||||
urlUtils.stubUrlUtilsFromConfig();
|
||||
});
|
||||
|
||||
@ -287,13 +285,12 @@ describe('Integration - Web - vhosts', function () {
|
||||
configUtils.set('url', 'http://example.com');
|
||||
configUtils.set('admin:url', 'https://admin.example.com');
|
||||
configUtils.set('admin:redirects', false);
|
||||
configUtils.set('paths:adminAssets', path.resolve('test/utils/fixtures/admin-build'));
|
||||
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = await localUtils.initGhost({backend: true});
|
||||
});
|
||||
|
||||
before(function () {
|
||||
urlUtils.stubUrlUtilsFromConfig();
|
||||
});
|
||||
|
||||
@ -326,13 +323,12 @@ describe('Integration - Web - vhosts', function () {
|
||||
|
||||
configUtils.set('url', 'http://example.com');
|
||||
configUtils.set('admin:url', 'https://example.com');
|
||||
configUtils.set('paths:adminAssets', path.resolve('test/utils/fixtures/admin-build'));
|
||||
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = await localUtils.initGhost({backend: true});
|
||||
});
|
||||
|
||||
before(function () {
|
||||
urlUtils.stubUrlUtilsFromConfig();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user