2020-02-24 23:05:19 +03:00
|
|
|
name: Test Suite
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-02-02 21:04:07 +03:00
|
|
|
- main
|
2021-07-22 17:21:36 +03:00
|
|
|
- 'v4.*'
|
2021-02-02 21:04:07 +03:00
|
|
|
- 3.x
|
2020-02-24 23:05:19 +03:00
|
|
|
- 2.x
|
2020-03-25 20:18:18 +03:00
|
|
|
- 'renovate/*'
|
2020-04-16 13:01:27 +03:00
|
|
|
env:
|
|
|
|
FORCE_COLOR: 1
|
2020-02-24 23:05:19 +03:00
|
|
|
jobs:
|
2020-10-28 11:05:50 +03:00
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/'))
|
|
|
|
name: Lint
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-02-09 19:21:54 +03:00
|
|
|
- uses: actions/setup-node@v2
|
2020-10-28 11:05:50 +03:00
|
|
|
with:
|
2021-05-07 16:14:46 +03:00
|
|
|
node-version: '14.16.1'
|
2020-10-28 11:05:50 +03:00
|
|
|
- run: yarn
|
|
|
|
- run: yarn lint
|
|
|
|
- uses: daniellockyer/action-slack-build@master
|
2021-02-02 21:04:07 +03:00
|
|
|
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
|
2020-10-28 11:05:50 +03:00
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
|
2020-11-05 15:58:01 +03:00
|
|
|
migrations:
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/'))
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
DB: ['sqlite3', 'mysql']
|
|
|
|
env:
|
|
|
|
database__client: ${{ matrix.DB }}
|
2021-02-19 15:46:28 +03:00
|
|
|
database__connection__filename: /dev/shm/ghost-test.db
|
2020-11-05 15:58:01 +03:00
|
|
|
database__connection__host: 127.0.0.1
|
|
|
|
database__connection__user: root
|
|
|
|
database__connection__password: root
|
|
|
|
database__connection__database: ghost_testing
|
|
|
|
name: Migrations - ${{ matrix.DB }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2020-11-17 12:16:03 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
submodules: true
|
2021-02-09 19:21:54 +03:00
|
|
|
- uses: actions/setup-node@v2
|
2020-11-05 15:58:01 +03:00
|
|
|
with:
|
2021-05-07 16:14:46 +03:00
|
|
|
node-version: '14.16.1'
|
2020-11-05 15:58:01 +03:00
|
|
|
|
|
|
|
- name: Shutdown MySQL
|
|
|
|
run: sudo service mysql stop
|
|
|
|
if: matrix.DB == 'mysql'
|
|
|
|
|
|
|
|
- uses: mirromutth/mysql-action@v1.1
|
|
|
|
if: matrix.DB == 'mysql'
|
|
|
|
with:
|
|
|
|
mysql version: '5.7'
|
|
|
|
mysql database: 'ghost_testing'
|
|
|
|
mysql root password: 'root'
|
|
|
|
|
|
|
|
- run: yarn
|
2020-11-11 13:33:18 +03:00
|
|
|
- run: |
|
|
|
|
node index.js &
|
2020-11-20 11:41:59 +03:00
|
|
|
sleep 20 && { kill $! && wait $!; } 2>/dev/null
|
2021-02-02 13:24:49 +03:00
|
|
|
|
|
|
|
- run: yarn knex-migrator rollback --v 4.0 --force
|
2020-11-05 15:58:01 +03:00
|
|
|
- run: yarn knex-migrator migrate --force
|
|
|
|
|
2020-02-24 23:05:19 +03:00
|
|
|
test:
|
2020-08-18 15:05:15 +03:00
|
|
|
runs-on: ubuntu-18.04
|
2020-03-25 20:18:18 +03:00
|
|
|
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/'))
|
2020-02-24 23:05:19 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-05-07 16:14:46 +03:00
|
|
|
node: [ '12.22.1', '14.16.1' ]
|
2020-02-24 23:05:19 +03:00
|
|
|
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
|
|
|
|
name: Node ${{ matrix.node }} - ${{ matrix.env.DB }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-02-09 19:21:54 +03:00
|
|
|
- uses: actions/setup-node@v2
|
2020-02-24 23:05:19 +03:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node }}
|
2020-03-19 22:19:00 +03:00
|
|
|
|
2020-03-20 14:05:16 +03:00
|
|
|
- name: Shutdown MySQL
|
|
|
|
run: sudo service mysql stop
|
|
|
|
if: matrix.env.DB == 'mysql'
|
|
|
|
|
|
|
|
- uses: mirromutth/mysql-action@v1.1
|
|
|
|
if: matrix.env.DB == 'mysql'
|
|
|
|
with:
|
|
|
|
mysql version: '5.7'
|
|
|
|
mysql database: 'ghost_testing'
|
|
|
|
mysql root password: 'root'
|
|
|
|
|
2020-02-24 23:05:19 +03:00
|
|
|
- run: yarn
|
2021-07-05 22:02:22 +03:00
|
|
|
- run: yarn test:acceptance
|
2021-02-19 15:46:28 +03:00
|
|
|
env:
|
|
|
|
database__connection__filename: /dev/shm/ghost-test.db
|
2021-07-05 22:02:22 +03:00
|
|
|
- run: yarn test:unit
|
|
|
|
- run: yarn test:regression
|
2021-02-19 15:46:28 +03:00
|
|
|
env:
|
|
|
|
database__connection__filename: /dev/shm/ghost-test.db
|
2020-04-16 09:36:15 +03:00
|
|
|
|
2020-06-10 10:58:35 +03:00
|
|
|
- uses: daniellockyer/action-slack-build@master
|
2021-02-02 21:04:07 +03:00
|
|
|
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
|
2020-06-10 10:58:35 +03:00
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
2020-06-09 15:21:43 +03:00
|
|
|
|
2020-04-16 09:36:15 +03:00
|
|
|
ghost-cli:
|
|
|
|
name: Ghost-CLI
|
2020-04-16 12:22:14 +03:00
|
|
|
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/'))
|
2020-08-18 15:05:15 +03:00
|
|
|
runs-on: ubuntu-18.04
|
2020-04-16 09:36:15 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
submodules: true
|
2021-02-09 19:21:54 +03:00
|
|
|
- uses: actions/setup-node@v2
|
2020-04-16 09:36:15 +03:00
|
|
|
with:
|
2021-05-07 16:14:46 +03:00
|
|
|
node-version: '12.22.1'
|
2020-05-28 14:59:08 +03:00
|
|
|
- run: npm install -g ghost-cli@latest
|
2020-06-29 23:46:36 +03:00
|
|
|
- run: npm --no-git-tag-version version minor # We need to artificially bump the minor version to get migrations to run
|
2021-03-01 11:56:27 +03:00
|
|
|
|
2020-04-16 09:36:15 +03:00
|
|
|
- run: zip -r ghost.zip .
|
|
|
|
|
|
|
|
- name: Clean Install
|
|
|
|
run: |
|
|
|
|
DIR=$(mktemp -d)
|
|
|
|
ghost install local -d $DIR --zip $GITHUB_WORKSPACE/ghost.zip
|
|
|
|
|
2021-02-09 19:18:40 +03:00
|
|
|
- name: Latest Release
|
|
|
|
run: |
|
|
|
|
DIR=$(mktemp -d)
|
|
|
|
ghost install local -d $DIR
|
|
|
|
ghost update -d $DIR --zip $GITHUB_WORKSPACE/ghost.zip
|
|
|
|
|
2021-05-05 16:57:52 +03:00
|
|
|
#- name: Update from latest v1
|
|
|
|
#run: |
|
|
|
|
#DIR=$(mktemp -d)
|
|
|
|
#ghost install v1 --local -d $DIR
|
|
|
|
#ghost update -f -d $DIR --zip $GITHUB_WORKSPACE/ghost.zip
|
|
|
|
|
|
|
|
#- name: Update from latest v2
|
|
|
|
#run: |
|
|
|
|
#DIR=$(mktemp -d)
|
|
|
|
#ghost install v2 --local -d $DIR
|
|
|
|
#ghost update -f -d $DIR --zip $GITHUB_WORKSPACE/ghost.zip
|
2020-06-09 15:21:43 +03:00
|
|
|
|
2021-03-17 14:47:27 +03:00
|
|
|
- name: Update from latest v3
|
|
|
|
run: |
|
|
|
|
DIR=$(mktemp -d)
|
|
|
|
ghost install v3 --local -d $DIR
|
|
|
|
ghost update -f -d $DIR --zip $GITHUB_WORKSPACE/ghost.zip
|
|
|
|
|
2021-06-09 15:51:55 +03:00
|
|
|
- name: Print debug logs
|
|
|
|
if: failure()
|
|
|
|
run: cat ~/.ghost/logs/*.log
|
|
|
|
|
2020-06-10 10:58:35 +03:00
|
|
|
- uses: daniellockyer/action-slack-build@master
|
2021-02-02 21:04:07 +03:00
|
|
|
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
|
2020-06-10 10:58:35 +03:00
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
2021-01-19 15:10:50 +03:00
|
|
|
|
|
|
|
canary:
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
needs: [lint, migrations, test, ghost-cli]
|
2021-02-02 21:04:07 +03:00
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
2021-01-19 15:10:50 +03:00
|
|
|
name: Canary
|
|
|
|
steps:
|
2021-06-01 19:04:16 +03:00
|
|
|
- name: Invoke Canary Build
|
|
|
|
uses: benc-uk/workflow-dispatch@v1
|
2021-01-19 15:10:50 +03:00
|
|
|
with:
|
2021-06-01 19:04:16 +03:00
|
|
|
workflow: Canary Build
|
|
|
|
token: ${{ secrets.RELEASE_TOKEN }}
|