|
| 1 | +name: Test Action |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + test-all-packages: |
| 14 | + runs-on: ubuntu-${{ matrix.ubuntu_version }} |
| 15 | + |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - ros_distro: rolling |
| 21 | + debian_distro: noble |
| 22 | + ubuntu_version: '24.04' |
| 23 | + packages_dir: test |
| 24 | + |
| 25 | + - ros_distro: kilted |
| 26 | + debian_distro: noble |
| 27 | + ubuntu_version: '24.04' |
| 28 | + packages_dir: test |
| 29 | + |
| 30 | + - ros_distro: jazzy |
| 31 | + debian_distro: noble |
| 32 | + ubuntu_version: '24.04' |
| 33 | + packages_dir: test |
| 34 | + |
| 35 | + - ros_distro: humble |
| 36 | + debian_distro: jammy |
| 37 | + ubuntu_version: '22.04' |
| 38 | + packages_dir: test |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Checkout Repository |
| 42 | + uses: actions/checkout@v4 |
| 43 | + |
| 44 | + - name: Test ${{ matrix.ros_distro }} - All packages |
| 45 | + uses: ./ |
| 46 | + with: |
| 47 | + ros_distro: ${{ matrix.ros_distro }} |
| 48 | + debian_distro: ${{ matrix.debian_distro }} |
| 49 | + packages_dir: ${{ matrix.packages_dir }} |
| 50 | + |
| 51 | + test-whitelist: |
| 52 | + runs-on: ubuntu-22.04 |
| 53 | + steps: |
| 54 | + - name: Checkout Repository |
| 55 | + uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Test whitelist - Only package_a and package_b |
| 58 | + uses: ./ |
| 59 | + with: |
| 60 | + ros_distro: humble |
| 61 | + debian_distro: jammy |
| 62 | + packages_dir: test |
| 63 | + package_whitelist: '^.*/package_[ab]$' |
| 64 | + artifact_name: bloom-test-whitelist |
| 65 | + |
| 66 | + - name: Verify only package_a and package_b built |
| 67 | + shell: bash |
| 68 | + run: | |
| 69 | + echo "Checking generated packages..." |
| 70 | + ls -la ./bloom-build/output/ |
| 71 | +
|
| 72 | + # Should have package_a and package_b |
| 73 | + test -f ./bloom-build/output/ros-humble-package-a*.deb || (echo "Missing package_a" && exit 1) |
| 74 | + test -f ./bloom-build/output/ros-humble-package-b*.deb || (echo "Missing package_b" && exit 1) |
| 75 | +
|
| 76 | + # Should NOT have package_c, package_d, or package_test |
| 77 | + ! ls ./bloom-build/output/ros-humble-package-c*.deb 2>/dev/null && echo "✓ No package_c (correct)" |
| 78 | + ! ls ./bloom-build/output/ros-humble-package-d*.deb 2>/dev/null && echo "✓ No package_d (correct)" |
| 79 | + ! ls ./bloom-build/output/ros-humble-package-test*.deb 2>/dev/null && echo "✓ No package_test (correct)" |
| 80 | +
|
| 81 | + test-blacklist: |
| 82 | + runs-on: ubuntu-22.04 |
| 83 | + steps: |
| 84 | + - name: Checkout Repository |
| 85 | + uses: actions/checkout@v4 |
| 86 | + |
| 87 | + - name: Test blacklist - Exclude *_test packages |
| 88 | + uses: ./ |
| 89 | + with: |
| 90 | + ros_distro: humble |
| 91 | + debian_distro: jammy |
| 92 | + packages_dir: test |
| 93 | + package_blacklist: '.*_test$' |
| 94 | + artifact_name: bloom-test-blacklist |
| 95 | + |
| 96 | + - name: Verify package_test was excluded |
| 97 | + shell: bash |
| 98 | + run: | |
| 99 | + echo "Checking generated packages..." |
| 100 | + ls -la ./bloom-build/output/ |
| 101 | +
|
| 102 | + # Should NOT have package_test |
| 103 | + ! ls ./bloom-build/output/ros-humble-package-test*.deb 2>/dev/null && echo "✓ package_test excluded (correct)" |
| 104 | +
|
| 105 | + # Should have other packages |
| 106 | + test -f ./bloom-build/output/ros-humble-package-a*.deb || (echo "Missing package_a" && exit 1) |
| 107 | + test -f ./bloom-build/output/ros-humble-package-c*.deb || (echo "Missing package_c" && exit 1) |
| 108 | +
|
| 109 | + test-whitelist-and-blacklist: |
| 110 | + runs-on: ubuntu-22.04 |
| 111 | + steps: |
| 112 | + - name: Checkout Repository |
| 113 | + uses: actions/checkout@v4 |
| 114 | + |
| 115 | + - name: Test combined whitelist and blacklist |
| 116 | + uses: ./ |
| 117 | + with: |
| 118 | + ros_distro: humble |
| 119 | + debian_distro: jammy |
| 120 | + packages_dir: test |
| 121 | + package_whitelist: '^.*/package_[abc]$' |
| 122 | + package_blacklist: '^.*/package_c$' |
| 123 | + artifact_name: bloom-test-whitelist-blacklist |
| 124 | + |
| 125 | + - name: Verify correct filtering |
| 126 | + shell: bash |
| 127 | + run: | |
| 128 | + echo "Checking generated packages..." |
| 129 | + ls -la ./bloom-build/output/ |
| 130 | +
|
| 131 | + # Should have package_a and package_b |
| 132 | + test -f ./bloom-build/output/ros-humble-package-a*.deb || (echo "Missing package_a" && exit 1) |
| 133 | + test -f ./bloom-build/output/ros-humble-package-b*.deb || (echo "Missing package_b" && exit 1) |
| 134 | +
|
| 135 | + # Should NOT have package_c, package_d, or package_test |
| 136 | + ! ls ./bloom-build/output/ros-humble-package-c*.deb 2>/dev/null && echo "✓ No package_c (correct)" |
| 137 | + ! ls ./bloom-build/output/ros-humble-package-d*.deb 2>/dev/null && echo "✓ No package_d (correct)" |
| 138 | + ! ls ./bloom-build/output/ros-humble-package-test*.deb 2>/dev/null && echo "✓ No package_test (correct)" |
0 commit comments