|
| 1 | +# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git). |
| 2 | +# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst) |
| 3 | + |
| 4 | +name: BuildAndTest |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + pull_request: |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + |
| 13 | +jobs: |
| 14 | + industrial_ci: |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + env: |
| 18 | + - { |
| 19 | + IMAGE: 'foxy-ci', |
| 20 | + CCOV: true, |
| 21 | + AFTER_RUN_TARGET_TEST: './.ci.prepare_codecov' |
| 22 | + } |
| 23 | + - { |
| 24 | + IMAGE: 'foxy-ci-testing', |
| 25 | + } |
| 26 | + env: |
| 27 | + DOCKER_IMAGE: moveit/moveit2:${{ matrix.env.IMAGE }} |
| 28 | + UPSTREAM_WORKSPACE: moveit2.repos |
| 29 | + CCOV: ${{ matrix.env.CCOV }} |
| 30 | + AFTER_SETUP_UPSTREAM_WORKSPACE: 'vcs pull $BASEDIR/upstream_ws/src' |
| 31 | + TARGET_CMAKE_ARGS: > |
| 32 | + -DCMAKE_BUILD_TYPE=${{ matrix.env.CCOV && 'RelWithDebInfo' || 'Release'}} |
| 33 | + ${{ matrix.env.CCOV && '-DCMAKE_CXX_FLAGS="--coverage" --no-warn-unused-cli' || '' }} |
| 34 | + CCACHE_DIR: "${{ github.workspace }}/.ccache" |
| 35 | + BASEDIR: ${{ github.workspace }}/.work |
| 36 | + CACHE_PREFIX: "${{ matrix.env.IMAGE }}${{ matrix.env.CCOV && '-ccov' || '' }}" |
| 37 | + |
| 38 | + name: "${{ matrix.env.IMAGE }}${{ matrix.env.CCOV && ' + ccov' || ''}}" |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - name: "Free up disk space" |
| 42 | + if: ${{ env.CCOV }} |
| 43 | + run: | |
| 44 | + sudo apt-get -qq purge build-essential ghc* |
| 45 | + sudo apt-get clean |
| 46 | + docker system prune -af |
| 47 | + sudo mkdir /mnt/ccache |
| 48 | + mkdir ${{ env.CCACHE_DIR }} |
| 49 | + sudo mount --bind ${{ env.CCACHE_DIR }} /mnt/ccache |
| 50 | + sudo rm -rf /usr/local/* |
| 51 | + df -h |
| 52 | + - uses: actions/checkout@v2 |
| 53 | + - name: cache upstream_ws |
| 54 | + |
| 55 | + with: |
| 56 | + path: ${{ env.BASEDIR }}/upstream_ws |
| 57 | + key: upstream_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('moveit2.repos') }}-${{ github.run_id }} |
| 58 | + restore-keys: | |
| 59 | + upstream_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('moveit2.repos') }} |
| 60 | + - name: cache target_ws |
| 61 | + if: ${{ ! env.CCOV }} |
| 62 | + |
| 63 | + with: |
| 64 | + path: ${{ env.BASEDIR }}/target_ws |
| 65 | + key: target_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/package.xml') }}-${{ github.run_id }} |
| 66 | + restore-keys: | |
| 67 | + target_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/package.xml') }} |
| 68 | + - name: cache ccache |
| 69 | + |
| 70 | + with: |
| 71 | + path: ${{ env.CCACHE_DIR }} |
| 72 | + key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }} |
| 73 | + restore-keys: | |
| 74 | + ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }} |
| 75 | + ccache-${{ env.CACHE_PREFIX }} |
| 76 | + - name: industrial_ci |
| 77 | + uses: 'ros-industrial/industrial_ci@master' |
| 78 | + env: ${{ matrix.env }} |
| 79 | + - name: upload test artifacts (on failure) |
| 80 | + uses: actions/upload-artifact@v2 |
| 81 | + if: failure() |
| 82 | + with: |
| 83 | + name: test-results |
| 84 | + path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml |
| 85 | + - name: upload codecov report |
| 86 | + uses: codecov/codecov-action@v1 |
| 87 | + if: ${{ env.CCOV }} |
| 88 | + with: |
| 89 | + files: ${{ env.BASEDIR }}/coverage.info |
| 90 | + - name: prepare target_ws for cache |
| 91 | + if: ${{ always() && ! env.CCOV }} |
| 92 | + run: |
| 93 | + du -sh ${{ env.BASEDIR }}/target_ws |
| 94 | + sudo find ${{ env.BASEDIR }}/target_ws -wholename '*/test_results/*' -delete |
| 95 | + sudo rm -rf ${{ env.BASEDIR }}/target_ws/src |
| 96 | + du -sh ${{ env.BASEDIR }}/target_ws |
0 commit comments