Skip to content

Commit b381f46

Browse files
committed
[#88743] CI: test native libs on Windows
1 parent 6731a6f commit b381f46

File tree

1 file changed

+50
-8
lines changed

1 file changed

+50
-8
lines changed

.github/workflows/test.yml

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ jobs:
109109
mkdir -p build
110110
pushd build
111111
cmake ../systemc -DBUILD_SHARED_LIBS=OFF \
112+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
112113
-DCMAKE_CXX_STANDARD=14 \
113114
-DCMAKE_POLICY_VERSION_MINIMUM="3.5"
114115
@@ -159,7 +160,8 @@ jobs:
159160
uses: antmicro/renode-test-action@v5.0.0
160161
with:
161162
renode-repository: ${{ inputs.renode_gitrepo || 'https://github.com/renode/renode' }}
162-
renode-revision: ${{ inputs.renode_gitrev || 'master' }}
163+
renode-revision: ${{ '88743-native-systemc' }}
164+
# renode-revision: ${{ inputs.renode_gitrev || 'master' }}
163165

164166
- name: Set CMake generator
165167
if: runner.os == 'Windows'
@@ -179,24 +181,38 @@ jobs:
179181
cmake --build . -j $(nproc)
180182
popd
181183
182-
mkdir -p artifacts/example_binaries artifacts/test_binaries
183-
184184
if [ "${{ runner.os }}" = "Linux" ]; then
185-
bin_path="bin"
185+
bin_path="."
186186
elif [ "${{ runner.os }}" = "Windows" ]; then
187-
bin_path="bin/Debug"
187+
bin_path="Debug"
188188
else
189189
echo "Unknown runner!"
190190
exit 1
191191
fi
192192
193+
mkdir -p build
194+
mkdir -p artifacts/{example_binaries,test_binaries,shared_libs}
195+
193196
for example in examples/*/; do
194197
example_name="$(basename $example)"
195-
cp examples/$example_name/$bin_path/$example_name artifacts/example_binaries/x64-systemc--$example_name.elf
198+
cp build/examples/$example_name/$bin_path/$example_name artifacts/example_binaries/x64-systemc--$example_name
196199
done
197200
for test in tests/*/; do
198201
test_name="$(basename $test)"
199-
cp tests/$test_name/$bin_path/$test_name artifacts/test_binaries/x64-systemc--$test_name.elf
202+
cp build/tests/$test_name/$bin_path/$test_name artifacts/test_binaries/x64-systemc--$test_name
203+
done
204+
for example in examples-native/*/; do
205+
example_name="$(basename $example)"
206+
207+
if [ "${{ runner.os }}" = "Linux" ]; then
208+
bin_path="."
209+
library_name="lib$(basename $example | tr '-' '_').so"
210+
elif [ "${{ runner.os }}" = "Windows" ]; then
211+
bin_path="Debug"
212+
library_name="$(basename $example | tr '-' '_').dll"
213+
fi
214+
215+
cp build/examples-native/$example_name/$bin_path/$library_name artifacts/shared_libs/lib$(basename $example | tr '-' '_').so
200216
done
201217
202218
- name: Upload Example Binaries
@@ -211,6 +227,12 @@ jobs:
211227
name: test_binaries-${{ runner.os }}-${{ github.run_id }}
212228
path: artifacts/test_binaries
213229

230+
- name: Upload Example Libs
231+
uses: actions/upload-artifact@v4
232+
with:
233+
name: example_libs-${{ runner.os }}-${{ github.run_id }}
234+
path: artifacts/shared_libs
235+
214236
test-examples:
215237
name: Test Examples
216238
needs: build-examples
@@ -235,11 +257,18 @@ jobs:
235257
name: test_binaries-${{ runner.os }}-${{ github.run_id }}
236258
path: artifacts/test_binaries
237259

260+
- name: Download example libs
261+
uses: actions/download-artifact@v4
262+
with:
263+
name: example_libs-${{ runner.os }}-${{ github.run_id }}
264+
path: artifacts/shared_libs
265+
238266
- name: Download and build Renode
239267
uses: antmicro/renode-test-action@v5.0.0
240268
with:
241269
renode-repository: ${{ inputs.renode_gitrepo || 'https://github.com/renode/renode' }}
242-
renode-revision: ${{ inputs.renode_gitrev || 'master' }}
270+
renode-revision: ${{ '88743-native-systemc' }}
271+
# renode-revision: ${{ inputs.renode_gitrev || 'master' }}
243272

244273
- name: Run tests
245274
shell: bash
@@ -256,6 +285,19 @@ jobs:
256285
cp $test tests/$test_name/bin/$test_name
257286
done
258287
288+
if [ "${{ runner.os }}" = "Linux" ]; then
289+
export LD_LIBRARY_PATH="$(realpath artifacts/shared_libs):$LD_LIBRARY_PATH"
290+
elif [ "${{ runner.os }}" = "Windows" ]; then
291+
export PATH="$(realpath artifacts/shared_libs):$PATH"
292+
else
293+
echo "Unknown runner!"
294+
exit 1
295+
fi
296+
297+
pushd examples-native
298+
renode-test -t all_examples.yaml
299+
popd
300+
259301
pushd examples
260302
renode-test -t all_examples.yaml
261303
popd

0 commit comments

Comments
 (0)