Skip to content

Commit 4544f6c

Browse files
committed
wip: gh wf native
1 parent 6731a6f commit 4544f6c

File tree

1 file changed

+57
-10
lines changed

1 file changed

+57
-10
lines changed

.github/workflows/test.yml

Lines changed: 57 additions & 10 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
@@ -146,10 +147,10 @@ jobs:
146147
run: |
147148
if [ "${{ runner.os }}" = "Linux" ]; then
148149
sudo apt-get -qqy update
149-
sudo apt-get install -qqy cmake
150+
sudo apt-get install -qqy cmake tree
150151
elif [ "${{ runner.os }}" = "Windows" ]; then
151152
choco feature enable -n allowGlobalConfirmation
152-
choco install cmake
153+
choco install cmake tree
153154
else
154155
echo "Unknown runner!"
155156
exit 1
@@ -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'
@@ -177,26 +179,42 @@ jobs:
177179
-DCMAKE_CXX_STANDARD=14
178180
179181
cmake --build . -j $(nproc)
180-
popd
181182
182-
mkdir -p artifacts/example_binaries artifacts/test_binaries
183+
tree .
184+
popd
183185
184186
if [ "${{ runner.os }}" = "Linux" ]; then
185-
bin_path="bin"
187+
bin_path="."
186188
elif [ "${{ runner.os }}" = "Windows" ]; then
187-
bin_path="bin/Debug"
189+
bin_path="Debug"
188190
else
189191
echo "Unknown runner!"
190192
exit 1
191193
fi
192194
195+
mkdir -p build
196+
mkdir -p artifacts/{example_binaries,test_binaries,shared_libs}
197+
193198
for example in examples/*/; do
194199
example_name="$(basename $example)"
195-
cp examples/$example_name/$bin_path/$example_name artifacts/example_binaries/x64-systemc--$example_name.elf
200+
cp build/examples/$example_name/$bin_path/$example_name artifacts/example_binaries/x64-systemc--$example_name
196201
done
197202
for test in tests/*/; do
198203
test_name="$(basename $test)"
199-
cp tests/$test_name/$bin_path/$test_name artifacts/test_binaries/x64-systemc--$test_name.elf
204+
cp build/tests/$test_name/$bin_path/$test_name artifacts/test_binaries/x64-systemc--$test_name
205+
done
206+
for example in examples-native/*/; do
207+
example_name="$(basename $example)"
208+
209+
if [ "${{ runner.os }}" = "Linux" ]; then
210+
bin_path="."
211+
library_name="lib$(basename $example | tr '-' '_').so"
212+
elif [ "${{ runner.os }}" = "Windows" ]; then
213+
bin_path="Debug"
214+
library_name="$(basename $example | tr '-' '_').dll"
215+
fi
216+
217+
cp build/examples-native/$example_name/$bin_path/$library_name artifacts/shared_libs/lib$example_name.so
200218
done
201219
202220
- name: Upload Example Binaries
@@ -211,6 +229,12 @@ jobs:
211229
name: test_binaries-${{ runner.os }}-${{ github.run_id }}
212230
path: artifacts/test_binaries
213231

232+
- name: Upload Example Libs
233+
uses: actions/upload-artifact@v4
234+
with:
235+
name: example_libs-${{ runner.os }}-${{ github.run_id }}
236+
path: artifacts/shared_libs
237+
214238
test-examples:
215239
name: Test Examples
216240
needs: build-examples
@@ -235,11 +259,30 @@ jobs:
235259
name: test_binaries-${{ runner.os }}-${{ github.run_id }}
236260
path: artifacts/test_binaries
237261

262+
- name: Download example libs
263+
uses: actions/download-artifact@v4
264+
with:
265+
name: example_libs-${{ runner.os }}-${{ github.run_id }}
266+
path: artifacts/shared_libs
267+
238268
- name: Download and build Renode
239269
uses: antmicro/renode-test-action@v5.0.0
240270
with:
241271
renode-repository: ${{ inputs.renode_gitrepo || 'https://github.com/renode/renode' }}
242-
renode-revision: ${{ inputs.renode_gitrev || 'master' }}
272+
renode-revision: ${{ '88743-native-systemc' }}
273+
# renode-revision: ${{ inputs.renode_gitrev || 'master' }}
274+
275+
- name: Set library path
276+
shell: bash
277+
run: |
278+
if [ "${{ runner.os }}" = "Linux" ]; then
279+
export LD_LIBRARY_PATH="$(realpath artifacts/shared_libs):$LD_LIBRARY_PATH"
280+
elif [ "${{ runner.os }}" = "Windows" ]; then
281+
export PATH="$(realpath artifacts/shared_libs):$PATH"
282+
else
283+
echo "Unknown runner!"
284+
exit 1
285+
fi
243286
244287
- name: Run tests
245288
shell: bash
@@ -256,6 +299,10 @@ jobs:
256299
cp $test tests/$test_name/bin/$test_name
257300
done
258301
302+
pushd examples-native
303+
renode-test -t all_examples.yaml
304+
popd
305+
259306
pushd examples
260307
renode-test -t all_examples.yaml
261308
popd

0 commit comments

Comments
 (0)