|
| 1 | +name: Find the target monitors to build for an application and framework |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + app: |
| 7 | + description: "The target application to build" |
| 8 | + type: string |
| 9 | + required: true |
| 10 | + framework: |
| 11 | + description: "The target framework to build against" |
| 12 | + type: string |
| 13 | + required: true |
| 14 | + frameworks_json: |
| 15 | + description: "The JSON object with all changed files for app and framework" |
| 16 | + type: string |
| 17 | + required: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + get-monitors: |
| 21 | + runs-on: ubuntu-22.04 |
| 22 | + outputs: |
| 23 | + monitors: ${{ steps.filter.outputs.monitors }} |
| 24 | + monitors_json: ${{ steps.filter.outputs.monitors_json }} |
| 25 | + steps: |
| 26 | + - name: Show input |
| 27 | + run: | |
| 28 | + echo "Input app: ${{ inputs.app }}" |
| 29 | + echo "Input framework: ${{ inputs.framework }}" |
| 30 | + echo "Input json: ${{ inputs.frameworks_json }}" |
| 31 | +
|
| 32 | + - name: Get monitors to build against |
| 33 | + id: filter |
| 34 | + run: | |
| 35 | + FRAMEWORK=${{ inputs.framework }} |
| 36 | + MONITORS_JSON=$(echo '${{ inputs.frameworks_json }}' | \ |
| 37 | + jq -c --arg framework "$FRAMEWORK" '.[$framework]' |
| 38 | + ) |
| 39 | + MONITORS=$(echo '${{ inputs.frameworks_json }}' | \ |
| 40 | + jq -c --arg framework "$FRAMEWORK" '.[$framework] | keys' |
| 41 | + ) |
| 42 | + echo "monitors=$MONITORS" >> "$GITHUB_OUTPUT" |
| 43 | + echo "monitors_json=$MONITORS_JSON" >> "$GITHUB_OUTPUT" |
| 44 | +
|
| 45 | + - name: Show changed files |
| 46 | + run: | |
| 47 | + echo "Build for monitors: ${{ steps.filter.outputs.monitors }}" |
| 48 | + echo "MOnitors json: ${{ steps.filter.outputs.monitors_json }}" |
| 49 | +
|
| 50 | + for-each-monitor: |
| 51 | + name: Build changed apps |
| 52 | + needs: get-monitors |
| 53 | + strategy: |
| 54 | + fail-fast: false |
| 55 | + matrix: |
| 56 | + monitor: ${{ fromJSON(needs.get-monitors.outputs.monitors) }} |
| 57 | + uses: ./.github/workflows/build_and_manifest.yml |
| 58 | + with: |
| 59 | + monitor: ${{ matrix.monitor }} |
0 commit comments