Skip to content

Commit fd48851

Browse files
committed
Temp commit 1
1 parent 0215ecf commit fd48851

5 files changed

Lines changed: 218 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env python3
2+
3+
# *******************************************************************************
4+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
5+
#
6+
# See the NOTICE file(s) distributed with this work for additional
7+
# information regarding copyright ownership.
8+
#
9+
# This program and the accompanying materials are made available under the
10+
# terms of the Apache License Version 2.0 which is available at
11+
# https://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# SPDX-License-Identifier: Apache-2.0
14+
# *******************************************************************************
15+
16+
import http.cookiejar
17+
import json
18+
import netrc
19+
import os
20+
import sys
21+
import urllib.parse
22+
import urllib.request
23+
24+
25+
def eprint(*args, **kwargs):
26+
print(*args, file=sys.stderr, **kwargs)
27+
28+
29+
if __name__ == "__main__":
30+
data = json.load(sys.stdin)
31+
32+
if "qnx.com" not in data["uri"]:
33+
eprint("Unsupported domain")
34+
sys.exit(1)
35+
36+
if "SCORE_QNX_USER" in os.environ and "SCORE_QNX_PASSWORD" in os.environ:
37+
login = os.environ["SCORE_QNX_USER"]
38+
password = os.environ["SCORE_QNX_PASSWORD"]
39+
else:
40+
try:
41+
nrc = netrc.netrc()
42+
auth = nrc.authenticators("qnx.com")
43+
if auth:
44+
login, _, password = auth
45+
else:
46+
raise Exception("No credential found for QNX")
47+
except Exception as excp:
48+
eprint(excp)
49+
eprint("Failed getting credentials from .netrc")
50+
sys.exit(1)
51+
52+
data = urllib.parse.urlencode(
53+
{"userlogin": login, "password": password, "UseCookie": "1"}
54+
)
55+
data = data.encode("ascii")
56+
57+
cookie_jar = http.cookiejar.CookieJar()
58+
cookie_processor = urllib.request.HTTPCookieProcessor(cookie_jar)
59+
opener = urllib.request.build_opener(cookie_processor)
60+
urllib.request.install_opener(opener)
61+
62+
r = urllib.request.urlopen("https://www.qnx.com/account/login.html", data)
63+
if r.status != 200:
64+
eprint("Failed to login to QNX")
65+
sys.exit(1)
66+
67+
cookies = {c.name: c.value for c in list(cookie_jar)}
68+
if not "myQNX" in cookies:
69+
eprint("Failed to get myQNX cookie from login page")
70+
sys.exit(1)
71+
72+
myQNX = cookies["myQNX"]
73+
print(
74+
json.dumps(
75+
{
76+
"headers": {
77+
"Cookie": [f"myQNX={myQNX}"],
78+
}
79+
}
80+
)
81+
)

‎.github/workflows/qnx.yml‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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+
50+
- name: Checkout repository (Handle all events)
51+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
52+
with:
53+
ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }}
54+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
55+
56+
- name: Setup Bazel with shared caching
57+
uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 #v0.19.0
58+
with:
59+
disk-cache: ${{ matrix.bazel-config }}
60+
repository-cache: true
61+
bazelisk-cache: true
62+
cache-save: ${{ github.event_name == 'push' }}
63+
64+
- uses: eclipse-score/cicd-actions/unblock-user-namespace-for-linux-sandbox@30ed908edcf367bc38ebff5b386a244f9b6417a7 # 2025-06-04
65+
66+
- name: Setup QNX SDP usage
67+
uses: eclipse-score/cicd-actions/setup-qnx-sdp@a2b3c36fc7d1b9d03880d19935c7ac9cfffe58c6 # 2026-05-19
68+
with:
69+
qnx-license: ${{ secrets.SCORE_QNX_LICENSE }}
70+
qnx-user: ${{ secrets.SCORE_QNX_USER }}
71+
qnx-password: ${{ secrets.SCORE_QNX_PASSWORD }}
72+
qnx-credential-helper: .github/tools/qnx_credential_helper.py
73+
qnx-license-dir: /opt/score_qnx/license
74+
75+
- name: Build with QNX toolchain
76+
run: |
77+
set -euo pipefail
78+
79+
bazel build --config ${{ matrix.bazel-config }} \
80+
--credential_helper=*.qnx.com="${QNX_CREDENTIAL_HELPER}" -- \
81+
//:all_tests
82+
83+
- name: Install qemu
84+
run: |
85+
sudo apt-get update
86+
sudo apt-get install -y qemu-system
87+
88+
- name: Enable KVM group permissons
89+
run: |
90+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
91+
sudo udevadm control --reload-rules
92+
sudo udevadm trigger --name-match=kvm
93+
94+
- name: Test with QNX toolchain
95+
run: |
96+
set -euo pipefail
97+
98+
bazel test --config ${{ matrix.bazel-config }} \
99+
--credential_helper=*.qnx.com="${QNX_CREDENTIAL_HELPER}" ${{ matrix.extra-bazel-test-flags }} -- \
100+
${{ matrix.bazel-test-target }}

‎templates/qnx/cc_toolchain_config.bzl.template‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,26 @@ def _impl(ctx):
642642
)
643643
supports_pic_feature = feature(name = "supports_pic", enabled = True)
644644

645+
pic_feature = feature(
646+
name = "pic",
647+
enabled = True,
648+
flag_sets = [
649+
flag_set(
650+
actions = [
651+
ACTION_NAMES.assemble,
652+
ACTION_NAMES.preprocess_assemble,
653+
ACTION_NAMES.c_compile,
654+
ACTION_NAMES.cpp_compile,
655+
ACTION_NAMES.cpp_module_codegen,
656+
ACTION_NAMES.cpp_module_compile,
657+
],
658+
flag_groups = [
659+
flag_group(flags = ["-fPIC"], expand_if_available = "pic"),
660+
],
661+
),
662+
],
663+
)
664+
645665
dependency_file_named_implicitly_feature = feature(
646666
name = "dependency_file_named_implicitly",
647667
enabled = False,
@@ -809,6 +829,7 @@ def _impl(ctx):
809829
sdp_env_feature,
810830
supports_dynamic_linker_feature,
811831
supports_pic_feature,
832+
pic_feature,
812833
runtime_library_search_directories_feature,
813834
coverage_feature,
814835
gcc_coverage_map_format_feature,

‎tests/BUILD‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,19 @@ test_suite(
6363
"//guardrails:no_legacy_features_guard_test",
6464
],
6565
)
66+
67+
# ============================================================================
68+
# Aggregate Test Suite
69+
#
70+
# Combines every test category into a single target. CI should depend on this
71+
# target so new tests only need to be added to the relevant suite above.
72+
# ============================================================================
73+
74+
test_suite(
75+
name = "all_tests",
76+
tests = [
77+
":feature_verification_tests",
78+
":guardrail_tests",
79+
":language_and_standards_tests",
80+
],
81+
)

0 commit comments

Comments
 (0)