From eac05802fb12eb051d4fe6dde5ab85a1608cd8e9 Mon Sep 17 00:00:00 2001 From: Michael Ripperger Date: Thu, 9 Mar 2023 13:37:01 -0600 Subject: [PATCH] Consolidated regular Ubuntu jobs into single matrix job --- .github/workflows/bionic_build.yml | 103 ------------------ .../workflows/{focal_build.yml => ubuntu.yml} | 31 ++++-- 2 files changed, 19 insertions(+), 115 deletions(-) delete mode 100644 .github/workflows/bionic_build.yml rename .github/workflows/{focal_build.yml => ubuntu.yml} (79%) diff --git a/.github/workflows/bionic_build.yml b/.github/workflows/bionic_build.yml deleted file mode 100644 index 1c50442ad01..00000000000 --- a/.github/workflows/bionic_build.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Ubuntu Bionic - -on: - push: - branches: - - master - pull_request: - paths: - - 'tesseract**' - - '.github/workflows/bionic_build.yml' - - '**.repos' - schedule: - - cron: '0 5 * * *' - release: - types: - - released - -jobs: - industrial_ci: - name: Ubuntu Bionic - runs-on: ubuntu-latest - env: - CI_NAME: ubuntu-bionic - CCACHE_DIR: "${{ github.workspace }}/${{ matrix.env.CI_NAME}}/.ccache" - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - PUSH_DOCKER_IMAGE: ${{ github.ref == 'refs/heads/master' || github.event_name == 'release' }} - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Free disk space - continue-on-error: true - run: | - sudo swapoff -a - sudo rm -f /swapfile - sudo apt clean - docker rmi $(docker image ls -aq) - df -h - - - name: Prepare ccache timestamp - id: ccache_cache_timestamp - shell: cmake -P {0} - run: | - string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) - message("::set-output name=timestamp::${current_date}") - - - name: ccache cache files - continue-on-error: true - uses: actions/cache@v1.1.0 - with: - path: ${{ env.CI_NAME }}/.ccache - key: ${{ env.CI_NAME }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} - restore-keys: | - ${{ env.CI_NAME }}-ccache- - - - name: Login to Github container registry - uses: docker/login-action@v1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract Docker meta-information - id: meta - uses: docker/metadata-action@v3 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - flavor: | - latest=false - prefix= - suffix= - tags: | - type=ref,event=branch,prefix=${{ env.CI_NAME }}- - type=semver,pattern={{major}}.{{minor}},prefix=${{ env.CI_NAME }}- - - - name: Set build type - run: | - if [[ "${{ env.PUSH_DOCKER_IMAGE }}" = true ]] - then - echo "BUILD_TYPE=Release" >> $GITHUB_ENV - else - echo "BUILD_TYPE=Debug" >> $GITHUB_ENV - fi - - - name: Build repository - uses: 'marip8/industrial_ci@2f4c8ab919f0aafddd514e586325defabd2911ea' - env: - DOCKER_IMAGE: ubuntu:18.04 - ROS_DISTRO: false - ADDITIONAL_DEBS: 'curl lsb-release liboctomap-dev' - AFTER_INIT: './.github/workflows/add_ros_apt_sources.sh' - UPSTREAM_WORKSPACE: 'dependencies.repos' - ROSDEP_SKIP_KEYS: 'fcl opw_kinematics ros_industrial_cmake_boilerplate iwyu octomap catkin' - PREFIX: ${{ github.repository }}_ - UPSTREAM_CMAKE_ARGS: '-DCMAKE_BUILD_TYPE=Release' - TARGET_CMAKE_ARGS: "-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DTESSERACT_ENABLE_TESTING=ON -DTESSERACT_WARNINGS_AS_ERRORS=OFF" - BEFORE_RUN_TARGET_TEST_EMBED: "ici_with_unset_variables source $BASEDIR/${PREFIX}target_ws/install/setup.bash" - DOCKER_COMMIT: ${{ steps.meta.outputs.tags }} - - - name: Push post-build Docker - if: ${{ env.PUSH_DOCKER_IMAGE == 'true' }} - run: docker push ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/focal_build.yml b/.github/workflows/ubuntu.yml similarity index 79% rename from .github/workflows/focal_build.yml rename to .github/workflows/ubuntu.yml index 944a364d7fb..2a136f823c9 100644 --- a/.github/workflows/focal_build.yml +++ b/.github/workflows/ubuntu.yml @@ -1,4 +1,4 @@ -name: Ubuntu Focal +name: Ubuntu on: push: @@ -7,7 +7,7 @@ on: pull_request: paths: - 'tesseract**' - - '.github/workflows/focal_build.yml' + - '.github/workflows/ubuntu.yml' - '**.repos' schedule: - cron: '0 5 * * *' @@ -16,12 +16,19 @@ on: - released jobs: - industrial_ci: - name: Ubuntu Focal + ci: + name: Ubuntu runs-on: ubuntu-latest + strategy: + matrix: + distro: [bionic, focal] + include: + - distro: bionic + image: ubuntu:18.04 + - distro: focal + image: ubuntu:20.04 env: - CI_NAME: ubuntu-focal - CCACHE_DIR: "${{ github.workspace }}/${{ matrix.env.CI_NAME}}/.ccache" + CCACHE_DIR: "${{ github.workspace }}/${{ matrix.distro }}/.ccache" REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} PUSH_DOCKER_IMAGE: ${{ github.ref == 'refs/heads/master' || github.event_name == 'release' }} @@ -49,10 +56,10 @@ jobs: continue-on-error: true uses: actions/cache@v1.1.0 with: - path: ${{ env.CI_NAME }}/.ccache - key: ${{ env.CI_NAME }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + path: ${{ matrix.distro }}/.ccache + key: ${{ matrix.distro }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} restore-keys: | - ${{ env.CI_NAME }}-ccache- + ${{ matrix.distro }}-ccache- - name: Login to Github container registry uses: docker/login-action@v1 @@ -71,8 +78,8 @@ jobs: prefix= suffix= tags: | - type=ref,event=branch,prefix=${{ env.CI_NAME }}- - type=semver,pattern={{major}}.{{minor}},prefix=${{ env.CI_NAME }}- + type=ref,event=branch,prefix=${{ matrix.distro }}- + type=semver,pattern={{major}}.{{minor}},prefix=${{ matrix.distro }}- - name: Set build type run: | @@ -86,7 +93,7 @@ jobs: - name: Build repository uses: 'marip8/industrial_ci@2f4c8ab919f0aafddd514e586325defabd2911ea' env: - DOCKER_IMAGE: ubuntu:20.04 + DOCKER_IMAGE: ${{ matrix.image }} ROS_DISTRO: false ADDITIONAL_DEBS: 'curl lsb-release liboctomap-dev' AFTER_INIT: './.github/workflows/add_ros_apt_sources.sh'