|
16 | 16 | default: "" |
17 | 17 |
|
18 | 18 | jobs: |
| 19 | + construct-matrix: |
| 20 | + name: Construct WebAssembly SDK matrix |
| 21 | + runs-on: ubuntu-latest |
| 22 | + outputs: |
| 23 | + wasm-sdk-matrix: '${{ steps.generate-matrix.outputs.wasm-sdk-matrix }}' |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + persist-credentials: false |
| 29 | + - id: generate-matrix |
| 30 | + run: | |
| 31 | + # Validate and use JSON environment variables directly |
| 32 | + env_vars_json='${{ inputs.env_vars }}' |
| 33 | +
|
| 34 | + # Validate JSON format |
| 35 | + if ! echo "$env_vars_json" | jq empty 2>/dev/null; then |
| 36 | + echo "Error: env_vars is not valid JSON" |
| 37 | + exit 1 |
| 38 | + fi |
| 39 | +
|
| 40 | + # Generate matrix with parsed environment variables |
| 41 | + cat >> "$GITHUB_OUTPUT" << EOM |
| 42 | + wasm-sdk-matrix=$(echo '{ |
| 43 | + "config":[ |
| 44 | + { |
| 45 | + "name":"main Jammy", |
| 46 | + "swift_version":"main", |
| 47 | + "platform":"Linux", |
| 48 | + "runner":"ubuntu-latest", |
| 49 | + "image":"ubuntu:jammy", |
| 50 | + "setup_command":"apt update -q && apt install -y -q curl jq tar && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_prerequisites.sh | bash && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_sdk.sh | INSTALL_SWIFT_BRANCH=main INSTALL_SWIFT_ARCH=x86_64 INSTALL_SWIFT_SDK=wasm-sdk bash && hash -r", |
| 51 | + "command":"curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/swift-build-with-wasm-sdk.sh | bash -s --", |
| 52 | + "command_arguments":"${{ inputs.additional_command_arguments }}", |
| 53 | + "env":'"$env_vars_json"' |
| 54 | + } |
| 55 | + ] |
| 56 | + }' | jq -c) |
| 57 | + EOM |
| 58 | +
|
19 | 59 | wasm-sdk: |
20 | | - name: WebAssembly Swift SDK |
| 60 | + name: WebAssembly SDK |
| 61 | + needs: construct-matrix |
21 | 62 | # Workaround https://github.com/nektos/act/issues/1875 |
22 | 63 | uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main |
23 | 64 | with: |
24 | | - name: "WebAssembly Swift SDK" |
25 | | - matrix_string: >- |
26 | | - { |
27 | | - "config":[ |
28 | | - { |
29 | | - "name":"main Jammy", |
30 | | - "swift_version":"main", |
31 | | - "platform":"Linux", |
32 | | - "runner":"ubuntu-latest", |
33 | | - "image":"ubuntu:jammy", |
34 | | - "setup_command":"apt update -q && apt install -y -q curl jq tar && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_prerequisites.sh | bash && curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_sdk.sh | INSTALL_SWIFT_BRANCH=main INSTALL_SWIFT_ARCH=x86_64 INSTALL_SWIFT_SDK=wasm-sdk bash && hash -r", |
35 | | - "command":"curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/swift-build-with-wasm-sdk.sh | bash -s --", |
36 | | - "command_arguments":"${{ inputs.additional_command_arguments }}", |
37 | | - "env":'"$env_vars_json"' |
38 | | - } |
39 | | - ] |
40 | | - } |
| 65 | + name: "WebAssembly SDK" |
| 66 | + matrix_string: '${{ needs.construct-matrix.outputs.wasm-sdk-matrix }}' |
0 commit comments