Browse Source

Introduce GH Actions

tags/3.4.4
Christian Fritsch GitHub 4 months ago
parent
commit
5f92b4d937
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 364 additions and 60 deletions
  1. +15
    -0
      .github/labels.yml
  2. +2
    -0
      .github/pr-labeler.yml
  3. +12
    -0
      .github/workflows/pr-labeler.yml
  4. +28
    -0
      .github/workflows/reviewdog.yml
  5. +18
    -0
      .github/workflows/sync-labels.yml
  6. +254
    -0
      .github/workflows/test.yml
  7. +0
    -1
      .gitignore
  8. +2
    -49
      .travis.yml
  9. +1
    -1
      modules/thunder_demo/config/install/tour.tour.content-list.yml
  10. +8
    -3
      modules/thunder_media/tests/src/Functional/FilenameTransliterationTest.php
  11. +18
    -0
      package.json
  12. +0
    -0
      phpstan.neon
  13. +1
    -1
      scripts/travis/06-run-tests.sh
  14. +1
    -1
      src/Plugin/Thunder/OptionalModule/IvwIntegration.php
  15. +1
    -1
      tests/src/FunctionalJavascript/MediaGalleryModifyTest.php
  16. +2
    -2
      themes/thunder_amp/README.md
  17. +1
    -1
      updates_checklist.yml

+ 15
- 0
.github/labels.yml View File

@@ -0,0 +1,15 @@
- name: 3.x
description: 8.x-3.x
color: FFB000
- name: 4.x
description: 8.x-4.x
color: 20B2AA
- name: DO NOT MERGE
description: It's prohibited to merge this branch
color: ff425e
- name: test-min
description: Triggers the minimum requirements testing
color: c9f9a9
- name: test-performance
description: Triggers the performance testing
color: c2e0c6

+ 2
- 0
.github/pr-labeler.yml View File

@@ -0,0 +1,2 @@
3.x: ['8.x-3.x']
4.x: ['8.x-4.x']

+ 12
- 0
.github/workflows/pr-labeler.yml View File

@@ -0,0 +1,12 @@
name: PR Labeler
on:
pull_request:
types: [opened]

jobs:
pr-labeler:
runs-on: ubuntu-latest
steps:
- uses: TimonVS/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

+ 28
- 0
.github/workflows/reviewdog.yml View File

@@ -0,0 +1,28 @@
name: Check coding styles

on: [pull_request]

jobs:
eslint:
name: runner / eslint
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- name: eslint
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.github_token }}

phpcs:
name: runner / phpcs
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- name: phpcs
uses: chrfritsch/[email protected]
with:
github_token: ${{ secrets.github_token }}
level: error


+ 18
- 0
.github/workflows/sync-labels.yml View File

@@ -0,0 +1,18 @@
name: Sync labels in the declarative way
on:
push:
branches:
- 8.x-[1-9]+.x
paths:
- .github/labels.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: micnncim/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
with:
manifest: .github/labels.yml

+ 254
- 0
.github/workflows/test.yml View File

@@ -0,0 +1,254 @@
name: Run distribution tests

on:
pull_request:
branches:
- 8.x-[1-9]+.x
paths-ignore:
- '**.md'

schedule:
- cron: '0 7 * * *'

env:
DRUPAL_TESTING_COMPOSER_PROJECT: thunder/thunder-project
DRUPAL_TESTING_DATABASE_USER: root
DRUPAL_TESTING_DATABASE_PASSWORD: root
DRUPAL_TESTING_TEST_DUMP_FILE: dump.sql
DRUPAL_TESTING_DATABASE_ENGINE: mysql
DRUPAL_TESTING_TEST_CODING_STYLES: false
DRUPAL_TESTING_TEST_PROFILE: thunder
DRUPAL_TESTING_INSTALLATION_FORM_VALUES: "thunder_module_configure_form.install_modules_thunder_demo=NULL"
DRUPAL_TESTING_TEST_GROUP: Thunder
PUSHER_CREDENTIALS: ${{ secrets.PUSHER_CREDENTIALS }}
RIDDLE_TOKEN: ${{ secrets.RIDDLE_TOKEN }}

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]

