From 1fd838f7cd24ef4ce73a9ac51e9f65593a21430c Mon Sep 17 00:00:00 2001 From: DerekCrannaford <43056286+DerekCrannaford@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:20:16 +1000 Subject: [PATCH] Revert yml for publish policy --- .github/workflows/playwright.yml | 95 +++++++++++++++++++++++++++++--- 1 file changed, 86 insertions(+), 9 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 79712a2..bb7cca4 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -117,12 +117,9 @@ jobs: done # Pre-requisites Prepare Cmfive Environment - - # Tests will assume playwright code is executable - # we should rely on deployment methods already to have provisioned: - # - name: Setup cmfive Test Environment - # run: | - # docker exec -t cmfive sh -c "chmod -R ugo=rwX /var/www/html*" + - name: Setup cmfive Test Environment + run: | + docker exec -t cmfive sh -c "chmod -R ugo=rwX /var/www/html*" - name: Inject configs into cmfive Test Environment run: | @@ -146,9 +143,88 @@ jobs: echo "⚠️ WARNING: could not find dev tools in boilerplate" fi - - name: Run Unit and Playwright tests + - name: Prepare cmfive Test DB + run: | + docker exec -t cmfive sh -c "DB_HOST=mysql-8 DB_USERNAME=root DB_PASSWORD=root DB_DATABASE=$DB_DATABASE DB_PORT=3306 php cmfive.php testDB setup; exit \$?"; + + # Setup Node + - uses: actions/setup-node@v4 + with: + node-version: 20 + + # Run Unit Tests + - name: "Run unit tests" + run: | + docker exec -u root cmfive chmod -R ugo=rwX /var/www/html/test/ + docker exec -u cmfive cmfive sh -c "DB_HOST=mysql-8 DB_USERNAME=$DB_USERNAME DB_PASSWORD=$DB_PASSWORD DB_DATABASE=$DB_DATABASE DB_PORT=3306 php cmfive.php tests unit all; exit \$?" + if [ $? -gt 0 ]; then + echo "Admin module tests failed" + fi + # Setup playwright + - name: Setup Playwright + run: | + echo "Installing Playwright" + cd boilerplate/test/playwright + npm ci + npx playwright install --with-deps + + - name: "Run admin module tests" + run: | + docker exec -u root cmfive sh -c "chmod ugo=rwX -R /var/www/html/system/modules/admin/install/migrations/" + cd boilerplate/test/playwright + npm run build + npm run test --module="admin" --reporter="github" + if [ $? -gt 0 ]; then + echo "Admin module tests failed" + fi + - name: "Run channel module tests" run: | - sh test/docker_run_tests.sh --cosine_container cmfive + cd boilerplate/test/playwright + npm run build + npm run test --module="channel" --reporter="github" + if [ $? -gt 0 ]; then + echo "Channel module tests failed" + fi + - name: "Run form module tests" + run: | + cd boilerplate/test/playwright + npm run build + npm run test --module="form" --reporter="github" + if [ $? -gt 0 ]; then + echo "Form module tests failed" + fi + - name: "Run report module tests" + run: | + cd boilerplate/test/playwright + npm run build + npm run test --module="report" --reporter="github" + if [ $? -gt 0 ]; then + echo "Report module tests failed" + fi + - name: "Run tag module tests" + run: | + cd boilerplate/test/playwright + npm run build + npm run test --module="tag" --reporter="github" + if [ $? -gt 0 ]; then + echo "Tag module tests failed" + fi + - name: "Run task module tests" + run: | + cd boilerplate/test/playwright + npm run build + npm run test --module="task" --reporter="github" + if [ $? -gt 0 ]; then + echo "Task module tests failed" + fi + - name: "Run timelog module tests" + run: | + cd boilerplate/test/playwright + npm run build + npm run test --module="timelog" --reporter="github" + if [ $? -gt 0 ]; then + echo "Timelog module tests failed" + fi - name: Get container logs if: ${{ failure() }} || ${{ success() }} @@ -169,8 +245,9 @@ jobs: if: ${{ failure() }} || ${{ success() }} uses: actions/upload-artifact@v4 with: - name: test-output + name: test-output-${{matrix.node_version}} path: | + boilerplate/test/Codeception/tests/_output/ boilerplate/storage/log/ boilerplate/test/playwright/test-results/ boilerplate/test/playwright/playwright-report/