From d82cdb5cc794478e5caf540c38f4def3d82e126c Mon Sep 17 00:00:00 2001 From: sgiehl Date: Tue, 24 Jan 2023 11:06:16 +0100 Subject: [PATCH] replace travis with github action --- .github/workflows/matomo-tests.yml | 53 +++++++++++ .travis.yml | 139 ----------------------------- 2 files changed, 53 insertions(+), 139 deletions(-) create mode 100644 .github/workflows/matomo-tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/matomo-tests.yml b/.github/workflows/matomo-tests.yml new file mode 100644 index 00000000..c077a844 --- /dev/null +++ b/.github/workflows/matomo-tests.yml @@ -0,0 +1,53 @@ +# Action for running tests +# This file has been automatically created. +# To recreate it you can run this command +# ./console generate:test-action --plugin="DeviceDetectorCache" --php-versions="7.2,8.1" + +name: Plugin DeviceDetectorCache Tests + +on: + pull_request: + types: [opened, synchronize] + push: + branches: + - '**.x-dev' + workflow_dispatch: + +permissions: + actions: read + checks: none + contents: read + deployments: none + issues: read + packages: none + pull-requests: read + repository-projects: none + security-events: none + statuses: none + +concurrency: + group: php-${{ github.ref }} + cancel-in-progress: true + +jobs: + PluginTests: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + php: [ '7.2', '8.1' ] + target: ['minimum_required_matomo', 'maximum_supported_matomo'] + steps: + - uses: actions/checkout@v3 + with: + lfs: true + persist-credentials: false + - name: Run tests + uses: matomo-org/github-action-tests@main + with: + plugin-name: 'DeviceDetectorCache' + php-version: ${{ matrix.php }} + test-type: 'PluginTests' + matomo-test-branch: ${{ matrix.target }} + artifacts-pass: ${{ secrets.ARTIFACTS_PASS }} + upload-artifacts: ${{ matrix.php == '7.2' && matrix.target == 'maximum_supported_matomo' }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c46124dd..00000000 --- a/.travis.yml +++ /dev/null @@ -1,139 +0,0 @@ -# do not edit this file manually, instead run the generate:travis-yml console command - -language: php - -php: - - 7.2 -# - hhvm - -services: - - redis-server - - mysql - -addons: - apt: - packages: - - nginx - - coreutils - - lftp - -git: - lfs_skip_smudge: true - -# Separate different test suites -env: - global: - - PLUGIN_NAME=DeviceDetectorCache - - PIWIK_ROOT_DIR=$TRAVIS_BUILD_DIR/matomo - # this variable controls the version of Matomo your tests will run against. - # by default it will run against the maximum support version read from plugin.json - # (PIWIK_TEST_TARGET=maximum_supported_piwik). - # You can also specify a specific Matomo version - # (PIWIK_TEST_TARGET=2.16.0-b1). - - PIWIK_TEST_TARGET=4.x-dev - matrix: - - TEST_SUITE=PluginTests MYSQL_ADAPTER=PDO_MYSQL TEST_AGAINST_PIWIK_BRANCH=$PIWIK_TEST_TARGET - - TEST_SUITE=PluginTests MYSQL_ADAPTER=PDO_MYSQL TEST_AGAINST_CORE=minimum_required_piwik - -matrix: - exclude: - # execute latest stable tests only w/ PHP 5.6 - - php: 7.2 - env: TEST_SUITE=PluginTests MYSQL_ADAPTER=PDO_MYSQL TEST_AGAINST_CORE=minimum_required_piwik - include: - - php: 8.1 - env: TEST_SUITE=PluginTests MYSQL_ADAPTER=PDO_MYSQL TEST_AGAINST_PIWIK_BRANCH=$PIWIK_TEST_TARGET SKIP_COMPOSER_INSTALL=1 - script: - - cd $PIWIK_ROOT_DIR - - composer install --ignore-platform-reqs - - composer remove --dev phpunit/phpunit - - composer require --dev phpunit/phpunit ~9.3 --ignore-platform-reqs - - cd tests/PHPUnit - - $PIWIK_ROOT_DIR/tests/travis/travis.sh - - php: 8.1 - env: TEST_SUITE=PluginTests MYSQL_ADAPTER=PDO_MYSQL TEST_AGAINST_CORE=minimum_required_piwik SKIP_COMPOSER_INSTALL=1 - script: - - cd $PIWIK_ROOT_DIR - - composer install --ignore-platform-reqs - - composer remove --dev phpunit/phpunit - - composer require --dev phpunit/phpunit ~9.3 --ignore-platform-reqs - - cd tests/PHPUnit - - $PIWIK_ROOT_DIR/tests/travis/travis.sh - -dist: bionic - -sudo: false - -script: $PIWIK_ROOT_DIR/tests/travis/travis.sh - -before_install: - -install: - # move all contents of current repo (which contains the plugin) to a new directory - - mkdir $PLUGIN_NAME - - cp -R !($PLUGIN_NAME) $PLUGIN_NAME - - cp -R .git/ $PLUGIN_NAME/ - - cp .travis.yml $PLUGIN_NAME - # checkout matomo in the current directory - - git clone -q https://github.com/matomo-org/matomo.git matomo - - cd matomo - - git fetch -q --all - - git submodule update - - # make sure travis-scripts repo is latest for initial travis setup - - '[ -d ./tests/travis/.git ] || sh -c "rm -rf ./tests/travis && git clone https://github.com/matomo-org/travis-scripts.git ./tests/travis"' - - cd ./tests/travis ; git checkout master ; cd ../.. - - - export GENERATE_TRAVIS_YML_COMMAND="php ./tests/travis/generator/main.php generate:travis-yml --plugin=\"DeviceDetectorCache\" --php-versions=\"7.2\" --distribution=\"bionic\" --sudo-false --verbose" - - '[[ "$TRAVIS_JOB_NUMBER" != *.1 || "$TRAVIS_PULL_REQUEST" != "false" ]] || ./tests/travis/autoupdate_travis_yml.sh' - - - ./tests/travis/checkout_test_against_branch.sh - - - '[ "$PLUGIN_NAME" == "" ] || [ ! -f ./tests/travis/check_plugin_compatible_with_piwik.php ] || php ./tests/travis/check_plugin_compatible_with_piwik.php "$PLUGIN_NAME"' - - - ./tests/travis/configure_git.sh - - # travis now complains about this failing 9 times out of 10, so removing it - #- travis_retry composer self-update - - '[ "$SKIP_COMPOSER_INSTALL" == "1" ] || travis_retry composer install' - - # move plugin contents to folder in the plugins subdirectory - - rm -rf plugins/$PLUGIN_NAME - - mv ../$PLUGIN_NAME plugins - - # clone dependent repos - - ./tests/travis/checkout_dependent_plugins.sh - -before_script: - - phpenv config-rm xdebug.ini - - # add always_populate_raw_post_data=-1 to php.ini - - echo "always_populate_raw_post_data=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - # disable opcache to avoid random failures on travis - - echo "opcache.enable=0" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - # make tmpfs and run MySQL on it for reasonnable performance - - ./tests/travis/setup_mysql_tmpfs.sh - - - ./tests/travis/prepare.sh - - ./tests/travis/setup_webserver.sh - - ./tests/travis/install_phantomjs.sh; export PATH=$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH; - - - cd tests/PHPUnit - -after_script: - # change directory back to root travis dir - - cd $PIWIK_ROOT_DIR - - # output contents of files w/ debugging info to screen - - cat $PIWIK_ROOT_DIR/tests/travis/error.log - - cat $PIWIK_ROOT_DIR/tmp/php-fpm.log - - cat $PIWIK_ROOT_DIR/tmp/logs/matomo.log - - cat $PIWIK_ROOT_DIR/config/config.ini.php - - # upload test artifacts (for debugging travis failures) - - ./tests/travis/upload_artifacts.sh - -after_success: - - cd $PIWIK_ROOT_DIR