Build Artifacts satyakigh push (c466c968bc1eb338ac9fe6dbd7d618f5bffb53a4) #87
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Artifacts | |
| run-name: Build Artifacts ${{ github.actor }} ${{ github.event_name }} (${{ github.sha }}) | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - 'src/bindings-jvm/generated/*.jar' | |
| - 'src/bindings-jvm/THIRD-PARTY-LICENSES.txt' | |
| - 'src/bindings-wasm/dist/*' | |
| - 'src/bindings-wasm/THIRD-PARTY-LICENSES.txt' | |
| - 'src/release/*' | |
| - 'src/THIRD-PARTY-LICENSES.txt' | |
| workflow_dispatch: | |
| concurrency: | |
| group: build-artifacts | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| get-configs: | |
| uses: ./.github/workflows/configs.yml | |
| generate-licenses: | |
| needs: [ get-configs ] | |
| runs-on: ubuntu-latest | |
| env: | |
| WORKING_DIR: ${{ needs.get-configs.outputs.working-dir }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.sha }} | |
| - name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }} | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ needs.get-configs.outputs.rust-toolchain }} | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: ${{ env.WORKING_DIR }} | |
| - name: Install cargo-about ${{ needs.get-configs.outputs.cargo-about-version }} | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-about@${{ needs.get-configs.outputs.cargo-about-version }} | |
| - name: Log tool versions | |
| uses: ./.github/actions/print-build-versions | |
| - name: Generate THIRD-PARTY-LICENSES | |
| run: python3 scripts/generate_licenses.py | |
| - name: Upload license files | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: third-party-licenses | |
| path: | | |
| ${{ env.WORKING_DIR }}/THIRD-PARTY-LICENSES.txt | |
| ${{ env.WORKING_DIR }}/bindings-jvm/THIRD-PARTY-LICENSES.txt | |
| ${{ env.WORKING_DIR }}/bindings-wasm/THIRD-PARTY-LICENSES.txt | |
| if-no-files-found: error | |
| retention-days: 1 | |
| build-jvm: | |
| needs: [ get-configs, generate-licenses ] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { os: ubuntu-latest, platform: linux, arch: x64 } | |
| - { os: macos-latest, platform: darwin, arch: aarch64 } | |
| - { os: windows-latest, platform: win32, arch: x64 } | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| WORKING_DIR: ${{ needs.get-configs.outputs.working-dir }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.sha }} | |
| - name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }} | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ needs.get-configs.outputs.rust-toolchain }} | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: ${{ env.WORKING_DIR }} | |
| - name: Setup JVM toolchain | |
| uses: ./.github/actions/setup-jvm-toolchain | |
| with: | |
| java-version: ${{ needs.get-configs.outputs.java-version }} | |
| java-distribution: ${{ matrix.java-distribution || needs.get-configs.outputs.java-distribution }} | |
| kotlin-version: ${{ needs.get-configs.outputs.kotlin-version }} | |
| ktlint-version: ${{ needs.get-configs.outputs.ktlint-version }} | |
| gradle-version: ${{ needs.get-configs.outputs.gradle-version }} | |
| - name: Log tool versions | |
| uses: ./.github/actions/print-build-versions | |
| - name: Download THIRD-PARTY-LICENSES.txt | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: third-party-licenses | |
| path: ${{ env.WORKING_DIR }} | |
| - name: Build JVM bindings | |
| working-directory: ${{ env.WORKING_DIR }}/bindings-jvm | |
| run: ./build.sh | |
| - name: Inject THIRD-PARTY-LICENSES.txt into JVM jar | |
| working-directory: ${{ env.WORKING_DIR }}/bindings-jvm | |
| run: | | |
| set -euo pipefail | |
| JAR_ABS="$(pwd)/generated/cloudformation-validate.jar" | |
| LIC_ABS="$(pwd)/THIRD-PARTY-LICENSES.txt" | |
| tmpdir="$(mktemp -d)" | |
| mkdir -p "$tmpdir/META-INF" | |
| cp "$LIC_ABS" "$tmpdir/META-INF/THIRD-PARTY-LICENSES.txt" | |
| ( cd "$tmpdir" && jar uf "$JAR_ABS" META-INF/THIRD-PARTY-LICENSES.txt ) | |
| rm -rf "$tmpdir" | |
| unzip -l "$JAR_ABS" | grep -E 'META-INF/(LICENSE|THIRD-PARTY-LICENSES.txt)$' | |
| - name: Upload JVM jar | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: jvm-${{ matrix.platform }}-${{ matrix.arch }} | |
| path: ${{ env.WORKING_DIR }}/bindings-jvm/generated/cloudformation-validate.jar | |
| if-no-files-found: error | |
| retention-days: 1 | |
| build-wasm: | |
| needs: [ get-configs, generate-licenses ] | |
| runs-on: ubuntu-latest | |
| env: | |
| WORKING_DIR: ${{ needs.get-configs.outputs.working-dir }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.sha }} | |
| - name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }} | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ needs.get-configs.outputs.rust-toolchain }} | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: ${{ env.WORKING_DIR }} | |
| - name: Setup Node.js ${{ needs.get-configs.outputs.node-version }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ needs.get-configs.outputs.node-version }} | |
| - name: Install wasm-pack ${{ needs.get-configs.outputs.wasm-pack-version }} | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: wasm-pack@${{ needs.get-configs.outputs.wasm-pack-version }} | |
| - name: Log tool versions | |
| uses: ./.github/actions/print-build-versions | |
| - name: Download THIRD-PARTY-LICENSES.txt | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: third-party-licenses | |
| path: ${{ env.WORKING_DIR }} | |
| - name: Build WASM bindings | |
| working-directory: ${{ env.WORKING_DIR }}/bindings-wasm | |
| run: ./build.sh | |
| - name: Inject THIRD-PARTY-LICENSES.txt into WASM dist | |
| working-directory: ${{ env.WORKING_DIR }}/bindings-wasm | |
| run: | | |
| set -euo pipefail | |
| cp THIRD-PARTY-LICENSES.txt dist/THIRD-PARTY-LICENSES.txt | |
| ls -la dist/ | |
| - name: Upload WASM dist | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wasm-dist | |
| path: ${{ env.WORKING_DIR }}/bindings-wasm/dist | |
| if-no-files-found: error | |
| retention-days: 1 | |
| build-cli: | |
| needs: [ get-configs, generate-licenses ] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { os: ubuntu-latest, platform: linux, arch: x64 } | |
| - { os: macos-latest, platform: darwin, arch: aarch64 } | |
| - { os: windows-latest, platform: win32, arch: x64 } | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| WORKING_DIR: ${{ needs.get-configs.outputs.working-dir }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.sha }} | |
| - name: Install Rust ${{ needs.get-configs.outputs.rust-toolchain }} | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ needs.get-configs.outputs.rust-toolchain }} | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: ${{ env.WORKING_DIR }} | |
| - name: Log tool versions | |
| uses: ./.github/actions/print-build-versions | |
| - name: Build cfn-validate | |
| working-directory: ${{ env.WORKING_DIR }}/cfn-validate | |
| run: ./build.sh | |
| - name: Upload cfn-validate binary | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: cfn-validate-${{ matrix.platform }}-${{ matrix.arch }} | |
| path: ${{ env.WORKING_DIR }}/release/cfn-validate-${{ matrix.platform }}-${{ matrix.arch }}* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| pull-request: | |
| needs: [ get-configs, generate-licenses, build-jvm, build-wasm, build-cli ] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| WORKING_DIR: ${{ needs.get-configs.outputs.working-dir }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.sha }} | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: incoming | |
| - name: Stage artifacts | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| set -euo pipefail | |
| rm -rf bindings-jvm/generated bindings-wasm/dist release | |
| mkdir -p bindings-jvm/generated bindings-wasm/dist release | |
| shopt -s nullglob | |
| jars=("$GITHUB_WORKSPACE"/incoming/jvm-*/cloudformation-validate.jar) | |
| if [ ${#jars[@]} -eq 0 ]; then | |
| echo "::error::No JVM jars found under incoming/jvm-*/" | |
| exit 1 | |
| fi | |
| base="" | |
| for jar in "${jars[@]}"; do | |
| case "$jar" in *jvm-linux-x64*) base="$jar" ;; esac | |
| done | |
| if [ -z "$base" ]; then | |
| echo "::error::No Linux JVM jar (jvm-linux-x64) found under incoming/jvm-*/; refusing to fall back to a non-Linux base" | |
| exit 1 | |
| fi | |
| rest=() | |
| for jar in "${jars[@]}"; do | |
| [ "$jar" = "$base" ] || rest+=("$jar") | |
| done | |
| bindings-jvm/merge-jars.sh \ | |
| bindings-jvm/generated/cloudformation-validate.jar \ | |
| "$base" "${rest[@]}" | |
| cp -R "$GITHUB_WORKSPACE/incoming/wasm-dist/." bindings-wasm/dist/ | |
| echo "Staged WASM dist:"; ls -1 bindings-wasm/dist | |
| for d in "$GITHUB_WORKSPACE"/incoming/cfn-validate-*/; do | |
| cp -R "$d." release/ | |
| done | |
| echo "Staged cfn-validate binaries:"; ls -1 release || true | |
| cp "$GITHUB_WORKSPACE/incoming/third-party-licenses/THIRD-PARTY-LICENSES.txt" THIRD-PARTY-LICENSES.txt | |
| cp "$GITHUB_WORKSPACE/incoming/third-party-licenses/bindings-jvm/THIRD-PARTY-LICENSES.txt" bindings-jvm/THIRD-PARTY-LICENSES.txt | |
| cp "$GITHUB_WORKSPACE/incoming/third-party-licenses/bindings-wasm/THIRD-PARTY-LICENSES.txt" bindings-wasm/THIRD-PARTY-LICENSES.txt | |
| echo "Staged THIRD-PARTY-LICENSES.txt files." | |
| echo "Merged JVM jar:"; ls -1 bindings-jvm/generated | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| commit-message: 'chore: Update bindings' | |
| branch: automated/build-artifacts | |
| delete-branch: true | |
| title: 'chore: Update Bindings' | |
| base: main | |
| body: | | |
| Automated update of the binding bundles and CLI binaries. | |
| * **JVM** — a single multi-platform `cloudformation-validate.jar` in | |
| `${{ env.WORKING_DIR }}/bindings-jvm/generated/`, carrying the shared | |
| Kotlin classes/sources plus every platform's native library. Each | |
| platform is built by `bindings-jvm/build.sh` and the per-platform | |
| natives are combined via `bindings-jvm/merge-jars.sh`. | |
| * **WASM** — `${{ env.WORKING_DIR }}/bindings-wasm/dist/`, built via | |
| `bindings-wasm/build.sh`. | |
| * **cfn-validate CLI** — per-platform binaries in | |
| `${{ env.WORKING_DIR }}/release/`, built via `cfn-validate/build.sh`. | |
| * **Third-party licenses** — `THIRD-PARTY-LICENSES.txt` files | |
| regenerated by the workflow via `scripts/generate_licenses.py`. | |
| labels: automated, build-artifacts | |
| add-paths: | | |
| ${{ env.WORKING_DIR }}/bindings-jvm/generated/** | |
| ${{ env.WORKING_DIR }}/bindings-jvm/THIRD-PARTY-LICENSES.txt | |
| ${{ env.WORKING_DIR }}/bindings-wasm/dist/** | |
| ${{ env.WORKING_DIR }}/bindings-wasm/THIRD-PARTY-LICENSES.txt | |
| ${{ env.WORKING_DIR }}/release/** | |
| ${{ env.WORKING_DIR }}/THIRD-PARTY-LICENSES.txt |