nanlabs/automation-seed

feature: Generic workflow call for automation

ulises-jeremias opened this issue · 13 comments

We have different workflows that are doing exactly the same. That is why we need to create a separate action and call it on each existing workflow.

  • Create a workflow at .github/workflows/automation-call.yml with the workflow_call trigger

The new workflow should have the following header:

permissions:
  contents: write

on:
  # This will allow us to reuse this workflow from other repos
  workflow_call:
    inputs:
      ref:
        description: Specifies from which ref to execute the automation.
        required: false
        type: string
        default: ""

      log_level:
        description: Specifies the log level
        required: true
        type: string
        default: 'info'

      suite:
        description: Suite to be executed
        default: ''
        type: string
        required: false

      spec:
        description: Spec to be executed. (Won't be used if suite is specified)
        default: ''
        type: string
        required: false

      spec_ci_index:
        description: Specifies the index of the spec in the CI environment
        default: 0
        type: number
        required: false

      spec_ci_total:
        description: Specifies the total number of specs in the CI environment
        default: 1
        type: number
        required: false

      max_instances:
        description: Maximum number of instances to be executed
        default: ''
        type: string
        required: false

      chrome_instances:
        description: Amount of Chrome Instances to be used. Won't use Chrome when its value is a blank string
        default: '1'
        type: string
        required: false

      firefox_instances:
        description: Amount of Firefox Instances to be used. Won't use Firefox when its value is a blank string
        default: ''
        type: string
        required: false

      browser_visible:
        description: Specifies whether the browser is visible on the Remote Dashboard. If false, the browsers will run in headless mode.
        type: string
        default: 'true'
        required: false

      enable_video:
        description: Specifies whether browser is recorded or not. Will be disabled if the browsers run in headless mode.
        type: string
        default: 'true'
        required: false

      update_report:
        description: Specifies whether the report is updated or not.
        type: string
        default: 'false'
        required: false

Expected usage example:

name: Main Report Update

on:
  push:
    branches:
      - main
    paths-ignore:
      - 'docs/**'

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

permissions:
  contents: write

jobs:
  main-check:
    concurrency: report

    uses: ./.github/workflows/automation-exec.yml
    with:
      log_level: info
      suite: ci.periodic
      max_instances: 3
      chrome_instances: 2
      browser_visible: true
      enable_video: false
      update_report: true

@ulises-jeremias can I take this?

@MogakaMo of course! Let use know if you need any help of that!

Hey @ulises-jeremias I haven't done much of DevOps since I am starting out but I needed to know a few things. Should this github action do a call on all the workflow that are in the github actions?
2. Should I work on the new workflow on a fork from this repo?

hey! yeah, you can follow the file CONTRIBUTING.md to see how to create pull requests from a fork!

About how to create the github actions. The idea is to create a reusable workflow with the params listed above, and then call it from all the existing workflows.

Basically the reusable workflow will be the only place that will implemente how to run tests.

Let me know if you want me to give more context or examples!

Sure I'll reach out.
Let me look out on the resources you've provided and then I'll reach out in case of anything

@ulises-jeremias I am not able to access the CONTRIBUTING.md file

@MogakaMo hey! how is it going? do you need any help on this? 👀

Hey @ulises-jeremias yeah I need some help.

Haven't been feeling well the past couple of days but I'm feeling much better today .
Can we chat on discord?
My handle is mogaka_dev#3773

friend request sent!