Skip to content

Commit 482b760

Browse files
authored
Merge pull request #4 from feature/github-workflows
feat: GitHub workflows
2 parents 192c4ee + 407a9a3 commit 482b760

File tree

13 files changed

+8652
-0
lines changed

13 files changed

+8652
-0
lines changed

.github/Dockerfile

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
FROM ubuntu:24.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
6+
build-essential ca-certificates \
7+
cmake pkg-config clang-format \
8+
libboost-all-dev \
9+
curl wget git \
10+
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
11+
12+
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
13+
libcurl4-openssl-dev \
14+
jq netcat-openbsd \
15+
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
16+
17+
ARG NODE_VERSION="24.11.0"
18+
ENV NVM_DIR="/usr/local/nvm"
19+
RUN mkdir -p $NVM_DIR
20+
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
21+
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION"
22+
ENV NODE_PATH="$NVM_DIR/versions/node/$NODE_VERSION/lib/node_modules"
23+
ENV PATH="$NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH"
24+
25+
RUN mkdir -p /deps
26+
27+
ARG DEPS_GOOGLETEST_V="1.15.2"
28+
RUN cd /deps \
29+
&& dir="googletest-${DEPS_GOOGLETEST_V}" \
30+
&& curl -sL https://github.com/google/googletest/releases/download/v${DEPS_GOOGLETEST_V}/$dir.tar.gz | tar xzf - \
31+
&& cmake -B "build/$dir" \
32+
-DCMAKE_BUILD_TYPE=Release \
33+
-DBUILD_SHARED_LIBS=ON \
34+
"$dir" \
35+
&& cmake --build "build/$dir" --target install \
36+
&& rm -rf "build/$dir" "$dir"
37+
38+
ARG DEPS_NLOHMANN_JSON_V="3.11.3"
39+
RUN cd /deps \
40+
&& dir="nlohmann-json-${DEPS_NLOHMANN_JSON_V}" \
41+
&& git clone --depth 1 --branch "v${DEPS_NLOHMANN_JSON_V}" "https://github.com/nlohmann/json" "$dir" \
42+
&& cmake -B "build/$dir" \
43+
-DCMAKE_BUILD_TYPE=Release \
44+
-DBUILD_SHARED_LIBS=ON \
45+
-DJSON_BuildTests=OFF \
46+
"$dir" \
47+
&& cmake --build "build/$dir" --target install \
48+
&& rm -rf "build/$dir" "$dir"
49+
50+
ARG DEPS_JSON_SCHEMA_VALIDATOR_V="2.3.0"
51+
RUN cd /deps \
52+
&& dir="json-schema-validator-${DEPS_JSON_SCHEMA_VALIDATOR_V}" \
53+
&& curl -sL https://github.com/pboettch/json-schema-validator/archive/refs/tags/${DEPS_JSON_SCHEMA_VALIDATOR_V}.tar.gz | tar xzf - \
54+
&& cmake -B "build/$dir" \
55+
-DCMAKE_BUILD_TYPE=Release \
56+
-DBUILD_SHARED_LIBS=ON \
57+
-DJSON_VALIDATOR_BUILD_TESTS=OFF \
58+
-DJSON_VALIDATOR_BUILD_EXAMPLES=OFF \
59+
"$dir" \
60+
&& cmake --build "build/$dir" --target install \
61+
&& rm -rf "build/$dir" "$dir"
62+
63+
ARG DEPS_WEBSOCKETPP_V="0.8.2"
64+
RUN cd /deps \
65+
&& dir="websocketpp-${DEPS_WEBSOCKETPP_V}" \
66+
&& curl -sL https://github.com/zaphoyd/websocketpp/archive/refs/tags/${DEPS_WEBSOCKETPP_V}.tar.gz | tar xzf - \
67+
&& cmake -B "build/$dir" \
68+
-DCMAKE_BUILD_TYPE=Release \
69+
-DBUILD_SHARED_LIBS=ON \
70+
-DBUILD_TESTS=OFF \
71+
-DBUILD_EXAMPLES=OFF \
72+
"$dir" \
73+
&& cmake --build "build/$dir" --target install \
74+
&& rm -rf "build/$dir" "$dir"
75+
76+
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
77+
python3-pip \
78+
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
79+
80+
RUN pip install --break-system-packages gcovr
81+
82+
# --- Transport should be always at the very end as it changes most often
83+
ARG DEPS_TRANSPORT_V
84+
RUN cd /deps \
85+
&& dir="firebolt-native-transport-${DEPS_TRANSPORT_V}" \
86+
&& curl -sL https://github.com/rdkcentral/firebolt-native-transport/releases/download/v${DEPS_TRANSPORT_V}/firebolt-native-transport-${DEPS_TRANSPORT_V}.tar.gz | tar xzf - \
87+
&& cmake -B "build/$dir" \
88+
-DCMAKE_BUILD_TYPE=Release \
89+
-DBUILD_SHARED_LIBS=ON \
90+
"$dir" \
91+
&& cmake --build "build/$dir" --target install \
92+
&& rm -rf "build/$dir" "$dir"
93+
94+
WORKDIR /workspace
95+
96+
CMD ["/bin/bash"]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Setup Mock-Firebolt'
2+
description: 'Sets up Mock-Firebolt and caches it.'
3+
runs:
4+
using: "composite"
5+
6+
steps:
7+
- name: Generate Dependency Hash Key
8+
id: cache-key
9+
shell: bash
10+
run: |
11+
echo "hash=$( ( echo "${{ env.MOCK_SHA1SUM }}"; sha256sum "${{ env.MOCK_PATCH }}" | awk '{print $1}' ) | sha256sum | awk '{print $1}')" >> $GITHUB_OUTPUT
12+
13+
- name: Restore Dependency Cache
14+
uses: actions/cache@v4
15+
id: cache-restore
16+
with:
17+
path: ${{ env.MOCK_PATH }}
18+
key: ${{ runner.os }}-mock-${{ steps.cache-key.outputs.hash }}
19+
20+
- name: Build and Install Mock-Firebolt
21+
if: steps.cache-restore.outputs.cache-hit != 'true'
22+
shell: bash
23+
run: |
24+
echo "Building Mock-Firebolt..."
25+
git clone --depth 1 --branch main https://github.com/rdkcentral/mock-firebolt.git ${{ env.MOCK_PATH }}
26+
cd ${{ env.MOCK_PATH }}
27+
git fetch --shallow-since=2025-11-01
28+
git checkout ${{ env.MOCK_SHA1SUM }}
29+
git apply "${{ env.MOCK_PATCH }}"
30+
cd server
31+
npm ci
32+
echo "Mock-Firebolt built and installed to ${{ env.MOCK_PATH }}"
33+
34+
- name: Cache Save Confirmation
35+
if: steps.cache-restore.outputs.cache-hit != 'true'
36+
shell: bash
37+
run: echo "New dependency cache will be saved."
38+
39+
outputs:
40+
deps_cache_key:
41+
description: "The cache key for the dependencies."
42+
value: ${{ steps.cache-key.outputs.hash }}