- uses: shivammathur/[email protected]
with:
coverage: none
php-version: '7.3'
extensions: Imagick

- name: Start MySql service
run: |
sudo /etc/init.d/mysql start

- name: Cache composer dependencies
uses: actions/[email protected]
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-cache-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-cache-

- name: Setup environment variables
run: |
echo "::add-path::$HOME/.composer/vendor/bin"

- name: Get build environment
run: composer global require thunder/drupal-testing

- name: Prepare the build
run: test-drupal-project prepare_build

- name: Install suggested dependencies
run: composer require "thunder/thunder_performance_measurement:dev-master" "thunder/testsite_builder:dev-master" "drupal/media_entity_generic:^1.0" "drupal/riddle_marketplace:^3.0-beta2" "drupal/nexx_integration:^3.0" "valiton/harbourmaster:~8.1" --no-update --no-progress --working-dir=/tmp/test/thunder/install

- name: Install drupal
run: test-drupal-project install

- name: Zip build
run: cd /tmp/test; tar cfhz build.tgz thunder; mv build.tgz ${GITHUB_WORKSPACE}

- name: Upload build
uses: actions/[email protected]
with:
name: build
path: build.tgz

test-max:
needs: build

runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]

- uses: shivammathur/[email protected]
with:
coverage: none
php-version: '7.3'
extensions: Imagick

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Start MySql service
run: |
sudo /etc/init.d/mysql start

- name: Setup environment variables
run: |
echo "::add-path::$HOME/.composer/vendor/bin"

- name: Get build environment
run: composer global require thunder/drupal-testing

- name: Download build
uses: actions/[email protected]
with:
name: build

- name: Unzip build artifact
run: mkdir -p /tmp/test; tar xCfz /tmp/test build/build.tgz thunder; rm -rf build

- name: Run config tests
run: test-drupal-project run_tests -nc
env:
DRUPAL_TESTING_TEST_GROUP: ThunderConfig

- name: Run tests suite
run: test-drupal-project run_tests

test-min:

runs-on: ubuntu-latest

if: ${{ contains(github.event.pull_request.labels.*.name, 'test-min') }}

env:
DRUPAL_TESTING_DRUPAL_VERSION: '~8.8.1'
DRUPAL_TESTING_TEST_DEPRECATION: false

steps:
- uses: actions/[email protected]

- uses: shivammathur/[email protected]
with:
coverage: none
php-version: '7.3'
extensions: Imagick

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Start MySql service
run: |
sudo /etc/init.d/mysql start

- name: Cache composer dependencies
uses: actions/[email protected]
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-cache-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-cache-

- name: Setup environment variables
run: |
echo "::add-path::$HOME/.composer/vendor/bin"

- name: Get build environment
run: composer global require thunder/drupal-testing

- name: Prepare the build
run: test-drupal-project prepare_build

- name: Install suggested dependencies
run: composer require "drupal/riddle_marketplace:^3.0-beta2" "drupal/nexx_integration:^3.0" "valiton/harbourmaster:~8.1" --no-update --no-progress --working-dir=/tmp/test/thunder/install

- name: Build the docroot
run: test-drupal-project build
env:
DRUPAL_TESTING_MIN_BUILD: true

- name: Test for deprecations
run: test-drupal-project deprecation
continue-on-error: true

- name: Run the tests
run: test-drupal-project run_tests

test-performance:
needs: [build, test-max]

runs-on: ubuntu-latest

if: ${{ contains(github.event.pull_request.labels.*.name, 'test-performance') }}

steps:
- uses: actions/[email protected]
with:
repository: thunder/docker-thunder-performance
path: thunder-distribution/docker-thunder-performance
ref: 'master'

