Skip to content

Commit

Permalink
Merge pull request #99 from lilt/3.x-development
Browse files Browse the repository at this point in the history
Release 3.5.0
  • Loading branch information
tgallant authored Mar 15, 2023
2 parents c0760c8 + e515ae0 commit 58f8687
Show file tree
Hide file tree
Showing 67 changed files with 8,455 additions and 510 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/craft-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Tests on multiple craft versions
on:
push:
branches:
- 1.x #CraftCMS v3 | PHP 7.2
- 2.x #CraftCMS v4 | PHP 8.0.2
- 3.x #CraftCMS v3 | PHP 7.2
- 4.x #CraftCMS v4 | PHP 8.0.2
pull_request:
branches:
- "*"
Expand Down Expand Up @@ -92,6 +92,20 @@ jobs:
"3.7.55.3",
"3.7.56",
"3.7.57",
"3.7.58",
"3.7.59",
"3.7.60",
"3.7.61",
"3.7.62",
"3.7.63",
"3.7.63.1",
"3.7.64",
"3.7.64.1",
"3.7.65",
"3.7.65.1",
"3.7.65.2",
"3.7.66",
"3.7.67",
]
runs-on: ubuntu-latest
steps:
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: E2E Tests
on:
push:
branches:
- 3.x #CraftCMS v3 | PHP 7.2
- 4.x #CraftCMS v4 | PHP 8.0.2
pull_request:
branches:
- "*"
jobs:
tests:
strategy:
matrix:
os: [ ubuntu-latest ]
scenario: [
"cypress/e2e/jobs/copy-source-text-flow/filters.cy.js",
"cypress/e2e/jobs/copy-source-text-flow/success-path-multiple.cy.js",
"cypress/e2e/jobs/copy-source-text-flow/success-path-single.cy.js",
"cypress/e2e/jobs/instant/success-path-multiple.cy.js",
"cypress/e2e/jobs/instant/success-path-multiple-copy-slug.cy.js",
"cypress/e2e/jobs/instant/success-path-multiple-copy-slug-and-enable-after-publish.cy.js",
"cypress/e2e/jobs/instant/success-path-multiple-enable-after-publish.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-bulk-publishing.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-bulk-publishing-copy-slug.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-bulk-publishing-copy-slug-and-enable-after-publish.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-bulk-publishing-enable-after-publish.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-single-publishing.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-single-publishing-copy-slug.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-single-publishing-copy-slug-and-enable-after-publish.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-single-publishing-enable-after-publish.cy.js",
"cypress/e2e/jobs/verified/success-path-single.cy.js",
"cypress/e2e/jobs/instant/success-path-single.cy.js",
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set the value
id: step_one
run: |
echo "CYPRESS_SCENARIO=${{ matrix.scenario }}" >> $GITHUB_ENV
echo "DB_DATABASE=$(uuidgen)" >> $GITHUB_ENV
- name: Run automation
working-directory: ./e2e
run: |
echo ${DB_DATABASE}
make up
make e2e-github
- name: Copy artifacts
if: ${{ failure() }}
working-directory: ./e2e
run: |
make backup-db
mkdir cypress/craft
mkdir cypress/craft/storage
mkdir cypress/craft/config
docker compose cp app:/app/storage cypress/craft/storage
docker compose cp app:/app/config cypress/craft/config
docker compose cp app:/app/composer.json cypress/craft
docker compose cp app:/app/composer.lock cypress/craft
- name: Use the Upload Artifact GitHub Action
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: "${{ github.job }}_${{ github.run_id }}_${{ github.workflow }}_e2e_artifacts"
path: |
./e2e/cypress/craft
./e2e/cypress/screenshots
./e2e/cypress/videos
./e2e/happy-lager-main/storage
44 changes: 16 additions & 28 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,6 @@ on:
branches:
- "*"
jobs:
e2e-instant:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run automation
working-directory: ./e2e
run: |
make up
make test-instant
e2e-verified:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run automation
working-directory: ./e2e
run: |
make up
make test-verified
e2e-copy-source-text:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run automation
working-directory: ./e2e
run: |
make up
make test-copy-source-text
tests-php-72:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -79,6 +52,21 @@ jobs:
- name: Tests
run: make test

tests-php-80:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set the value
id: step_one
run: |
echo "PHP_VERSION=8.0" >> $GITHUB_ENV
- name: Build containers
run: make up
- name: Composer install
run: make composer-install
- name: Tests
run: make test

tests-php-72-guzzle-6:
runs-on: ubuntu-latest
steps:
Expand All @@ -96,7 +84,7 @@ jobs:
- name: Tests
run: make test

tests-php-74-mysql-80:
tests-php-80-mysql-80:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 3.5.0 - 2023-03-14
### Added
- Notification if the plugin is outdated
- New queue job for manually syncing Lilt jobs

### Fixed
- Fixed an issue with drafts being overridden due to an incorrect canonical merge
- Fixed a problem where translations were not updating to a failed status when a job fails

## 3.4.3 - 2023-02-24
### Fixed
- Multilingual draft publishing issue
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "lilt/craft-lilt-plugin",
"description": "The Lilt plugin makes it easy for you to send content to Lilt for translation right from within Craft CMS.",
"type": "craft-plugin",
"version": "3.4.3",
"version": "3.5.0",
"keywords": [
"craft",
"cms",
Expand Down
45 changes: 38 additions & 7 deletions e2e/Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,56 @@
CYPRESS_CACHE_FOLDER?=/e2e/.cache
DB_DATABASE?=craft-lilt

install: clone
docker run --rm \
-v ${PWD}/happy-lager-main:/app \
-v ${PWD}/happy-lager-main/plugin-src:/tmp/craft-lilt-plugin \
composer:latest \
composer require craftcms/cms:3.7.68 -W

backup-db:
docker-compose exec -T app sh -c 'php craft db/backup'

build:
docker build -f happy-lager-main/Dockerfile happy-lager-main -t happy-lager

down:
docker-compose -f docker-compose.yml down --remove-orphans -v
docker-compose down --remove-orphans -v

mup: #migrate app up
docker-compose exec -T app sh -c 'php craft migrate/up'

mdown: #migrate app down
docker-compose exec -T app sh -c 'php craft migrate/down'

clone:
rm -rf happy-lager-main
git clone https://github.com/craftcms/demo.git happy-lager-main
rm -rf happy-lager-main/.git
cp -R happy-lager-override/* happy-lager-main

up: clone down
rm -rf happy-lager-main/plugin-src
mkdir happy-lager-main/plugin-src
cp -R ../resources happy-lager-main/plugin-src/resources
cp -R ../src happy-lager-main/plugin-src/src
cp -R ../composer.json happy-lager-main/plugin-src/composer.json
docker-compose -f docker-compose.yml up --build -d

up: clone down
docker-compose up --build -d
docker-compose exec -T mysql sh -c 'while ! mysqladmin ping -h"mysql" --silent; do sleep 1; done'
docker-compose exec -T app sh -c 'php craft setup/security-key'
docker-compose exec -T app sh -c 'echo DB_DRIVER=mysql >> .env'
docker-compose exec -T app sh -c 'echo DB_SERVER=mysql >> .env'
docker-compose exec -T app sh -c 'echo DB_DATABASE=craft-lilt >> .env'
docker-compose exec -T app sh -c 'echo DB_DATABASE=${DB_DATABASE} >> .env'
docker-compose exec -T app sh -c 'echo DB_USER=craft-lilt >> .env'
docker-compose exec -T app sh -c 'echo DB_PASSWORD=craft-lilt >> .env'
docker-compose exec -T app sh -c 'echo DB_SCHEMA=public >> .env'
docker-compose exec -T app sh -c 'echo DB_TABLE_PREFIX= >> .env'
docker-compose exec -T app sh -c 'echo CRAFT_LILT_PLUGIN_QUEUE_DELAY_IN_SECONDS=5 >> .env'
docker-compose exec -T app sh -c 'php craft db/restore happylager.sql'
docker-compose exec -T app sh -c 'php craft plugin/install craft-lilt-plugin'
docker-compose exec -T app sh -c 'php craft up'
docker-compose exec -T app sh -c 'php craft migrate/up'
docker-compose exec -T app sh -c 'php craft plugin/install craft-lilt-plugin'
docker-compose exec -T app sh -c 'php craft queue/run'

cli:
docker-compose exec -T app sh
Expand All @@ -44,13 +63,14 @@ test:
--entrypoint=cypress \
cypress/included:12.2.0 run --headless --config-file /e2e/cypress.config.js --record false


test-instant:
docker run -u root -t -v ${PWD}:/e2e -w /e2e --env CYPRESS_CACHE_FOLDER=${CYPRESS_CACHE_FOLDER} node:18.12.1 npm install
docker run -u root -t -v ${PWD}:/e2e -w /e2e --env CYPRESS_CACHE_FOLDER=${CYPRESS_CACHE_FOLDER} \
--network e2e-network \
--env-file .env.test \
--entrypoint=cypress \
cypress/included:12.2.0 run --headless --config-file /e2e/cypress.config.js --spec cypress/e2e/jobs/instant/*.js --record false
cypress/included:12.2.0 run --headless --config-file /e2e/cypress.config.js --spec cypress/e2e/jobs/instant/success-path-multiple.cy.js --record false

test-verified:
docker run -u root -t -v ${PWD}:/e2e -w /e2e --env CYPRESS_CACHE_FOLDER=${CYPRESS_CACHE_FOLDER} node:18.12.1 npm install
Expand All @@ -67,3 +87,14 @@ test-copy-source-text:
--env-file .env.test \
--entrypoint=cypress \
cypress/included:12.2.0 run --headless --config-file /e2e/cypress.config.js --spec cypress/e2e/jobs/copy-source-text-flow/*.js --record false


# --ipc=host
# https://github.com/cypress-io/cypress/issues/350
e2e-github:
docker run -u root -t -v ${PWD}:/e2e -w /e2e --env CYPRESS_CACHE_FOLDER=${CYPRESS_CACHE_FOLDER} node:18.12.1 npm install
docker run --ipc=host -u root -t -v ${PWD}:/e2e -w /e2e --env CYPRESS_CACHE_FOLDER=${CYPRESS_CACHE_FOLDER} \
--network e2e-network \
--env-file .env.test \
--entrypoint=cypress \
cypress/included:12.2.0 run --headless --browser chrome --config-file /e2e/cypress.config.js --spec ${CYPRESS_SCENARIO}
1 change: 1 addition & 0 deletions e2e/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default defineConfig({
viewportWidth: 1920,
viewportHeight: 1080,
defaultCommandTimeout: 60 * 1000,
// video: false,
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const {generateJobData} = require('../../../support/job/generator.js');

describe(
'[Instant] Success path for job with multiple target languages',
() => {
const entryLabel = 'The Future of Augmented Reality';
const entryId = 24;

it('with copy slug enabled & enable after publish enabled', () => {
const {jobTitle, slug} = generateJobData();

cy.log(`Job title: ${jobTitle}`);
cy.log(`Slug: ${slug}`);

cy.instantFlow({
slug,
entryLabel,
jobTitle,
entryId,
copySlug: true,
enableAfterPublish: true,
languages: ['de', 'es', 'uk'],
batchPublishing: true,
});
});

});
24 changes: 24 additions & 0 deletions e2e/cypress/e2e/jobs/instant/success-path-multiple-copy-slug.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const {generateJobData} = require('../../../support/job/generator.js');

describe(
'[Instant] Success path for job with multiple target languages',
() => {
const entryLabel = 'The Future of Augmented Reality';
const entryId = 24;

it('with copy slug enabled & enable after publish disabled', () => {
const {jobTitle, slug} = generateJobData();

cy.instantFlow({
slug,
entryLabel,
jobTitle,
entryId,
copySlug: true,
enableAfterPublish: false,
languages: ['de', 'es', 'uk'],
batchPublishing: true,
});
});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const {generateJobData} = require('../../../support/job/generator.js');

describe(
'[Instant] Success path for job with multiple target languages',
() => {
const entryLabel = 'The Future of Augmented Reality';
const entryId = 24;

it('with copy slug disabled & enable after publish enabled', () => {
const {jobTitle, slug} = generateJobData();

cy.instantFlow({
slug,
entryLabel,
jobTitle,
entryId,
copySlug: false,
enableAfterPublish: true,
languages: ['de', 'es', 'uk'],
batchPublishing: true,
});
});

});
Loading

0 comments on commit 58f8687

Please sign in to comment.