Skip to content

Commit

Permalink
Merge pull request #782 from xibosignage/release22
Browse files Browse the repository at this point in the history
Release 2.2.2
  • Loading branch information
dasgarner authored Jan 16, 2020
2 parents 24ae0b2 + 79eee3c commit bb280a8
Show file tree
Hide file tree
Showing 120 changed files with 9,721 additions and 9,252 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/build-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build Container

on:
push:
branches:
- master
- develop
- release22
release:
types: [published]

jobs:
build:
name: Build Containers
if: github.repository == 'xibosignage/xibo-cms'
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Build Latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
docker build . -t xibosignage/xibo-cms:latest
- name: Build Branch
if: github.event_name == 'push' && github.ref != 'refs/heads/master'
run: |
docker build . -t xibosignage/xibo-cms:${GITHUB_REF##*/}
- name: Push Latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
docker login --username ${{ secrets.DOCKER_HUB_USERNAME }} --password ${{ secrets.DOCKER_HUB_TOKEN }}
docker push xibosignage/xibo-cms:latest
- name: Push Branch
if: github.event_name == 'push' && github.ref != 'refs/heads/master'
run: |
docker login --username ${{ secrets.DOCKER_HUB_USERNAME }} --password ${{ secrets.DOCKER_HUB_TOKEN }}
docker push xibosignage/xibo-cms:${GITHUB_REF##*/}
- name: Build Release
if: github.event_name == 'release'
run: |
docker build . -t xibosignage/xibo-cms:release-${GITHUB_REF##*/}
- name: Push Release
if: github.event_name == 'release'
run: |
docker login --username ${{ secrets.DOCKER_HUB_USERNAME }} --password ${{ secrets.DOCKER_HUB_TOKEN }}
docker push xibosignage/xibo-cms:release-${GITHUB_REF##*/}
deploy:
name: Deploy Test Instances
runs-on: ubuntu-18.04
needs: build
if: github.repository == 'xibosignage/xibo-cms' && github.event_name == 'push'
steps:
- name: Deploy to Develop
uses: joelwmale/[email protected]
if: github.ref == 'refs/heads/develop'
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_DEVELOP_URL }}
data: ''
- name: Deploy to Staging
uses: joelwmale/[email protected]
if: github.ref == 'refs/heads/release22'
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_STAGING_URL }}
data: ''

in_fork:
name: Skip in a fork
runs-on: ubuntu-18.04
if: github.repository != 'xibosignage/xibo-cms'
steps:
- name: Skip
run: |
echo 'Skipped while in a fork'
33 changes: 33 additions & 0 deletions .github/workflows/build-cypress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build Cypress

on:
push:
branches:
- develop

jobs:
build:
name: Build Cypress
if: github.repository == 'xibosignage/xibo-cms'
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Build
run: |
docker build -f Dockerfile.cypress . -t xibosignage/xibo-cms:cypress
- name: Push
run: |
docker login --username ${{ secrets.DOCKER_HUB_USERNAME }} --password ${{ secrets.DOCKER_HUB_TOKEN }}
docker push xibosignage/xibo-cms:cypress
in_fork:
name: Skip in a fork
runs-on: ubuntu-18.04
if: github.repository != 'xibosignage/xibo-cms'
steps:
- name: Skip
run: |
echo 'Skipped while in a fork'
43 changes: 43 additions & 0 deletions .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test Suite

on: [pull_request]

jobs:
test-suite:
name: Build Containers and Run Tests
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Pull
run: |
docker pull mysql:5.6
docker pull xibosignage/xibo-xmr:latest
docker pull xibosignage/xibo-cms:develop
docker pull xibosignage/xibo-cms:cypress
- name: Build
run: |
docker build . -f Dockerfile.ci -t cms-web
- name: Run
run: |
docker run --name cms-db -e MYSQL_RANDOM_ROOT_PASSWORD=yes -e MYSQL_DATABASE=cms -e MYSQL_USER=cms -e MYSQL_PASSWORD=jenkins -d mysql:5.6
docker run --name cms-xmr -d xibosignage/xibo-xmr:latest
docker run --name cms-web -e MYSQL_USER=cms -e MYSQL_PASSWORD=jenkins -e XIBO_DEV_MODE=true -e XMR_HOST=cms-xmr --link cms-db:db --link cms-xmr:50001 -d cms-web
- name: Wait for CMS
run: |
docker exec -t cms-web /bin/bash -c "/usr/local/bin/wait-for-command.sh -q -t 300 -c \"nc -z localhost 80\""
docker cp cms-web:/var/www/cms/web/settings.php web/settings.php
docker exec -t cms-web /bin/bash -c "chown -R apache.apache /var/www/cms"
docker exec --user apache -t cms-web /bin/bash -c "cd /var/www/cms/db/migrations; ls -al"
docker exec --user apache -t cms-web /bin/bash -c "cd /var/www/cms; /usr/bin/php bin/run.php 1"
sleep 5
- name: Run PHP Unit
run: |
docker exec --user apache -t cms-web /bin/bash -c "cd /var/www/cms; php vendor/bin/phpunit --verbose --tap --log-junit results.xml"
- name: Run Cypress
run: |
docker exec cms-db mysql -ucms -pjenkins cms -e "INSERT INTO oauth_clients (id, secret, name, userId, authCode, clientCredentials) VALUES ('MrGPc7e3IL1hA6w13l7Ru5giygxmNiafGNhFv89d', 'Pk6DdDgu2HzSoepcMHRabY60lDEvQ9ucTejYvc5dOgNVSNaOJirCUM83oAzlwe0KBiGR2Nhi6ltclyNC1rmcq0CiJZXzE42KfeatQ4j9npr6nMIQAzMal8O8RiYrIoono306CfyvSSJRfVfKExIjj0ZyE4TUrtPezJbKmvkVDzh8aj3kbanDKatirhwpfqfVdfgsqVNjzIM9ZgKHnbrTX7nNULL3BtxxNGgDMuCuvKiJFrLSyIIz1F4SNrHwHz', 'cypress', 1, 0, 1)"
docker exec cms-db mysql -ucms -pjenkins cms -e "INSERT INTO oauth_client_scopes (clientId, scopeId) VALUES ('MrGPc7e3IL1hA6w13l7Ru5giygxmNiafGNhFv89d', 'all') ON DUPLICATE KEY UPDATE scopeId = scopeId"
docker run --name cms-cypress --link=cms-web:web -v $(pwd)/cypress.json:/app/cypress.json -v $(pwd)/cypress:/app/cypress xibosignage/xibo-cms:cypress bash -c "CYPRESS_baseUrl=http://web /app/node_modules/.bin/cypress run --config screenshotsFolder=/app/results,video=false --reporter junit --reporter-options 'mochaFile=/app/results/results_cypress_[hash].xml,toConsole=true'"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ P: `password`
To parse the translations:

