mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 17:32:15 +03:00
fe3355276f
no issue - as we're making more and more use of branches for releases, we want tests to run on them - this commit adds the v4 wildcard to the GitHub workflow so it'll trigger when we push to them
191 lines
5.6 KiB
YAML
191 lines
5.6 KiB
YAML
name: Test Suite
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'v4.*'
|
|
- 3.x
|
|
- 2.x
|
|
- 'renovate/*'
|
|
env:
|
|
FORCE_COLOR: 1
|
|
jobs:
|
|
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
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '14.16.1'
|
|
- run: yarn
|
|
- run: yarn lint
|
|
- uses: daniellockyer/action-slack-build@master
|
|
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
with:
|
|
status: ${{ job.status }}
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
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 }}
|
|
database__connection__filename: /dev/shm/ghost-test.db
|
|
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
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: true
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '14.16.1'
|
|
|
|
- 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
|
|
- run: |
|
|
node index.js &
|
|
sleep 20 && { kill $! && wait $!; } 2>/dev/null
|
|
|
|
- run: yarn knex-migrator rollback --v 4.0 --force
|
|
- run: yarn knex-migrator migrate --force
|
|
|
|
test:
|
|
runs-on: ubuntu-18.04
|
|
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/'))
|
|
strategy:
|
|
matrix:
|
|
node: [ '12.22.1', '14.16.1' ]
|
|
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
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
|
|
- 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'
|
|
|
|
- run: yarn
|
|
- run: yarn test:acceptance
|
|
env:
|
|
database__connection__filename: /dev/shm/ghost-test.db
|
|
- run: yarn test:unit
|
|
- run: yarn test:regression
|
|
env:
|
|
database__connection__filename: /dev/shm/ghost-test.db
|
|
|
|
- uses: daniellockyer/action-slack-build@master
|
|
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/'))
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: true
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '12.22.1'
|
|
- run: npm install -g ghost-cli@latest
|
|
- run: npm --no-git-tag-version version minor # We need to artificially bump the minor version to get migrations to run
|
|
|
|
- run: zip -r ghost.zip .
|
|
|
|
- name: Clean Install
|
|
run: |
|
|
DIR=$(mktemp -d)
|
|
ghost install local -d $DIR --zip $GITHUB_WORKSPACE/ghost.zip
|
|
|
|
- name: Latest Release
|
|
run: |
|
|
DIR=$(mktemp -d)
|
|
ghost install local -d $DIR
|
|
ghost update -d $DIR --zip $GITHUB_WORKSPACE/ghost.zip
|
|
|
|
#- 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
|
|
|
|
- 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
|
|
|
|
- name: Print debug logs
|
|
if: failure()
|
|
run: cat ~/.ghost/logs/*.log
|
|
|
|
- uses: daniellockyer/action-slack-build@master
|
|
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
with:
|
|
status: ${{ job.status }}
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
canary:
|
|
runs-on: ubuntu-18.04
|
|
needs: [lint, migrations, test, ghost-cli]
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
name: Canary
|
|
steps:
|
|
- name: Invoke Canary Build
|
|
uses: benc-uk/workflow-dispatch@v1
|
|
with:
|
|
workflow: Canary Build
|
|
token: ${{ secrets.RELEASE_TOKEN }}
|