ros-industrial / industrial_ci

Easy continuous integration repository for ROS repositories
Apache License 2.0
248 stars 129 forks source link

Run locally without "matrix" entry in .travis.yml #547

Open agutenkunst opened 4 years ago

agutenkunst commented 4 years ago

I noticed that with https://github.com/PilzDE/pilz_robots/commit/a64d0a4a749b8cbe278c889bf9dc64a5d8123a85 where I switch from matrix to the job list to have proper job names removed the possibility to run locally using run_travis since this expects a "matrix" to be defined.

It seems that https://github.com/ros-industrial/industrial_ci/blob/97dc68dde37c1c94b7e8fba3b88cd0d5bcb9f2a9/industrial_ci/scripts/run_travis#L86 is really dependend on the previous format.

agutenkunst commented 4 years ago

I found that there is (beta) some work including a "Normalized Build Config" see:

I could not find out right now if there is already a CLI for creating such a "Normalized Build Config", but maybe this would be a way to handle the different ways the .travis.yml can be expressed.

agutenkunst commented 4 years ago

I checked with https://config.travis-ci.com/explore and it seems that both Matrix Style and Job Style produce (except for the names which can only be used in Job Style) the same result.

Matrix style

Input

language: generic
dist: trusty
os: linux

env:
  global:
    - FOO_GLOB=1
    - BAR_GLOB=2
  matrix:
    - ROS_REPO=main
    - ROS_REPO=testing
install:
  - ./install_script.sh
script:
  - ./run_script.sh

Output from https://config.travis-ci.com/explore

[
  {
    "os": "linux",
    "language": "generic",
    "dist": "trusty",
    "install": [
      "./install_script.sh"
    ],
    "script": [
      "./run_script.sh"
    ],
    "env": [
      {
        "FOO_GLOB": "1"
      },
      {
        "BAR_GLOB": "2"
      },
      {
        "ROS_REPO": "main"
      }
    ]
  },
  {
    "os": "linux",
    "language": "generic",
    "dist": "trusty",
    "install": [
      "./install_script.sh"
    ],
    "script": [
      "./run_script.sh"
    ],
    "env": [
      {
        "FOO_GLOB": "1"
      },
      {
        "BAR_GLOB": "2"
      },
      {
        "ROS_REPO": "testing"
      }
    ]
  }
]

Job Style

Input

language: generic
dist: trusty
os: linux

env:
  global:
    - FOO_GLOB=1
    - BAR_GLOB=2

jobs:
  include:
    - name: "Main"
      install:
        - ./install_script.sh
      env:
        - REPO=main
      script:
        - ./run_script.sh

    - name: "Testing"
      install:
        - ./install_script.sh
      env:
        - REPO=testing
      script:
        - ./run_script.sh

Output from https://config.travis-ci.com/explore

[
  {
    "os": "linux",
    "language": "generic",
    "dist": "trusty",
    "name": "Main",
    "install": [
      "./install_script.sh"
    ],
    "env": [
      {
        "FOO_GLOB": "1"
      },
      {
        "BAR_GLOB": "2"
      },
      {
        "REPO": "main"
      }
    ],
    "script": [
      "./run_script.sh"
    ]
  },
  {
    "os": "linux",
    "language": "generic",
    "dist": "trusty",
    "name": "Testing",
    "install": [
      "./install_script.sh"
    ],
    "env": [
      {
        "FOO_GLOB": "1"
      },
      {
        "BAR_GLOB": "2"
      },
      {
        "REPO": "testing"
      }
    ],
    "script": [
      "./run_script.sh"
    ]
  }
]