```bash
rm -R ./cache
docker-compose exec web sh -c "cd /var/www/cms; rm -R ./cache"
docker-compose exec web sh -c "cd /var/www/cms; php bin/locale.php"
```

Expand Down
6 changes: 6 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ before(function() {
cy.tutorialClose();
});
});

Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
17 changes: 14 additions & 3 deletions lib/Controller/DataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,18 @@ public function import($dataSetId)
$this->setNoOutput(true);
}


/**
* Import Json schema
*
* @SWG\Definition(definition="importJsonSchema", type="object",
* @SWG\Property(property="uniqueKeys", type="array", description="A name of the unique column", @SWG\Items(type="string", @SWG\Property(property="colName", type="string"))),
* @SWG\Property(property="truncate", type="array", description="Flag True or False, whether to truncate existing data on import", @SWG\Items(type="string", @SWG\Property(property="truncate", type="string"))),
* @SWG\Property(property="rows", type="array", description="An array of objects with pairs: ColumnName:Value", @SWG\Items(type="object", @SWG\Property(property="colName", type="string"))),
* )
*/


/**
* Import JSON
* @param int $dataSetId
Expand All @@ -941,10 +953,9 @@ public function import($dataSetId)
* @SWG\Parameter(
* name="data",
* in="body",
* schema="json",
* description="The row data, field name vs field data format. e.g. { uniqueKeys: [col1], rows: [{col1: value1}]}",
* type="string",
* required=true
* required=true,
* @SWG\Schema(ref="#/definitions/importJsonSchema")
* ),
* @SWG\Response(
* response=200,
Expand Down
27 changes: 25 additions & 2 deletions lib/Controller/DisplayGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ public function grid()
'exactTags' => $this->getSanitizer()->getCheckbox('exactTags'),
'isDisplaySpecific' => $this->getSanitizer()->getInt('isDisplaySpecific'),
'displayGroupIdMembers' => $this->getSanitizer()->getInt('displayGroupIdMembers'),
'userId' => $this->getSanitizer()->getInt('userId')
'userId' => $this->getSanitizer()->getInt('userId'),
'isDynamic' => $this->getSanitizer()->getInt('isDynamic')
];

$scheduleWithView = ($this->getConfig()->getSetting('SCHEDULE_WITH_VIEW_PERMISSION') == 1);
Expand Down Expand Up @@ -582,9 +583,11 @@ public function add()
public function edit($displayGroupId)
{
$displayGroup = $this->displayGroupFactory->getById($displayGroupId);
$preEditIsDynamic = $displayGroup->getOriginalValue('isDynamic');

if (!$this->getUser()->checkEditable($displayGroup))
if (!$this->getUser()->checkEditable($displayGroup)) {
throw new AccessDeniedException();
}

$displayGroup->setChildObjectDependencies($this->displayFactory, $this->layoutFactory, $this->mediaFactory, $this->scheduleFactory);
$displayGroup->displayGroup = $this->getSanitizer()->getString('displayGroup');
Expand All @@ -594,6 +597,26 @@ public function edit($displayGroupId)
$displayGroup->dynamicCriteria = ($displayGroup->isDynamic == 1) ? $this->getSanitizer()->getString('dynamicCriteria') : null;
$displayGroup->dynamicCriteriaTags = ($displayGroup->isDynamic == 1) ? $this->getSanitizer()->getString('dynamicCriteriaTags') : null;

// if we have changed the type from dynamic to non-dynamic or other way around, clear display/dg members
if ($preEditIsDynamic != $displayGroup->isDynamic) {
$this->getLog()->debug('Display Group Id ' . $displayGroup->displayGroupId . ' switched is dynamic from ' . $preEditIsDynamic . ' To ' . $displayGroup->isDynamic . ' Clearing members for this Display Group.');
// get an array of assigned displays
$membersDisplays = $this->displayFactory->getByDisplayGroupId($displayGroupId);

// get an array of assigned display groups
$membersDisplayGroups = $this->displayGroupFactory->getByParentId($displayGroupId);

// unassign Displays
foreach ($membersDisplays as $display) {
$displayGroup->unassignDisplay($display);
}

// unassign Display Groups
foreach ($membersDisplayGroups as $dg) {
$displayGroup->unassignDisplayGroup($dg);
}
}

$displayGroup->save();

// Return
Expand Down
Loading

0 comments on commit bb280a8

Please sign in to comment.