runner icon indicating copy to clipboard operation
runner copied to clipboard

I don't seem able to get ACTIONS_STEP_DEBUG to give me detailed log output

Open tking16 opened this issue 1 year ago • 0 comments

I'm trying to see why my if statements are not working correctly, As stated in the guide here I've added to variables to my env portion, but I don't see what my variables are being evaluated as when I download the log archive!

My actions file looks as follows:

name: QA - Playwright Tests
on:
  push:
    branches: ["AT_test_fixes"]
env:
  EMAIL_USERNAME: ${{ secrets.PLAYWRIGHT_PROD_EMAIL }}
  EMAIL_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }}
  CREATE_ACCOUNT_VALID_EMAIL: ${{ secrets.PLAYWRIGHT_NEW_ACCOUNT_EMAIL }}
  CREATE_ACCOUNT_VALID_PASSWORD: ${{ secrets.PLAYWRIGHT_NEW_ACCOUNT_PASSWORD }}
  ACTIONS_RUNNER_DEBUG: true
  ACTIONS_STEP_DEBUG: true

jobs:
  docker-test:
    if: github.event_name == 'pull_request'
    name: Build & Test locally
    runs-on: [self-hosted, Docker]
    env:
      working-dir: testing/playwright
      EMAIL_USERNAME: ${{ secrets.PLAYWRIGHT_DEV_EMAIL }}

    steps:
      - name: Clean the workspace
        uses: docker://alpine
        with:
          args: /bin/sh -c "rm -rf /github/workspace/.* || rm -rf /github/workspace/*"
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 18.16.0

      - name: Build container
        working-directory: testing/playwright
        run: docker compose -f docker-compose.yml build

      - name: Run containerized tests
        working-directory: testing/playwright
        run:
          docker compose -f docker-compose.yml up --abort-on-container-exit

      - name: Copy report volume
        if: always()
        run: |
          rm -rf ./playwright-report

          mkdir playwright-report
          docker cp testContainer:/app/playwright-report ${{ env.working-dir }}/playwright-report
          docker cp testContainer:/app/test-results ${{ env.working-dir }}/test-results

      - uses: actions/upload-artifact@v3
        if: always()
        with:
          name: playwright-report
          path: ${{env.working-dir}}/playwright-report/

      - uses: actions/upload-artifact@v3
        name: upload video (if failed)
        if: failure()
        with:
          name: Video recording
          path: ${{env.working-dir}}/test-results/



  prod-test:
    if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
    timeout-minutes: 60
    runs-on: ubuntu-latest
    env:
      working-dir: testing/playwright
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-node@v3
      with:
        node-version: 18.16.0
    - name: Install dependencies
      working-directory: ${{ env.working-dir }}
      run: | 
        npm ci
        cat playwright.ci.env >> .env
    - name: Install Playwright Browsers
      working-directory: ${{ env.working-dir }}
      run: npx playwright install --with-deps
    - name: Run Playwright tests
      working-directory: ${{ env.working-dir }}
      run: npx playwright test
    - uses: actions/upload-artifact@v3
      if: always()
      with:
        name: playwright-report
        path: ${{env.working-dir}}/playwright-report/
        retention-days: 1

############################### SLACK REPORTING #########################################
  reporting:
    name: Generate Test Report
    needs: [docker-test, prod-test]
    runs-on: ubuntu-latest
    if: always()
    steps:
    - name: Send failed Slack message
      if: ${{ needs.docker-test.result == 'failure' || needs.prod-test.result == 'failure' }} 
      uses: slackapi/[email protected]
      with:
        payload: |
          {
            "blocks": [
              {
                "type": "section",
                "text": {
                  "type": "mrkdwn",
                  "text": "@${{ github.actor }} \n :boom: *Playwright Tests* Failed"
                }
              },
              {
                "type": "section",
                "text": {
                  "type": "mrkdwn",
                  "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Failed Tests> \n branch: `${{ github.head_ref || 'Main' }}`"
                }
              }
            ]
          }
      env:
        SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
        SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
    - name: Get previous workflow status
      uses: Mercymeilya/[email protected]
      id: last_status
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
    - name: send fixed Slack message
      if: |
        always() &&
        ${{ ((needs.docker-test.result == 'success') && (steps.last_status.outputs.last_status == 'failure')) || ((needs.prod-test.result == 'success') && (steps.last_status.outputs.last_status == 'failure')) }}
      uses: slackapi/[email protected]
      with:
        payload: |
          {
            "blocks": [
              {
                "type": "section",
                "text": {
                  "type": "mrkdwn",
                  "text": "@${{ github.actor }} \n :white_check_mark: *Playwright Tests* Are passing again"
                }
              },
              {
                "type": "section",
                "text": {
                  "type": "mrkdwn",
                  "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Test Summary> \n Environment: `${{ github.head_ref || 'Prod' }}`"
                }
              }
            ]
          }
      env:
        SLACK_WEBHOOK_URL: ${{ secrets._SLACK_WEBHOOK_URL }}
        SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

tking16 avatar Apr 29 '24 15:04 tking16