|
| 1 | +# ******************************************************************************* |
| 2 | +# Copyright (c) 2026 Contributors to the Eclipse Foundation |
| 3 | +# |
| 4 | +# See the NOTICE file(s) distributed with this work for additional |
| 5 | +# information regarding copyright ownership. |
| 6 | +# |
| 7 | +# This program and the accompanying materials are made available under the |
| 8 | +# terms of the Apache License Version 2.0 which is available at |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# SPDX-License-Identifier: Apache-2.0 |
| 12 | +# ******************************************************************************* |
| 13 | +name: Bazel Build (QNX) |
| 14 | +on: |
| 15 | + pull_request: |
| 16 | + types: [opened, reopened, synchronize] |
| 17 | + push: |
| 18 | + branches: |
| 19 | + - main |
| 20 | + merge_group: |
| 21 | + types: [checks_requested] |
| 22 | + workflow_call: |
| 23 | +jobs: |
| 24 | + qnx-build: |
| 25 | + name: Build and Test ${{ matrix.bazel-config }} |
| 26 | + runs-on: ${{ vars.runner_labels_ghub_standard_x64 && fromJSON(vars.runner_labels_ghub_standard_x64) || vars.REPO_RUNNER_LABELS && fromJSON(vars.REPO_RUNNER_LABELS) || 'ubuntu-latest' }} |
| 27 | + permissions: |
| 28 | + contents: read |
| 29 | + pull-requests: read |
| 30 | + # Bazel test targets live in the separate `tests` module, so run all Bazel |
| 31 | + # commands from that directory. `defaults.run.working-directory` applies to |
| 32 | + # `run:` steps only; `uses:` action steps still execute from the repo root. |
| 33 | + defaults: |
| 34 | + run: |
| 35 | + working-directory: ./tests |
| 36 | + strategy: |
| 37 | + fail-fast: false |
| 38 | + matrix: |
| 39 | + include: |
| 40 | + - bazel-config: x86_64-qnx |
| 41 | + bazel-test-target: "//:all_tests" |
| 42 | + - bazel-config: aarch64-qnx |
| 43 | + bazel-test-target: "//:all_tests" |
| 44 | + extra-bazel-test-flags: "--test_timeout=120,600,1800,7200" # Increase test timeout due to QEMU emulation |
| 45 | + steps: |
| 46 | + - uses: eclipse-score/more-disk-space@6a3b48901846bf7f8cc985925157d71a8973e61f # v1 |
| 47 | + with: |
| 48 | + level: 2 |
| 49 | + - name: Checkout repository (Handle all events) |
| 50 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 |
| 51 | + with: |
| 52 | + ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }} |
| 53 | + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} |
| 54 | + - name: Setup Bazel with shared caching |
| 55 | + uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 #v0.19.0 |
| 56 | + with: |
| 57 | + disk-cache: ${{ matrix.bazel-config }} |
| 58 | + repository-cache: true |
| 59 | + bazelisk-cache: true |
| 60 | + cache-save: ${{ github.event_name == 'push' }} |
| 61 | + - uses: eclipse-score/cicd-actions/unblock-user-namespace-for-linux-sandbox@30ed908edcf367bc38ebff5b386a244f9b6417a7 # 2025-06-04 |
| 62 | + - name: Setup QNX SDP usage |
| 63 | + uses: eclipse-score/cicd-actions/setup-qnx-sdp@a2b3c36fc7d1b9d03880d19935c7ac9cfffe58c6 # 2026-05-19 |
| 64 | + with: |
| 65 | + qnx-license: ${{ secrets.SCORE_QNX_LICENSE }} |
| 66 | + qnx-user: ${{ secrets.SCORE_QNX_USER }} |
| 67 | + qnx-password: ${{ secrets.SCORE_QNX_PASSWORD }} |
| 68 | + qnx-credential-helper: .github/tools/qnx_credential_helper.py |
| 69 | + qnx-license-dir: /opt/score_qnx/license |
| 70 | + - name: Build with QNX toolchain |
| 71 | + run: | |
| 72 | + set -euo pipefail |
| 73 | +
|
| 74 | + bazel build --config ${{ matrix.bazel-config }} \ |
| 75 | + --credential_helper=*.qnx.com="${QNX_CREDENTIAL_HELPER}" -- \ |
| 76 | + //:all_tests |
| 77 | + - name: Install qemu |
| 78 | + run: | |
| 79 | + sudo apt-get update |
| 80 | + sudo apt-get install -y qemu-system |
| 81 | + - name: Enable KVM group permissions |
| 82 | + run: | |
| 83 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0660", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 84 | + sudo udevadm control --reload-rules |
| 85 | + sudo udevadm trigger --name-match=kvm |
| 86 | + sudo chown "$USER":kvm /dev/kvm && sudo chmod 0660 /dev/kvm |
| 87 | + - name: Test with QNX toolchain |
| 88 | + run: | |
| 89 | + set -euo pipefail |
| 90 | +
|
| 91 | + bazel test --config ${{ matrix.bazel-config }} \ |
| 92 | + --test_output=errors \ |
| 93 | + --credential_helper=*.qnx.com="${QNX_CREDENTIAL_HELPER}" ${{ matrix.extra-bazel-test-flags }} -- \ |
| 94 | + ${{ matrix.bazel-test-target }} |
| 95 | + - name: Dump test logs on failure |
| 96 | + if: failure() |
| 97 | + run: | |
| 98 | + echo "===== Bazel test logs =====" |
| 99 | + # `bazel-testlogs` is a convenience symlink in the workspace root (./tests). |
| 100 | + find -L bazel-testlogs -name 'test.log' -print | while read -r log; do |
| 101 | + echo "" |
| 102 | + echo "----- ${log} -----" |
| 103 | + cat "${log}" |
| 104 | + done |
0 commit comments