- uses: shivammathur/[email protected]
with:
coverage: none
php-version: '7.3'
extensions: Imagick

- name: Setup environment variables
run: |
echo "::add-path::$HOME/.composer/vendor/bin"

- name: Get build environment
run: composer global require thunder/drupal-testing

- name: Download build
uses: actions/[email protected]
with:
name: build

- name: Unzip build artifact
run: mkdir -p /tmp/test; tar xCfz /tmp/test build/build.tgz thunder; rm -rf build; mv /tmp/test/thunder/install ${GITHUB_WORKSPACE}/docker-thunder-performance/www

- name: Set variables
id: vars
run: |
echo ::set-output name=DOCKER_SANITIZED_BRANCH_NAME::${GITHUB_HEAD_REF/\//_}
echo ::set-output name=DOCKER_TAG::${GITHUB_HEAD_REF/\//_}-${{ github.run_id }}

- name: Publish to Registry
uses: elgohr/[email protected]
with:
name: burda/thunder-performance
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: ${{ steps.vars.outputs.DOCKER_TAG }}
workdir: docker-thunder-performance

- name: Start Thunde performance testing task for created image
run: |
API_CALL_HTTP_CODE=$(curl \
--request POST \
--insecure \
"https://${{ secrets.THUNDER_PTM_HOST }}:3000/warmers" \
--header "Authorization: Bearer ${{ secrets.THUNDER_PTM_TOKEN }}" \
--header "Content-Type: application/json" \
--data "{\"branchTag\":\"${{ steps.vars.outputs.DOCKER_SANITIZED_BRANCH_NAME }}\",\"imageTag\":\"${{ steps.vars.outputs.DOCKER_TAG }}\",\"composeType\":\"default\"}" \
--output /dev/stderr \
--write-out "%{http_code}" \
)

if [[ "${API_CALL_HTTP_CODE}" != "200" ]]; then
exit 1
fi

# Start a debug session.
# - name: Setup tmate session
# uses: mxschmitt/[email protected]

+ 0
- 1
.gitignore View File

@@ -7,4 +7,3 @@
composer.lock
package-lock.json
phpunit.xml
phpstan.neon

+ 2
- 49
.travis.yml View File

@@ -1,8 +1,8 @@
language: php
cache:
directories:
- "$HOME/.composer/cache"
- "$HOME/.drush/cache"
- "$HOME/.composer/cache"
- "$HOME/.drush/cache"

php:
- 7.3
@@ -23,10 +23,8 @@ addons:
- /tmp/thunder-travis-ci

stages:
- build project
- sanity checks
- test
- performance test

env:
global:
@@ -39,35 +37,6 @@ jobs:
- stage: performance test

include:
- stage: build project
name: Build project with composer and package it
install:
- bash -x -e ./scripts/travis/03-build-thunder-composer.sh
script:
- bash -x -e ./scripts/travis/07-upload-artifacts-to-s3.sh

- stage: sanity checks
name: Verify makefile, check coding standards, check for deprecated code
install:
# Install drupalorg_drush module and verify, that makefile is accepted by drupal.org, otherwise we do not need to go any further
- drush dl drupalorg_drush-7.x && drush verify-makefile
- bash -x -e ./scripts/travis/03-use-thunder-artifact.sh
before_script: skip
script:
- bash -x -e ./scripts/travis/06-test-source-code.sh

- stage: sanity checks
name: Check config for composer build
before_script:
- bash -x -e ./scripts/travis/04-use-database-artifact.sh
script:
- bash -x -e ./scripts/travis/06-run-config-tests.sh

- stage: test
name: Run tests with composer (max) build
before_script:
- bash -x -e ./scripts/travis/04-use-database-artifact.sh

- stage: sanity checks
name: Check config for drush_make build
install:
@@ -82,14 +51,6 @@ jobs:
- bash -x -e ./scripts/travis/03-build-thunder-drush.sh
if: commit_message =~ \[(TEST_DRUSH_MAKE|TEST_EVERYTHING)\] OR type = cron OR head_branch =~ ^release

- stage: test
name: Run tests with composer (min) build
env: ADDITIONAL_COMPOSER_PARAMETERS="--prefer-lowest"
php: 7.2
if: commit_message =~ \[(TEST_MIN|TEST_EVERYTHING)\] OR type = cron
install:
- bash -x -e ./scripts/travis/03-build-thunder-composer.sh

- stage: test
name: Run upgrade test
env: ADDITIONAL_PHPUNIT_PARAMETERS="--exclude-group NoUpdate"
@@ -101,14 +62,6 @@ jobs:
php: 7.2
if: commit_message =~ \[(TEST_UPGRADE|TEST_EVERYTHING)\] OR type = cron

- stage: performance test
name: Build performance testing Docker image
if: commit_message =~ \[TEST_PERFORMANCE\] OR type = cron
install: skip
before_script: skip
script:
- bash -x -e ./scripts/travis/08-build-docker-performance-image.sh

# In the Thunder 8.x-3.x branch we have to wait for an actual releases to be able to test updates. That is why we
# currently disable those tests. TODO: re-enable them after release of Thunder 3
# - stage: test


+ 1
- 1
modules/thunder_demo/config/install/tour.tour.content-list.yml View File

@@ -65,5 +65,5 @@ tips:
id: last
plugin: text
label: 'That''s it for now'
body: '<p>Nice! Let us just mention that it is very easy to modify most of things on this page (as it is the case with any listing in Thunder). A very powerfull module called "Views" can be used to do that. Details about it are out of scope for this tour. For now just keep in mind that you will be able to tweak it if you need to.</p><p>This is it for now. I hope that you enjoyed our company. Now you can navigate back to the <a href="/">front page</a> and start exploring on your own.'
body: '<p>Nice! Let us just mention that it is very easy to modify most of things on this page (as it is the case with any listing in Thunder). A very powerful module called "Views" can be used to do that. Details about it are out of scope for this tour. For now just keep in mind that you will be able to tweak it if you need to.</p><p>This is it for now. I hope that you enjoyed our company. Now you can navigate back to the <a href="/">front page</a> and start exploring on your own.'
weight: 7

+ 8
- 3
modules/thunder_media/tests/src/Functional/FilenameTransliterationTest.php View File

@@ -41,9 +41,14 @@ class FilenameTransliterationTest extends ThunderTestBase {
$account = $this->drupalCreateUser(['access site reports']);
$this->drupalLogin($account);

$original = drupal_get_path('module', 'simpletest') . '/files';

\Drupal::service('file_system')->copy($original . '/image-1.png', PublicStream::basePath() . '/foo°.png');
if (file_exists('core/tests/fixtures/files/image-1.png')) {
\Drupal::service('file_system')->copy('core/tests/fixtures/files/image-1.png', PublicStream::basePath() . '/foo°.png');
}
else {
// Needed for min testing.
$original = drupal_get_path('module', 'simpletest') . '/files';
\Drupal::service('file_system')->copy($original . '/image-1.png', PublicStream::basePath() . '/foo°.png');
}

// Upload with replace to guarantee there's something there.
$edit = [


+ 18
- 0
package.json View File

@@ -0,0 +1,18 @@
{
"name": "thunder-distribution",
"version": "1.0.0",
"description": "",
"repository": {
"type": "git",
"url": "git+https://github.com/thunder/thunder-distribution.git"
},
"author": "",
"license": "GPL-2.0-or-later",
"bugs": {
"url": "https://github.com/thunder/thunder-distribution/issues"
},
"homepage": "https://github.com/thunder/thunder-distribution#readme",
"devDependencies": {
"eslint": "^6.8.0"
}
}

phpstan.neon.dist → phpstan.neon View File


+ 1
- 1
scripts/travis/06-run-tests.sh View File

@@ -6,7 +6,7 @@ cd ${TEST_DIR}/docroot

# Silently pull docker image
docker pull selenium/standalone-chrome:3.14.0-iron > /dev/null
docker run -d -p 4444:4444 -v $(pwd)/$(drush eval "echo drupal_get_path('profile', 'thunder');")/tests:/tests -v /dev/shm:/dev/shm --net=host selenium/standalone-chrome:3.14.0-iron
docker run -d -p 4444:4444 -v $(pwd)/$(drush eval "echo drupal_get_path('profile', 'thunder');"):/project -v /dev/shm:/dev/shm --net=host selenium/standalone-chrome:3.14.0-iron
docker ps -a

# Make simple export import


+ 1
- 1
src/Plugin/Thunder/OptionalModule/IvwIntegration.php View File

@@ -10,7 +10,7 @@ use Drupal\Core\Form\FormStateInterface;
* @ThunderOptionalModule(
* id = "ivw_integration",
* label = @Translation("IVW Integration"),
* description = @Translation("Integration module for the German audience measurement organisation IVW."),
* description = @Translation("Integration module for the German audience measurement organization IVW."),
* type = "module",
* )
*/


+ 1
- 1
tests/src/FunctionalJavascript/MediaGalleryModifyTest.php View File

@@ -96,7 +96,7 @@ class MediaGalleryModifyTest extends ThunderJavascriptTestBase {
// Click Select entities -> to open Entity Browser.
$this->openEntityBrowser($page, 'edit-field-paragraphs-0-subform-field-media-0-inline-entity-form-field-media-images-entity-browser-entity-browser-open-modal', 'multiple_image_browser');

$this->uploadFile($page, '/tests/fixtures/reference.jpg');
$this->uploadFile($page, '/project/tests/fixtures/reference.jpg');

// Move new image -> that's 5th image in list, to 3rd position.
$dragElement = $this->xpath("//*[@id='edit-selected']/div[5]")[0];


+ 2
- 2
themes/thunder_amp/README.md View File

@@ -3,7 +3,7 @@
This Thunder AMP theme includes config and templates to use AMP with the
Thunder distribution.
If you install this theme, two things will happen:
1. During the installation, the directoy `config/optional` of this theme will be read
1. During the installation, the directory `config/optional` of this theme will be read
and included in the config. This configures the view modes for article, paragraphs, media and blocks.
2. The thunder profile will automatically configure
the AMP settings (to be found in "Configuration/Content authoring/AMP Configuration")
@@ -23,4 +23,4 @@ In either case, you have to set your subtheme at `/admin/config/content/amp` man

Make sure to follow guidelines at https://www.ampproject.org/ on allowed styles
and markup in order to have valid HTML. Please note that CSS and JS added in a
libraries.yml file will not be loaded on AMP-enabled pages.
libraries.yml file will not be loaded on AMP-enabled pages.

+ 1
- 1
updates_checklist.yml View File

@@ -6,7 +6,7 @@ v3.2:
'#description': '<h3>These are the new features for this release:</h3>'
thunder_update_8302:
'#title': 'Change replace button to remove button on image paragraph form.'
'#description': '<p>The replace button can interfere with ajax requests, to prevent such bad behaviour, we use the remove button instead.</p>'
'#description': '<p>The replace button can interfere with ajax requests, to prevent such bad behavior, we use the remove button instead.</p>'
'#description_successful': '<p>The replace button has been successfully changed.</p>'
'#description_failed': '<p><strong>The replace button could not be changed to the remove button. Please check the image paragraphs widget settings.</strong><p>'
configure_page: { '#text': 'Paragraph configuration', '#url': 'internal:/admin/structure/paragraphs_type/image/form-display' }


Loading…
Cancel
Save