Skip to content

Commit

Permalink
Add matrix input to Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-luedtke committed Jan 23, 2021
1 parent 341ac5b commit d43245f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
6 changes: 6 additions & 0 deletions .github/action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ export TARGET_REPO_NAME=${GITHUB_REPOSITORY##*/}
export PYTHONUNBUFFERED=${PYTHONUNBUFFERED:1}
export _FOLDING_TYPE=github_actions

if [ -n "$INPUT_MATRIX" ]; then
vars=$(jq -r 'keys[] as $k | "export \($k)=\(.[$k]|tojson)" | gsub("\\$\\$";"\\$")' <<< "$INPUT_MATRIX" | grep "^export [A-Z][A-Z_]*=")
echo "$vars"
eval "$vars"
fi

env "$@" bash "$DIR_THIS/../industrial_ci/src/ci_main.sh"
22 changes: 11 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:
industrial_ci:
strategy:
matrix:
env:
- {ROS_DISTRO: kinetic, TARGET_WORKSPACE: 'industrial_ci/mockups/industrial_ci_testpkg', VERBOSE_OUTPUT: true, CATKIN_LINT: true, AFTER_SCRIPT: '[ "$(command -v catkin_lint)" = /usr/local/bin/catkin_lint ]'}
- {ROS_DISTRO: kinetic, TARGET_WORKSPACE: 'industrial_ci/mockups/industrial_ci_testpkg', CATKIN_LINT: true, ADDITIONAL_DEBS: 'python-catkin-lint', AFTER_SCRIPT: '[ "$(command -v catkin_lint)" = /usr/bin/catkin_lint ]'}
include:
- {ROS_DISTRO: kinetic, TARGET_WORKSPACE: 'industrial_ci/mockups/industrial_ci_testpkg', VERBOSE_OUTPUT: true, CATKIN_LINT: true, AFTER_SCRIPT: '[ "$$(command -v catkin_lint)" = /usr/local/bin/catkin_lint ]'}
- {ROS_DISTRO: kinetic, TARGET_WORKSPACE: 'industrial_ci/mockups/industrial_ci_testpkg', CATKIN_LINT: true, ADDITIONAL_DEBS: 'python-catkin-lint', AFTER_SCRIPT: '[ "$$(command -v catkin_lint)" = /usr/bin/catkin_lint ]'}
- {ROS_DISTRO: kinetic, TARGET_WORKSPACE: 'industrial_ci/mockups/industrial_ci_testpkg', CMAKE_ARGS: '-DFAIL_CMAKE=true', EXPECT_EXIT_CODE: 1}
- {ROS_DISTRO: kinetic, TARGET_WORKSPACE: 'industrial_ci/mockups/industrial_ci_testpkg', CATKIN_LINT: pedantic, EXPECT_EXIT_CODE: 1}
- {ROS_DISTRO: kinetic, TARGET_WORKSPACE: 'industrial_ci/mockups/industrial_ci_testpkg', ROSDEP_SKIP_KEYS: "rospy_tutorials rostest", EXPECT_EXIT_CODE: 1}
- {ROS_DISTRO: kinetic, TARGET_WORKSPACE: 'industrial_ci/mockups/testpkg_broken_install', EXPECT_EXIT_CODE: 1}
- {ROS_DISTRO: melodic, NOT_TEST_BUILD: true, _GUARD_INTERVAL: 10}
- {ROS_DISTRO: kinetic, NOT_TEST_INSTALL: true, BEFORE_INIT: 'test -z "${CXX+x}"'} # test that CXX is not set
- {ROS_DISTRO: kinetic, NOT_TEST_INSTALL: true, CXX: '/usr/bin/gcc', BEFORE_INIT: 'test -z "${CXX+x}"', EXPECT_EXIT_CODE: 1} # test the CXX test
- {ROS_DISTRO: kinetic, NOT_TEST_INSTALL: true, BEFORE_INIT: 'test -z "$${CXX+x}"'} # test that CXX is not set
- {ROS_DISTRO: kinetic, NOT_TEST_INSTALL: true, CXX: '/usr/bin/gcc', BEFORE_INIT: 'test -z "$${CXX+x}"', EXPECT_EXIT_CODE: 1} # test the CXX test
- {ROS_DISTRO: kinetic, NOT_TEST_BUILD: true, NOT_TEST_INSTALL: true} # This may not make much sense. Only for testing purpose.
- {ROS_DISTRO: kinetic, CATKIN_PARALLEL_JOBS: '-p1', ROS_PARALLEL_JOBS: '-j1'} # Intend build on low-power platform

Expand All @@ -35,23 +35,23 @@ jobs:
- {ROS_DISTRO: melodic, PRERELEASE: true, PRERELEASE_DOWNSTREAM_DEPTH: 1}
- {ROS_DISTRO: melodic, PRERELEASE: true, TARGET_WORKSPACE: 'industrial_ci/mockups/failing_test', PRERELEASE_REPONAME: "failing_test", EXPECT_EXIT_CODE: 1}
- {ROS_DISTRO: kinetic, PRERELEASE: true, PRERELEASE_REPONAME: industrial_ci}
- {ROS_DISTRO: kinetic, UPSTREAM_WORKSPACE: debian, AFTER_SCRIPT: 'ccache 2> /dev/null && exit 1; [ "$?" = "127" ]'}
- {ROS_DISTRO: kinetic, UPSTREAM_WORKSPACE: debian, AFTER_SCRIPT: 'ccache 2> /dev/null && exit 1; [ "$$?" = "127" ]'}
# Using default file name for ROSINSTALL_FILENAME, test CCACHE, verify cache was filled
- {ROS_DISTRO: kinetic, UPSTREAM_WORKSPACE: file, CCACHE_DIR: '/github/home/.ccache', AFTER_SCRIPT: 'num=($(ccache -s | grep "files in cache")) && (( num[-1] > 0 ))'}
- {ROS_DISTRO: kinetic, UPSTREAM_WORKSPACE: file, CCACHE_DIR: '/github/home/.ccache', AFTER_SCRIPT: 'num=($$(ccache -s | grep "files in cache")) && (( num[-1] > 0 ))'}
- {ROS_DISTRO: indigo, UPSTREAM_WORKSPACE: file, USE_DEB: true, EXPECT_EXIT_CODE: 1} # Expected to fail. See https://github.com/ros-industrial/industrial_ci/pull/74
- {ROS_DISTRO: kinetic, UPSTREAM_WORKSPACE: 'https://raw.githubusercontent.com/ros-industrial/industrial_ci/master/.travis.rosinstall'}
- {ROS_DISTRO: indigo, ADDITIONAL_DEBS: 'ros-indigo-opencv3', VERBOSE_OUTPUT: false}
- {ROS_DISTRO: indigo, ADDITIONAL_DEBS: 'ros-hydro-opencv3', DEBUG_BASH: true, EXPECT_EXIT_CODE: 100} # This should fail (trying from a wrong distro).
- {ROS_DISTRO: kinetic, UPSTREAM_WORKSPACE: file, ROSINSTALL_FILENAME: .ci.rosinstall} # Testing arbitrary file name without ROS_DISTRO suffix. As of 6/3/2016 this fails due to https://github.com/ros-industrial/industrial_core/pull/144#issuecomment-223186764
- {ROS_DISTRO: kinetic, UPSTREAM_WORKSPACE: file, ROSINSTALL_FILENAME: .i.do.not.exist, EXPECT_EXIT_CODE: 1}
- {DOCKER_IMAGE: 'ros:kinetic-ros-base', ROS_REPO: ros, NOT_TEST_BUILD: true, DEBUG_BASH: true, VERBOSE_OUTPUT: false, DOCKER_COMMIT: img_temp, POST_PROCESS: 'eval docker image inspect $DOCKER_COMMIT --format="$DOCKER_COMMIT:\ \"{{.Size}}\" bytes"'}
- {DOCKER_IMAGE: 'ros:kinetic-ros-base', ROS_REPO: ros, NOT_TEST_BUILD: true, DEBUG_BASH: true, VERBOSE_OUTPUT: false, DOCKER_COMMIT: img_temp, POST_PROCESS: 'eval docker image inspect $$DOCKER_COMMIT --format="$$DOCKER_COMMIT:\ \"{{.Size}}\" bytes"'}
- {ROS_DISTRO: lunar, ROS_REPO: 'ros-shadow-fixed', TARGET_WORKSPACE: 'industrial_ci/mockups/industrial_ci_testpkg'}
- {ROS_DISTRO: melodic, AFTER_SCRIPT: 'grep -q ID=ubuntu /etc/os-release && grep -q VERSION_CODENAME=bionic /etc/os-release'}
- {ROS_DISTRO: melodic, BEFORE_INIT: 'grep -q ID=debian /etc/os-release && grep -q VERSION_ID=\"9\" /etc/os-release', EXPECT_EXIT_CODE: 1}
- {ROS_DISTRO: melodic, OS_NAME: debian, OS_CODE_NAME: stretch, AFTER_SCRIPT: 'grep -q ID=debian /etc/os-release && grep -q VERSION_ID=\"9\" /etc/os-release'}
- {ROS_DISTRO: melodic, OS_NAME: debian, EXPECT_EXIT_CODE: 1}
- {ROS_DISTRO: melodic, OS_NAME: debian, OS_CODE_NAME: bionic, EXPECT_EXIT_CODE: 1}
- {ROS_DISTRO: melodic, ROS_REPO: ros, BUILDER: colcon, AFTER_SCRIPT: 'rosenv && [ "$CMAKE_PREFIX_PATH" = "/root/target_ws/install/industrial_ci:/opt/ros/melodic" ]'}
- {ROS_DISTRO: melodic, ROS_REPO: ros, BUILDER: colcon, AFTER_SCRIPT: 'rosenv && [ "$$CMAKE_PREFIX_PATH" = "/root/target_ws/install/industrial_ci:/opt/ros/melodic" ]'}
- {ROS_DISTRO: noetic, TARGET_WORKSPACE: 'industrial_ci/mockups/industrial_ci_testpkg'}
- {ROS_DISTRO: noetic, PRERELEASE: true}
- {ROS_DISTRO: foxy}
Expand All @@ -76,8 +76,8 @@ jobs:
steps:
- uses: actions/checkout@v1
- uses: './'
env: ${{matrix.env}}

with:
matrix: ${{toJSON(matrix)}}
abicheck:
strategy:
matrix:
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: 'ROS industrial_ci'
inputs:
matrix:
description: 'Matrix'
required: false
runs:
using: "composite"
steps:
- run: ${{ github.action_path }}/.github/action.sh
shell: bash
env:
INPUT_MATRIX: ${{ inputs.matrix }}
8 changes: 4 additions & 4 deletions doc/industrial_ci_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ jobs:
industrial_ci:
strategy:
matrix:
env:
- {ROS_DISTRO: melodic, ROS_REPO: testing}
- {ROS_DISTRO: melodic, ROS_REPO: main}
ROS_DISTRO: [melodic]
ROS_REPO: [testing, main]
env:
CCACHE_DIR: /github/home/.ccache # Directory for ccache (and how we enable ccache in industrial_ci)
runs-on: ubuntu-latest
Expand All @@ -34,4 +33,5 @@ jobs:
key: ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}
# Run industrial_ci
- uses: 'ros-industrial/industrial_ci@master'
env: ${{ matrix.env }}
with:
matrix: ${{toJSON(matrix)}}

0 comments on commit d43245f

Please sign in to comment.