Skip to content

Commit 3ce897a

Browse files
committed
hh
1 parent 816874f commit 3ce897a

File tree

1 file changed

+65
-50
lines changed

1 file changed

+65
-50
lines changed

.github/workflows/test-suite.yaml

+65-50
Original file line numberDiff line numberDiff line change
@@ -103,56 +103,71 @@ jobs:
103103
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', '{}', '* * * * * *')"
104104
docker exec --user www-data -t cms-web /bin/bash -c "cd /var/www/cms; /usr/bin/php bin/run.php \"Seed Database\""
105105
sleep 5
106-
- name: Run Cypress
107-
id: cypress
108-
run: |
109-
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)"
110-
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"
111-
if [[ "$test_all" == true ]]; then
112-
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 npx testmo automation:resources:add-field --name git --type string --value ${GITHUB_SHA:0:7} --resources resources.json
113-
else
114-
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]};"
115-
fi
116-
continue-on-error: true
117106
118-
- name: Save Cypress test results as an artifact
119-
uses: actions/upload-artifact@v3
120-
with:
121-
name: cypress-test-results
122-
path: cypress/results
123107
124-
- name: Check Cypress exit code
108+
- name: Run Cypress
109+
id: cypress
125110
run: |
126-
if [[ ${{ steps.cypress.outcome }} == 'success' ]]; then
127-
echo "Cypress tests succeeded"
128-
else
129-
echo "Cypress tests failed with exit code ${{ steps.cypress.exitCode }}"
130-
exit 1
131-
fi
132-
133-
# Step 5: Add a comment to the PR with the workflow result
134-
- name: Add workflow result as comment on PR
135-
uses: actions/github-script@v6
136-
if: always()
137-
with:
138-
script: |
139-
const name = '${{ github.workflow }}';
140-
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
141-
const success = '${{ job.status }}' === 'success';
142-
const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;
143-
144-
await github.rest.issues.createComment({
145-
issue_number: context.issue.number,
146-
owner: context.repo.owner,
147-
repo: context.repo.repo,
148-
body: body
149-
})
150-
151-
# Step 6: Set the status of the latest commit to the final job status
152-
- name: Set latest commit status as ${{ job.status }}
153-
uses: myrotvorets/set-commit-status-action@master
154-
if: always()
155-
with:
156-
sha: ${{ steps.comment-branch.outputs.head_sha }}
157-
token: ${{ secrets.GITHUB_TOKEN }}
158-
status: ${{ job.status }}
111+
docker run \
112+
--ipc=host \
113+
--name cms-cypress \
114+
--link=cms-web:web \
115+
-v $(pwd)/cypress.config.js:/app/cypress.config.js \
116+
-v $(pwd)/cypress:/app/cypress \
117+
ghcr.io/xibosignage/xibo-cms:cypress \
118+
bash -c "echo 'NPM Version:' && npm --version
119+
120+
121+
# - name: Run Cypress2
122+
# id: cypress
123+
# run: |
124+
# 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)"
125+
# 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"
126+
# if [[ "$test_all" == true ]]; then
127+
# 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 npx testmo automation:resources:add-field --name git --type string --value ${GITHUB_SHA:0:7} --resources resources.json
128+
# else
129+
# 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]};"
130+
# fi
131+
# continue-on-error: true
132+
#
133+
# - name: Save Cypress test results as an artifact
134+
# uses: actions/upload-artifact@v3
135+
# with:
136+
# name: cypress-test-results
137+
# path: cypress/results
138+
#
139+
# - name: Check Cypress exit code
140+
# run: |
141+
# if [[ ${{ steps.cypress.outcome }} == 'success' ]]; then
142+
# echo "Cypress tests succeeded"
143+
# else
144+
# echo "Cypress tests failed with exit code ${{ steps.cypress.exitCode }}"
145+
# exit 1
146+
# fi
147+
#
148+
# # Step 5: Add a comment to the PR with the workflow result
149+
# - name: Add workflow result as comment on PR
150+
# uses: actions/github-script@v6
151+
# if: always()
152+
# with:
153+
# script: |
154+
# const name = '${{ github.workflow }}';
155+
# const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
156+
# const success = '${{ job.status }}' === 'success';
157+
# const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;
158+
#
159+
# await github.rest.issues.createComment({
160+
# issue_number: context.issue.number,
161+
# owner: context.repo.owner,
162+
# repo: context.repo.repo,
163+
# body: body
164+
# })
165+
#
166+
# # Step 6: Set the status of the latest commit to the final job status
167+
# - name: Set latest commit status as ${{ job.status }}
168+
# uses: myrotvorets/set-commit-status-action@master
169+
# if: always()
170+
# with:
171+
# sha: ${{ steps.comment-branch.outputs.head_sha }}
172+
# token: ${{ secrets.GITHUB_TOKEN }}
173+
# status: ${{ job.status }}

0 commit comments

Comments
 (0)