Skip to content

Commit b09a496

Browse files
committed
[#90242] CI: add Windows runner
1 parent 94d30c4 commit b09a496

File tree

1 file changed

+177
-26
lines changed

1 file changed

+177
-26
lines changed

.github/workflows/test.yml

Lines changed: 177 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ env:
1919
jobs:
2020
build-zephyr-binaries:
2121
name: Build Zephyr Binaries
22-
runs-on: ubuntu-22.04
22+
strategy:
23+
matrix:
24+
os:
25+
- ubuntu-22.04
26+
- windows-2025
27+
runs-on: ${{ matrix.os }}
2328
steps:
2429
- name: Checkout
2530
uses: actions/checkout@v4
@@ -30,9 +35,18 @@ jobs:
3035
python-version: '3.12'
3136

3237
- name: Install Dependencies
38+
shell: bash
3339
run: |
34-
sudo apt-get -qqy update
35-
sudo apt-get install -qqy cmake ninja-build
40+
if [ "${{ runner.os }}" = "Linux" ]; then
41+
sudo apt-get -qqy update
42+
sudo apt-get install -qqy cmake ninja-build
43+
elif [ "${{ runner.os }}" = "Windows" ]; then
44+
choco feature enable -n allowGlobalConfirmation
45+
choco install ninja cmake
46+
else
47+
echo "Unknown runner!"
48+
exit 1
49+
fi
3650
3751
- name: Setup Zephyr project
3852
uses: zephyrproject-rtos/action-zephyr-setup@v1
@@ -41,6 +55,7 @@ jobs:
4155
toolchains: arm-zephyr-eabi
4256

4357
- name: Build Zephyr
58+
shell: bash
4459
run: |
4560
mkdir -p artifacts/zephyr_binaries
4661
for example in examples/*/zephyr; do
@@ -52,100 +67,236 @@ jobs:
5267
- name: Upload Zephyr binaries
5368
uses: actions/upload-artifact@v4
5469
with:
55-
name: zephyr_binaries-${{ github.run_id }}
70+
name: zephyr_binaries-${{ runner.os }}-${{ github.run_id }}
5671
path: artifacts/zephyr_binaries
5772

73+
build-systemc:
74+
name: Build SystemC
75+
strategy:
76+
matrix:
77+
os:
78+
- ubuntu-22.04
79+
- windows-2025
80+
runs-on: ${{ matrix.os }}
81+
steps:
82+
- uses: actions/checkout@v4
83+
with:
84+
submodules: true
85+
86+
- name: Install dependencies
87+
shell: bash
88+
run: |
89+
if [ "${{ runner.os }}" = "Linux" ]; then
90+
sudo apt-get -qqy update
91+
sudo apt-get install -qqy cmake
92+
elif [ "${{ runner.os }}" = "Windows" ]; then
93+
choco feature enable -n allowGlobalConfirmation
94+
choco install cmake
95+
else
96+
echo "Unknown runner!"
97+
exit 1
98+
fi
99+
100+
- name: Set CMake generator
101+
if: runner.os == 'Windows'
102+
shell: bash
103+
run: |
104+
export CMAKE_GENERATOR="Visual Studio 17 2022"
105+
106+
- name: Build library
107+
shell: bash
108+
run: |
109+
mkdir -p build
110+
pushd build
111+
cmake ../systemc -DBUILD_SHARED_LIBS=OFF \
112+
-DCMAKE_CXX_STANDARD=14 \
113+
-DCMAKE_POLICY_VERSION_MINIMUM="3.5"
114+
115+
cmake --build . -j $(nproc)
116+
popd
117+
118+
- name: Upload library (Linux)
119+
if: runner.os == 'Linux'
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: ${{ runner.os }}-${{ github.run_id }}-libsystemc.a
123+
path: build/src/libsystemc.a
124+
125+
- name: Upload library (Windows)
126+
if: runner.os == 'Windows'
127+
uses: actions/upload-artifact@v4
128+
with:
129+
name: ${{ runner.os }}-${{ github.run_id }}-libsystemc.lib
130+
path: build/src/Debug/systemc.lib
131+
58132
build-examples:
59133
name: Build Examples
60-
runs-on: ubuntu-22.04
134+
needs: build-systemc
135+
strategy:
136+
matrix:
137+
os:
138+
- ubuntu-22.04
139+
- windows-2025
140+
runs-on: ${{ matrix.os }}
61141
steps:
62142
- uses: actions/checkout@v4
143+
with:
144+
submodules: true
145+
146+
- name: Download SystemC library (Linux)
147+
if: runner.os == 'Linux'
148+
uses: actions/download-artifact@v4
149+
with:
150+
name: ${{ runner.os }}-${{ github.run_id }}-libsystemc.a
151+
path: artifacts/systemc
152+
153+
- name: Download SystemC library (Windows)
154+
if: runner.os == 'Windows'
155+
uses: actions/download-artifact@v4
156+
with:
157+
name: ${{ runner.os }}-${{ github.run_id }}-libsystemc.lib
158+
path: artifacts/systemc
63159

64160
- name: Install dependencies
161+
shell: bash
65162
run: |
66-
sudo apt-get -qqy update
67-
sudo apt-get install -qqy libsystemc libsystemc-dev clang cmake dotnet-sdk-8.0
163+
if [ "${{ runner.os }}" = "Linux" ]; then
164+
sudo apt-get -qqy update
165+
sudo apt-get install -qqy cmake
166+
elif [ "${{ runner.os }}" = "Windows" ]; then
167+
choco feature enable -n allowGlobalConfirmation
168+
choco install cmake
169+
else
170+
echo "Unknown runner!"
171+
exit 1
172+
fi
68173
69174
- name: Download and build Renode
70175
uses: antmicro/renode-test-action@v5.0.0
71176
with:
72177
renode-repository: ${{ inputs.renode_gitrepo || 'https://github.com/renode/renode' }}
73-
renode-revision: ${{ inputs.renode_gitrev || 'master' }}
178+
# renode-revision: ${{ inputs.renode_gitrev || 'master' }}
179+
renode-revision: 90242-add-windows
180+
181+
- name: Set CMake generator
182+
if: runner.os == 'Windows'
183+
shell: bash
184+
run: |
185+
export CMAKE_GENERATOR="Visual Studio 17 2022"
74186
75187
- name: Build examples
188+
shell: bash
76189
run: |
77190
mkdir -p build
78191
pushd build
79-
cmake ..
80-
make CPPSTD=c++14 -j $(nproc)
192+
cmake .. -DUSER_SYSTEMC_INCLUDE_DIR=$(pwd)/../systemc/src \
193+
-DUSER_SYSTEMC_LIB_DIR=$(pwd)/../artifacts/systemc \
194+
-DCMAKE_CXX_STANDARD=14
195+
196+
cmake --build . -j $(nproc)
81197
popd
82198
83199
mkdir -p artifacts/example_binaries artifacts/test_binaries
200+
201+
if [ "${{ runner.os }}" = "Linux" ]; then
202+
bin_path="bin"
203+
elif [ "${{ runner.os }}" = "Windows" ]; then
204+
bin_path="bin/Debug"
205+
else
206+
echo "Unknown runner!"
207+
exit 1
208+
fi
209+
84210
for example in examples/*/; do
85211
example_name="$(basename $example)"
86-
cp examples/$example_name/bin/$example_name artifacts/example_binaries/x64-systemc--$example_name.elf
212+
cp examples/$example_name/$bin_path/$example_name artifacts/example_binaries/x64-systemc--$example_name.elf
87213
done
88214
for test in tests/*/; do
89215
test_name="$(basename $test)"
90-
cp tests/$test_name/bin/$test_name artifacts/test_binaries/x64-systemc--$test_name.elf
216+
cp tests/$test_name/$bin_path/$test_name artifacts/test_binaries/x64-systemc--$test_name.elf
91217
done
92218
93219
- name: Upload Example Binaries
94220
uses: actions/upload-artifact@v4
95221
with:
96-
name: example_binaries-${{ github.run_id }}
222+
name: example_binaries-${{ runner.os }}-${{ github.run_id }}
97223
path: artifacts/example_binaries
98224

99225
- name: Upload Test Binaries
100226
uses: actions/upload-artifact@v4
101227
with:
102-
name: test_binaries-${{ github.run_id }}
228+
name: test_binaries-${{ runner.os }}-${{ github.run_id }}
103229
path: artifacts/test_binaries
104230

105231
test-examples:
106232
name: Test Examples
107-
runs-on: ubuntu-22.04
108233
needs: build-examples
234+
strategy:
235+
matrix:
236+
os:
237+
- ubuntu-22.04
238+
- windows-2025
239+
runs-on: ${{ matrix.os }}
109240
steps:
110241
- uses: actions/checkout@v4
111242

112-
- name: Install dependencies
113-
run: |
114-
sudo apt-get -qqy update
115-
sudo apt-get install -qqy libsystemc libsystemc-dev dotnet-sdk-8.0
243+
# - name: Install dependencies
244+
# run: |
245+
# sudo apt-get -qqy update
246+
# sudo apt-get install -qqy libsystemc libsystemc-dev
247+
248+
- name: Download example binaries (Linux)
249+
if: runner.os == 'Linux'
250+
uses: actions/download-artifact@v4
251+
with:
252+
name: example_binaries-${{ runner.os }}-${{ github.run_id }}
253+
path: artifacts/example_binaries
116254

117-
- name: Download example binaries
255+
- name: Download test binaries (Linux)
256+
if: runner.os == 'Linux'
118257
uses: actions/download-artifact@v4
119258
with:
120-
name: example_binaries-${{ github.run_id }}
259+
name: test_binaries-${{ runner.os }}-${{ github.run_id }}
260+
path: artifacts/test_binaries
261+
262+
- name: Download example binaries (Windows)
263+
if: runner.os == 'Windows'
264+
uses: actions/download-artifact@v4
265+
with:
266+
name: example_binaries-${{ runner.os }}-${{ github.run_id }}
121267
path: artifacts/example_binaries
122268

123-
- name: Download test binaries
269+
- name: Download test binaries (Windows)
270+
if: runner.os == 'Windows'
124271
uses: actions/download-artifact@v4
125272
with:
126-
name: test_binaries-${{ github.run_id }}
273+
name: test_binaries-${{ runner.os }}-${{ github.run_id }}
127274
path: artifacts/test_binaries
128275

129276
- name: Download and build Renode
130277
uses: antmicro/renode-test-action@v5.0.0
131278
with:
132279
renode-repository: ${{ inputs.renode_gitrepo || 'https://github.com/renode/renode' }}
133-
renode-revision: ${{ inputs.renode_gitrev || 'master' }}
280+
# renode-revision: ${{ inputs.renode_gitrev || 'master' }}
281+
renode-revision: 90242-add-windows
134282

135283
- name: Run tests
284+
shell: bash
136285
run: |
137286
for example in artifacts/example_binaries/*; do
138-
example_name="$(basename $example | sed -e 's/x64-systemc--//' -e 's/.elf//')"
287+
example_name="$(basename $example | sed -e 's/x64-systemc--//' -e 's/.elf//' -e 's/.exe//')"
139288
mkdir -p examples/$example_name/bin
140289
cp $example examples/$example_name/bin/$example_name
141290
done
142291
143292
for test in artifacts/test_binaries/*; do
144-
test_name="$(basename $test | sed -e 's/x64-systemc--//' -e 's/.elf//')"
293+
test_name="$(basename $test | sed -e 's/x64-systemc--//' -e 's/.elf//' -e 's/.exe//')"
145294
mkdir -p tests/$test_name/bin
146295
cp $test tests/$test_name/bin/$test_name
147296
done
148297
298+
ls examples/timesync/bin
299+
149300
pushd examples
150301
renode-test -t all_examples.yaml
151302
popd

0 commit comments

Comments
 (0)