Luxe-Quality / docusaurus_issues

Rise an issue if you found any bug in the knowledge base
0 stars 0 forks source link

Add the section with working with YML file to understand how it works #11

Closed OleksandrBaior closed 3 months ago

OleksandrBaior commented 5 months ago

Example YML file for Cypress framework

Let's go through each line of this GitHub Actions configuration file:

Header and Trigger Events

name: Cypress Tests
on:
    workflow_dispatch:
    push:
        branches: [master]
    pull_request:
        branches: [master]

Jobs Description

Job "test"

jobs:
    test:
        timeout-minutes: 60
        runs-on: ubuntu-latest
        name: E2E on Chrome
        steps:
Steps of the "test" Job
            - name: Checkout
              uses: actions/checkout@v4
            - name: Cypress run
              uses: cypress-io/github-action@v6
              with:
                  browser: chrome
                  record: true
                  parallel: true
              env:
                  group: 'UI-Chrome'
                  TZ: Europe/Warsaw
                  CYPRESS_ENV: Poland
                  CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
            - name: Screenshots report
              if: always()
              uses: actions/upload-artifact@v4
              with:
                  name: cypress-screenshots
                  path: cypress/screenshots
                  if-no-files-found: ignore
            - name: Video report
              if: always()
              uses: actions/upload-artifact@v4
              with:
                  name: cypress-videos
                  path: cypress/videos
                  if-no-files-found: ignore
            - name: Create cucumber-report
              uses: actions/upload-artifact@v4
              if: ${{ !cancelled() }}
              with:
                  name: cucumber-report
                  path: ./cucumber-report
                  retention-days: 15

Job "deploy"

    deploy:
        needs: test
        runs-on: ubuntu-latest
        if: always()
Steps of the "deploy" Job
        steps:
            - name: Download cucumber report artifact
              if: always()
              uses: actions/download-artifact@v4
            - name: Display structure of downloaded files
              if: always()
              run: ls -R
            - name: Deploy report to Github Pages
              if: always()
              uses: peaceiris/actions-gh-pages@v2
              env:
                  PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
                  PUBLISH_BRANCH: gh-pages
                  PUBLISH_DIR: ./cucumber-report

Example YML file for Playwright framework

Let's go through each line of this GitHub Actions configuration file for running Playwright tests:

Header and Trigger Events

name: Playwright Tests
on:
  workflow_dispatch:
  push:
    branches: [main]
  pull_request:
    branches: [main]

Jobs Description

Job "test"

jobs:
  test:
    timeout-minutes: 60
    runs-on: ubuntu-latest
    steps:
Steps of the "test" Job
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - name: Install dependencies
        run: npm ci
      - name: Install Playwright Browsers
        run: npx playwright install --with-deps 
      - name: Run Playwright tests
        run: npx playwright test
      - name: Create playwright-report
        uses: actions/upload-artifact@v4
        if: ${{ !cancelled() }}
        with:
          name: html-report
          path: reports
          retention-days: 30 
      - name: Get Allure history
        uses: actions/checkout@v2
        if: always()
        continue-on-error: true
        with:
          ref: gh-pages
          path: gh-pages
      - name: Allure Report action from marketplace
        uses: simple-elf/allure-report-action@master
        if: always()
        with:
          allure_results: reports/allure-results
          allure_history: reports/allure-history
          keep_reports: 10
      - name: Deploy report to Github Pages
        if: always()
        uses: peaceiris/actions-gh-pages@v2
        env:
          PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PUBLISH_BRANCH: gh-pages
          PUBLISH_DIR: reports/allure-history
zefirlover commented 3 months ago

В нас вже є секція про yml, яка пояснює, що воно таке та найбільш потрібні моменти: https://knowledge-base.luxequality.com/docs/guides/GitHub/gitHub_action

Я не певен, чи нам треба більше