Skip to content

Commit eb3371a

Browse files
committed
add ci/cd workflows for itf test execution
1 parent 56ba5ec commit eb3371a

File tree

3 files changed

+183
-0
lines changed

3 files changed

+183
-0
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: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
jobs:
21+
test_reference_integration:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/[email protected]
26+
- name: Setup Bazel
27+
uses: bazel-contrib/[email protected]
28+
- name: Setup QNX License
29+
env:
30+
SCORE_QNX_LICENSE: ${{ secrets.SCORE_QNX_LICENSE }}
31+
run: |
32+
mkdir -p /opt/score_qnx/license
33+
echo "${SCORE_QNX_LICENSE}" | base64 --decode > /opt/score_qnx/license/licenses
34+
- name: Bazel execute itf qnx_qemu tests
35+
env:
36+
SCORE_QNX_USER: ${{ secrets.SCORE_QNX_USER }}
37+
SCORE_QNX_PASSWORD: ${{ secrets.SCORE_QNX_PASSWORD }}
38+
run: |
39+
cd qnx_qemu
40+
bazel test --config=qemu-integration --test_output=streamed --credential_helper=*.qnx.com=${{ github.workspace }}/.github/tools/qnx_credential_helper.py -- \
41+
//:test_ssh_qemu \
42+
//:test_scrample_qemu \
43+
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: [build_host, build_target, test_host]
53+
if: always() && (needs.build_host.result == 'failure' || needs.build_target.result == 'failure' || needs.test_host.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 }}

0 commit comments

Comments
 (0)