Skip to content

Commit 3a873c8

Browse files
antonkrinradakovic
authored andcommitted
add ci/cd workflows for itf test execution
1 parent 56ba5ec commit 3a873c8

File tree

4 files changed

+210
-34
lines changed

4 files changed

+210
-34
lines changed
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+
)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 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: Test reference integration
15+
on:
16+
pull_request:
17+
types: [opened, reopened, synchronize]
18+
merge_group:
19+
types: [checks_requested]
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
test_reference_integration:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/[email protected]
30+
- name: Setup Bazel
31+
uses: bazel-contrib/[email protected]
32+
- name: Setup QNX License
33+
env:
34+
SCORE_QNX_LICENSE: ${{ secrets.SCORE_QNX_LICENSE }}
35+
run: |
36+
mkdir -p /opt/score_qnx/license
37+
echo "${SCORE_QNX_LICENSE}" | base64 --decode > /opt/score_qnx/license/licenses
38+
- name: Bazel execute itf qnx_qemu tests
39+
env:
40+
SCORE_QNX_USER: ${{ secrets.SCORE_QNX_USER }}
41+
SCORE_QNX_PASSWORD: ${{ secrets.SCORE_QNX_PASSWORD }}
42+
run: |
43+
cd qnx_qemu
44+
bazel test --config=qemu-integration --test_output=streamed --credential_helper=*.qnx.com=${{ github.workspace }}/.github/tools/qnx_credential_helper.py -- \
45+
//:test_ssh_qemu \
46+
//:test_scrample_qemu \
47+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 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+
# Workflow configuration for S-CORE CI - Release Check
15+
# This workflow runs Bazel build and test when triggered by tag creation.
16+
17+
name: Test reference integration
18+
on:
19+
push:
20+
tags:
21+
- 'v*' # Triggers on version tags like v1.0.0
22+
- 'release-*' # Triggers on release tags like release-1.0.0
23+
24+
permissions:
25+
contents: write
26+
27+
jobs:
28+
test_target:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/[email protected]
33+
- name: Setup Bazel
34+
uses: bazel-contrib/[email protected]
35+
- name: Setup QNX License
36+
env:
37+
SCORE_QNX_LICENSE: ${{ secrets.SCORE_QNX_LICENSE }}
38+
run: |
39+
mkdir -p /opt/score_qnx/license
40+
echo "${SCORE_QNX_LICENSE}" | base64 --decode > /opt/score_qnx/license/licenses
41+
- name: Bazel execute itf qnx_qemu tests
42+
env:
43+
SCORE_QNX_USER: ${{ secrets.SCORE_QNX_USER }}
44+
SCORE_QNX_PASSWORD: ${{ secrets.SCORE_QNX_PASSWORD }}
45+
run: |
46+
cd qnx_qemu
47+
bazel test --config=qemu-integration --test_output=streamed --credential_helper=*.qnx.com=${{ github.workspace }}/.github/tools/qnx_credential_helper.py -- \
48+
//:test_ssh_qemu \
49+
//:test_scrample_qemu \
50+
release_verification:
51+
runs-on: ubuntu-latest
52+
needs: [test_target]
53+
if: always() && (needs.test_target.result == 'failure')
54+
steps:
55+
- name: Remove release and tag (if exists)
56+
uses: nikhilbadyal/[email protected]
57+
with:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
RELEASE_PATTERN: ${{ github.ref_name }}

qnx_qemu/MODULE.bazel

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,11 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313
module(
14-
name = "score_toolchains_qnx_tests",
14+
name = "score_ri_qnx_qemu",
1515
version = "0.0.1",
1616
compatibility_level = 0,
1717
)
1818

19-
bazel_dep(name = "score_toolchains_qnx", version = "0.0.2")
20-
git_override(
21-
module_name = "score_toolchains_qnx",
22-
commit = "faa88ee7b26c82b23127b4493f140c15df4c7b8d",
23-
remote = "https://github.com/eclipse-score/toolchains_qnx.git",
24-
)
25-
26-
27-
toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx")
28-
toolchains_qnx.sdp(
29-
sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",
30-
strip_prefix = "installation",
31-
url = "https://www.qnx.com/download/download/79858/installation.tgz",
32-
)
33-
use_repo(toolchains_qnx, "toolchains_qnx_sdp")
34-
use_repo(toolchains_qnx, "toolchains_qnx_qcc")
35-
use_repo(toolchains_qnx, "toolchains_qnx_ifs")
36-
37-
register_toolchains("@toolchains_qnx_qcc//:qcc_x86_64")
38-
register_toolchains("@toolchains_qnx_ifs//:ifs_x86_64")
39-
4019
###############################################################################
4120
#
4221
# Shell dependency
@@ -67,7 +46,7 @@ use_repo(python)
6746
#
6847
###############################################################################
6948
# Configure the host toolchain.
70-
bazel_dep(name = "score_toolchains_gcc", version = "0.4", dev_dependency=True)
49+
bazel_dep(name = "score_toolchains_gcc", version = "0.5", dev_dependency=True)
7150
gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency=True)
7251
gcc.toolchain(
7352
url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/0.0.1/x86_64-unknown-linux-gnu_gcc12.tar.gz",
@@ -88,21 +67,34 @@ use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc")
8867

8968
register_toolchains("@gcc_toolchain//:all")
9069

70+
# Configure target toolchain for QNX build.
71+
bazel_dep(name = "score_toolchains_qnx", version = "0.0.2")
72+
# NOTE: Currently we need to pick dedicated version of toolchains_qnx due to recent changes in the main branch.
73+
git_override(
74+
module_name = "score_toolchains_qnx",
75+
commit = "faa88ee7b26c82b23127b4493f140c15df4c7b8d",
76+
remote = "https://github.com/eclipse-score/toolchains_qnx.git",
77+
)
78+
toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx")
79+
toolchains_qnx.sdp(
80+
sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",
81+
strip_prefix = "installation",
82+
url = "https://www.qnx.com/download/download/79858/installation.tgz",
83+
)
84+
use_repo(toolchains_qnx, "toolchains_qnx_sdp")
85+
use_repo(toolchains_qnx, "toolchains_qnx_qcc")
86+
use_repo(toolchains_qnx, "toolchains_qnx_ifs")
87+
88+
register_toolchains("@toolchains_qnx_qcc//:qcc_x86_64")
89+
register_toolchains("@toolchains_qnx_ifs//:ifs_x86_64")
9190

9291
###############################################################################
9392
#
94-
# C++ rules
93+
# Other dependencies
9594
#
9695
###############################################################################
9796
bazel_dep(name = "rules_cc", version = "0.1.1")
98-
99-
###############################################################################
100-
#
101-
# ITF dependency
102-
#
103-
###############################################################################
10497
bazel_dep(name = "score_itf", version = "0.1.0")
105-
10698
bazel_dep(name = "score_baselibs", version = "0.1.3")
10799

108100
bazel_dep(name = "score_communication", version = "0.0.1")
@@ -111,16 +103,13 @@ git_override(
111103
commit = "2d0d067b064a6e27d115f382bc938a30d44f08e7",
112104
remote = "https://github.com/eclipse-score/communication.git",
113105
)
114-
115106
bazel_dep(name = "scrample", version = "0.0.1")
116107
git_override(
117108
module_name = "scrample",
118109
commit = "a56570127abc583ad6127f27bae31ae3643b2eb9",
119110
remote = "https://github.com/eclipse-score/scrample.git",
120111
)
121112

122-
123-
124113
bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost")
125114
archive_override(
126115
module_name = "rules_boost",

0 commit comments

Comments
 (0)