Skip to content

Commit

Permalink
Merge pull request #2419 from xibosignage/develop
Browse files Browse the repository at this point in the history
Release 4.0.8
  • Loading branch information
dasgarner authored Mar 12, 2024
2 parents 713ef02 + 1f50f2b commit e725ab0
Show file tree
Hide file tree
Showing 125 changed files with 2,319 additions and 1,599 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Configure Build X
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
Expand All @@ -32,7 +32,7 @@ jobs:
# Latest
- name: Build Latest
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
Expand All @@ -45,7 +45,7 @@ jobs:
# Release branch
- name: Build Branch
if: github.ref != 'refs/heads/master'
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/build-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build PR

on:
pull_request_review:
types: [submitted]

jobs:
build:
name: Build PR container
if: github.repository == 'xibosignage/xibo-cms' && github.event.review.state == 'APPROVED'
runs-on: ubuntu-22.04

permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Configure Build X
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Container
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ci
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ghcr.io/xibosignage/xibo-cms:test-${{ github.event.pull_request.number }}
build-args: GIT_COMMIT=${{ github.event.head.sha }}
push: true
load: false
12 changes: 9 additions & 3 deletions .github/workflows/build-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Configure Build X
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
Expand All @@ -33,9 +36,11 @@ jobs:
build-args: GIT_COMMIT=${{ github.sha }}
push: true
load: false

