diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000000..4c7ff93672 --- /dev/null +++ b/.github/workflows/tests.yml @@ -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' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 89eccc12f8..0000000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/Gruntfile.js b/Gruntfile.js index da46bd1447..10b6099c37 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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; });