.github/mock-firebolt/config.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"validate": [
3+
"method",
4+
"params",
5+
"response",
6+
"events"
7+
],
8+
"multiUserConnections": "warn",
9+
"bidirectional": true,
10+
"supportedOpenRPCs": [
11+
{
12+
"name": "core",
13+
"cliFlag": null,
14+
"cliShortFlag": null,
15+
"url_Note": "Can be changed to test different versions of the firebolt-open-rpc",
16+
"fileName": "CORE-OPENRPC.json",
17+
"enabled": true
18+
},
19+
{
20+
"name": "mock",
21+
"cliFlag": "mock",
22+
"cliShortFlag": "m",
23+
"fileName": "../../functional/mockOpenRpc.json",
24+
"enabled": false
25+
}
26+
],
27+
"supportedToAppOpenRPCs": [
28+
{
29+
"name": "coreToApp",
30+
"cliFlag": null,
31+
"cliShortFlag": null,
32+
"url_Note": "URL for toApp OpenRPC (Firebolt 2.0 event/provider spec)",
33+
"fileName": "APP-OPENRPC.json",
34+
"enabled": true
35+
},
36+
{
37+
"name": "mockToApp",
38+
"cliFlag": "mockToApp",
39+
"cliShortFlag": "mt",
40+
"fileName": "../../functional/mockToAppOpenRpc.json",
41+
"enabled": false
42+
}
43+
],
44+
"eventConfig": {
45+
"registrationMessage": {
46+
"searchRegex": "(?=.*\\\"method\\\".*)(?=.*\\\"listen\\\":true.*).*\\.on\\S*",
47+
"method": "$.method"
48+
},
49+
"unRegistrationMessage": {
50+
"searchRegex": "(?=.*\\\"method\\\".*)(?=.*\\\"listen\\\":false.*).*\\.on\\S*",
51+
"method": "$.method"
52+
},
53+
"registrationAck": "{\"jsonrpc\":\"2.0\",\"id\":{{registration.id}},\"result\":null}",
54+
"unRegistrationAck": "{\"jsonrpc\":\"2.0\",\"id\":{{unRegistration.id}},\"result\":null}",
55+
"event": "{\"result\":{{{resultAsJson}}},\"id\":{{registration.id}},\"jsonrpc\":\"2.0\"}",
56+
"eventType": "Firebolt"
57+
}
58+
}

0 commit comments

Comments
 (0)