- name: Pull Image
run: |
docker pull ghcr.io/xibosignage/xibo-cms:release-${GITHUB_REF##*/}
- name: Build archive
run: |
CONTAINER=$(docker create ghcr.io/xibosignage/xibo-cms:release-${GITHUB_REF##*/})
Expand All @@ -45,6 +50,7 @@ jobs:
zip -rq xibo-cms-${GITHUB_REF##*/}.zip xibo-cms-${GITHUB_REF##*/}
echo 'Added to archives.'
docker rm "$CONTAINER"
- name: Release
uses: softprops/action-gh-release@v1
with:
Expand Down
80 changes: 57 additions & 23 deletions .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

# Step 3: Checkout the branch associated with the PR
- name: Checkout PR branch ${{ steps.comment-branch.outputs.head_ref }}
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ steps.comment-branch.outputs.head_sha }}

Expand Down Expand Up @@ -55,60 +55,94 @@ jobs:
echo "Comment does not match the expected format."
exit 1
fi
- name: Configure Build X
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
context: .
file: Dockerfile.ci
cache-from: type=gha
cache-to: type=gha,mode=max
tags: cms-web
build-args: GIT_COMMIT=${{ github.sha }}
push: false
load: true
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pull
run: |
docker pull mysql:8
docker pull ghcr.io/xibosignage/xibo-xmr:latest
docker pull ghcr.io/xibosignage/xibo-cms:test-${{ github.event.issue.number }}
- 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:8
docker run --name cms-xmr -d ghcr.io/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
docker run --name cms-web -e MYSQL_HOST=cms-db -e MYSQL_USER=cms -e MYSQL_PASSWORD=jenkins -e CMS_DEV_MODE=true -e XMR_HOST=cms-xmr -e CMS_USAGE_REPORT=false -e INSTALL_TYPE=ci -e MYSQL_BACKUP_ENABLED=false --link cms-db --link cms-xmr -d ghcr.io/xibosignage/xibo-cms:test-${{ github.event.issue.number }}
- 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 www-data.www-data /var/www/cms"
docker exec --user www-data -t cms-web /bin/bash -c "cd /var/www/cms; /usr/bin/php bin/run.php 1"
sleep 5
- name: Seed Database
run: |
docker exec cms-db mysql -ucms -pjenkins cms -e "UPDATE setting SET value=\"6v4RduQhaw5Q\" WHERE setting = \"SERVER_KEY\" "
docker exec cms-db mysql -ucms -pjenkins cms -e "INSERT INTO task (name, class, status, isActive, configFile, options, schedule) VALUES ('Seed Database', '\\\\Xibo\\\\XTR\\\\SeedDatabaseTask', 2, 1, '/tasks/seed-database.task', '{}', '* * * * * *')"
docker exec --user www-data -t cms-web /bin/bash -c "cd /var/www/cms; /usr/bin/php bin/run.php \"Seed Database\""
sleep 5
- name: Run PHP Unit
run: |
docker exec --user www-data -t cms-web /bin/bash -c "cd /var/www/cms; php vendor/bin/phpunit --log-junit results.xml"
# Remove our own package.json/lock files so that they don't get installed along with testmo.
- run: |
rm package.json
rm package-lock.json
- name: Configure Testmo
uses: actions/setup-node@v3
with:
node-version: 19

- run: npm install --no-save @testmo/testmo-cli

- run: |
npx testmo automation:resources:add-field --name git --type string \
--value ${GITHUB_SHA:0:7} --resources resources.json
RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
npx testmo automation:resources:add-link --name build \
--url $RUN_URL --resources resources.json
- name: Run Cypress
id: cypress
run: |
docker pull ghcr.io/xibosignage/xibo-cms:cypress
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"
if [[ "$test_all" == true ]]; then
docker run --ipc=host --name cms-cypress --link=cms-web:web -v $(pwd)/cypress.config.js:/app/cypress.config.js -v $(pwd)/cypress:/app/cypress ghcr.io/xibosignage/xibo-cms:cypress bash -c "CYPRESS_baseUrl=http://web /app/node_modules/.bin/cypress run --config screenshotsFolder=/app/cypress/results,video=false --reporter junit --reporter-options 'mochaFile=/app/cypress/results/results_cypress_[hash].xml,toConsole=true' && chown -R 1001:1001 /app/cypress/results && exit \${PIPESTATUS[0]};"
npx testmo automation:run:submit \
--instance "$TESTMO_URL" \
--project-id 3 \
--name "Cypress Tests" \
--source "github-action" \
--resources resources.json \
--results cypress/results/*.xml \
-- docker run --ipc=host --name cms-cypress --link=cms-web:web -v $(pwd)/cypress.config.js:/app/cypress.config.js -v $(pwd)/cypress:/app/cypress ghcr.io/xibosignage/xibo-cms:cypress bash -c "CYPRESS_baseUrl=http://web /app/node_modules/.bin/cypress run --config screenshotsFolder=/app/cypress/results,video=false --reporter junit --reporter-options 'mochaFile=/app/cypress/results/results_cypress_[hash].xml,toConsole=true' && chown -R 1001:1001 /app/cypress/results && exit \${PIPESTATUS[0]};"
else
docker run --ipc=host --name cms-cypress --link=cms-web:web -v $(pwd)/cypress.config.js:/app/cypress.config.js -v $(pwd)/cypress:/app/cypress ghcr.io/xibosignage/xibo-cms:cypress bash -c "CYPRESS_baseUrl=http://web /app/node_modules/.bin/cypress run --config screenshotsFolder=/app/cypress/results,video=false --spec \"$spec_content\" --reporter junit --reporter-options 'mochaFile=/app/cypress/results/results_cypress_[hash].xml,toConsole=true' && chown -R 1001:1001 /app/cypress/results && exit \${PIPESTATUS[0]};"
npx testmo automation:run:submit \
--instance "$TESTMO_URL" \
--project-id 3 \
--name "Cypress Tests" \
--source "github-action" \
--resources resources.json \
--results cypress/results/*.xml \
-- docker run --ipc=host --name cms-cypress --link=cms-web:web -v $(pwd)/cypress.config.js:/app/cypress.config.js -v $(pwd)/cypress:/app/cypress ghcr.io/xibosignage/xibo-cms:cypress bash -c "CYPRESS_baseUrl=http://web /app/node_modules/.bin/cypress run --config screenshotsFolder=/app/cypress/results,video=false --spec \"$spec_content\" --reporter junit --reporter-options 'mochaFile=/app/cypress/results/results_cypress_[hash].xml,toConsole=true' && chown -R 1001:1001 /app/cypress/results && exit \${PIPESTATUS[0]};"
fi
continue-on-error: true
- name: Save Cypress test results as an artifact
uses: actions/upload-artifact@v3
with:
name: cypress-test-results
path: cypress/results
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}

- name: Check Cypress exit code
run: |
if [[ ${{ steps.cypress.outcome }} == 'success' ]]; then
Expand All @@ -117,13 +151,14 @@ jobs:
echo "Cypress tests failed with exit code ${{ steps.cypress.exitCode }}"
exit 1
fi
# Step 5: Add a comment to the PR with the workflow result
- name: Add workflow result as comment on PR
uses: actions/github-script@v6
if: always()
with:
script: |
const name = '${{ github.workflow }}';
const name = '${{ github.workflow }}';
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const success = '${{ job.status }}' === 'success';
const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;
Expand All @@ -143,4 +178,3 @@ jobs:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}

14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cypress/e2e/Display/displays.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe('Displays', function() {

// Set the default layout
cy.get('.modal .select2-container--bootstrap').click();
cy.get('.modal .select2-container--open input[type="search"]').type('disp4_default_layout');
cy.get('.modal .select2-container--open textarea[type="search"]').type('disp4_default_layout');

cy.wait('@loadLayoutAfterSearch');
cy.get('.select2-results__option').contains('disp4_default_layout').click();
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/Layout/Editor/layout_editor_dataset.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ describe('Layout Designer', function() {
// Wait for datasets to load
cy.wait('@loadDatasets');
cy.get('.select2-container--open').contains('test');
cy.get('.select2-container--open .select2-results > ul > li').should('have.length', 1);
cy.get('.select2-container--open .select2-results > ul > li:first').contains('test').click();

cy.get('[name="lowerLimit"]').clear().type('1');
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/Reporting/report_timeconnected.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Time Connected', function() {
cy.get('.select2-search__field').click();

// Type the display name
cy.get('.select2-container--open input[type="search"]').type('POP Display Group');
cy.get('.select2-container--open textarea[type="search"]').type('POP Display Group');
cy.get('.select2-container--open .select2-results > ul').contains('POP Display Group').click();

// Click on the Apply button
Expand Down
Loading

0 comments on commit e725ab0

Please sign in to comment.