|
| 1 | +name: "Test aws-robomaker-github-actions-ros-2" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + - 'releases/*' |
| 9 | + |
| 10 | +defaults: |
| 11 | + run: |
| 12 | + shell: bash |
| 13 | + |
| 14 | +jobs: |
| 15 | + test_robomaker-sample-app-ci-ros2: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + distro: ['foxy'] |
| 21 | + gazebo: [11] |
| 22 | + include: |
| 23 | + - distro: foxy |
| 24 | + gazebo: 11 |
| 25 | + ubuntu_distro: focal |
| 26 | + |
| 27 | + container: |
| 28 | + image: rostooling/setup-ros-docker:ubuntu-${{ matrix.ubuntu_distro }}-ros-${{ matrix.distro }}-ros-base-latest |
| 29 | + |
| 30 | + # NOTES: We run 2 tests for robot_ws and simulation_ws |
| 31 | + # The test steps are duplicated because github workflow does not support reusable step (with parameter yet) |
| 32 | + # We also can use matrix to run tests with different parameters but it is overkill for this |
| 33 | + steps: |
| 34 | + - name: Setup permissions |
| 35 | + run: | |
| 36 | + # Due to user permisson issue, calling chown is necessary for now |
| 37 | + # Related issue: https://github.com/actions/checkout/issues/47 |
| 38 | + # Note: rosbuild is the user of the docker image |
| 39 | + # TODO(ros-tooling/setup-ros-docker#7): |
| 40 | + sudo chown -R rosbuild:rosbuild "$HOME" . |
| 41 | + # Checkout SA ros2 branch into default root folder |
| 42 | + - name: Checkout hello world sample app |
| 43 | + uses: actions/checkout@v2 |
| 44 | + with: |
| 45 | + repository: aws-robotics/aws-robomaker-sample-application-helloworld |
| 46 | + ref: ros2_foxy |
| 47 | + # Checkout action code into action folder |
| 48 | + - name: Checkout action code |
| 49 | + uses: actions/checkout@v2 |
| 50 | + with: |
| 51 | + path: action |
| 52 | + - name: Setup nodeJS |
| 53 | + |
| 54 | + with: |
| 55 | + node-version: '12.x' |
| 56 | + - name: Install nodeJS packages |
| 57 | + run: npm install |
| 58 | + working-directory: ./action/robomaker-sample-app-ci |
| 59 | + - name: Build test script |
| 60 | + run: npm run build |
| 61 | + working-directory: ./action/robomaker-sample-app-ci |
| 62 | + |
| 63 | + # Trigger to run robomaker-sample-app-ci action script |
| 64 | + - name: Build and bundle robot_ws |
| 65 | + uses: ./action/robomaker-sample-app-ci |
| 66 | + with: |
| 67 | + ros-distro: ${{ matrix.distro }} |
| 68 | + gazebo-version: ${{ matrix.gazebo }} |
| 69 | + workspace-dir: ./robot_ws |
| 70 | + generate-sources: true |
| 71 | + # Expectation: bundle file, build files, and dependencies all exist |
| 72 | + - name: Check robot_ws file existence |
| 73 | + id: check_robot_ws_files |
| 74 | + uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673 |
| 75 | + with: |
| 76 | + files: "./robot_ws.tar, ./robot_ws/build, ./robot_ws/install, ./robot_ws/src/deps" |
| 77 | + allow_failure: true |
| 78 | + |
| 79 | + # Trigger to run robomaker-sample-app-ci action script |
| 80 | + - name: Build and bundle simulation_ws |
| 81 | + uses: ./action/robomaker-sample-app-ci |
| 82 | + with: |
| 83 | + ros-distro: ${{ matrix.distro }} |
| 84 | + gazebo-version: ${{ matrix.gazebo }} |
| 85 | + workspace-dir: ./simulation_ws |
| 86 | + generate-sources: false |
| 87 | + # Expectation: bundle file, build files, and dependencies all exist |
| 88 | + - name: Check simulation_ws file existence |
| 89 | + id: check_simulation_ws_files |
| 90 | + uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673 |
| 91 | + with: |
| 92 | + files: "./simulation_ws.tar, ./simulation_ws/build, ./simulation_ws/install, ./simulation_ws/src/deps" |
| 93 | + allow_failure: true |
| 94 | + |
| 95 | + # Expectation: source files exist |
| 96 | + - name: Check source file existence |
| 97 | + id: check_source_files |
| 98 | + uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673 |
| 99 | + with: |
| 100 | + files: "./sources.zip, ./sources.tar.gz" |
| 101 | + |
| 102 | + - name: Check all files exists |
| 103 | + if: steps.check_robot_ws_files.outputs.files_exists == 'true' && steps.check_simulation_ws_files.outputs.files_exists == 'true' && steps.check_source_files.outputs.files_exists == 'true' |
| 104 | + # Only runs if all of the files exists |
| 105 | + run: echo All files exists! |
0 commit comments