.travis.yml

Summary

Maintainability
Test Coverage
dist: xenial

language: php

php: "7.4"

jobs:
  include:

    - stage: test
      name: Default Test
      before_script:
        - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
        - chmod +x ./cc-test-reporter
        - ./cc-test-reporter before-build
      after_script:
        - test -f ./tests/reports/clover.xml && composer test-report || true
        - ./cc-test-reporter format-coverage --input-type clover tests/reports/clover.xml --output tests/reports/codeclimate.json
        - ./cc-test-reporter upload-coverage --input tests/reports/codeclimate.json

    - name: Test with PHP 5.6
      env:
        WORDPRESS_IMAGE_VERSION: php5.6

    - name: Test with PHP 7.4
      env:
        WORDPRESS_IMAGE_VERSION: php7.4

    - name: Test with PHP 8.0
      env:
        WORDPRESS_IMAGE_VERSION: php8.0
      # PHP unit tests are broken so we limit to linting for now.
      script: npm run lint

    - name: Test Release Bundle
      script: npm run release

    - stage: deploy
      name: Tag Release
      if: tag IS present
      script: npm run release
      deploy:
        provider: releases
        api_key:
          secure: HheYiv6c8ipHzMZBTH7xcKrOwCllvJTtfiTffAPK6XubWe3Kudn6IJUv0p1gmRhWXxZ5ciJQ/sgiCRGTRm/bubHs4tS7JOmpmoTdkrXajTxyyDCKpxhtT43nie0vNF+pWqVu2yOjhDR4pwtWjpQdzEKOz0kn0XSMT+vGsKQD50w=
        overwrite: true
        skip_cleanup: true
        file:
          - stream.zip
          - stream-$TRAVIS_TAG.zip
        on:
          all_branches: true
          repo: xwp/stream

    - name: Tag Package
      if: branch IS present AND type = push
      script: npm run release
      before_deploy:
        - openssl aes-256-cbc -K $encrypted_49634e5b1863_key -iv $encrypted_49634e5b1863_iv -in ./local/travis/travis_deploy_key.enc -out ~/.ssh/id_rsa -d
        - chmod 600 ~/.ssh/id_rsa
      deploy:
        provider: script
        script: ./local/scripts/dist.sh
        skip_cleanup: true
        on:
          all_branches: true
          repo: xwp/stream

services:
  - docker

before_install:
  - echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
  - docker-compose pull
  - nvm install
  - nvm use

install:
  - npm install
  - composer install

script:
  - npm run lint
  - npm run phpunit
  - npm run phpunit-multisite

notifications:
  email: false

cache:
  npm: true
  directories:
    - $HOME/.composer/cache