Skip to content

Commit ecfdb97

Browse files
committed
add generic bazel toolchain job
Signed-off-by: Leonardo Rossetti <lrossett@redhat.com>
1 parent 97ae51f commit ecfdb97

1 file changed

Lines changed: 87 additions & 0 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
14+
name: S-CORE Toolchain Test
15+
16+
on:
17+
workflow_call:
18+
inputs:
19+
bazel-action:
20+
description: "Bazel action to run (build, test, etc)"
21+
required: false
22+
default: "test"
23+
type: string
24+
bazel-target:
25+
description: "Bazel target to build or test"
26+
required: false
27+
default: "//..."
28+
type: string
29+
bazel-config:
30+
description: "Bazel configuration to use for a given toolchain or platform"
31+
required: true
32+
type: string
33+
bazel-disk-cache:
34+
description: "Enable Bazel disk cache on GitHub. The value can be a string to use as cache key for separating workflows"
35+
required: false
36+
default: "true"
37+
type: string
38+
extra-bazel-flags:
39+
description: "Additional Bazel flags to pass to the build command (whitespace separated)"
40+
required: false
41+
default: ""
42+
type: string
43+
44+
jobs:
45+
build:
46+
name: Build Target
47+
runs-on: ${{ vars.REPO_RUNNER_LABELS && fromJSON(vars.REPO_RUNNER_LABELS) || 'ubuntu-latest' }}
48+
permissions:
49+
contents: read
50+
pull-requests: read
51+
52+
steps:
53+
- name: Checkout Repository (Handle all events)
54+
uses: actions/checkout@v4.2.2
55+
with:
56+
ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }}
57+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
58+
59+
- name: Setup Bazel (Shared Caching)
60+
uses: bazel-contrib/setup-bazel@0.18.0
61+
with:
62+
disk-cache: ${{ inputs.bazel-disk-cache }}
63+
repository-cache: true
64+
bazelisk-cache: true
65+
cache-save: ${{ github.event_name == 'push' }}
66+
67+
- name: Install QEMU
68+
if: inputs.bazel-target != ''
69+
run: |
70+
sudo apt-get update
71+
sudo apt-get install -y qemu-system
72+
73+
- name: Enable KVM Group Permissons
74+
if: inputs.bazel-target != ''
75+
run: |
76+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
77+
sudo udevadm control --reload-rules
78+
sudo udevadm trigger --name-match=kvm
79+
80+
- name: Run Bazel Action
81+
if: inputs.bazel-target != ''
82+
run: |
83+
set -euo pipefail
84+
85+
bazel ${{ inputs.bazel-action }} \
86+
--config ${{ inputs.bazel-config }} \
87+
${{ inputs.extra-bazel-flags }} -- ${{ inputs.bazel-target }}

0 commit comments

Comments
 (0)