Skip to content

Commit 94d30c4

Browse files
committed
[#90242] CI: rework jobs
1 parent 67fed0e commit 94d30c4

File tree

3 files changed

+143
-155
lines changed

3 files changed

+143
-155
lines changed

.ci.yml

Lines changed: 83 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,112 @@
11
variables:
2-
WEST_VERSION: 1.2.0
3-
ZEPHYR_SDK_VERSION: 0.16.5-1
4-
ZEPHYR_SDK_BASENAME: zephyr-sdk-${ZEPHYR_SDK_VERSION}
5-
ZEPHYR_SDK_FILENAME: zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz
6-
ZEPHYR_VERSION: d0ae1a8b1057c0a8b510860d1cbdbb1cb79f2411
2+
GIT_SUBMODULE_STRATEGY: recursive
3+
DEBIAN_FRONTEND: noninteractive
4+
CMAKE_PREFIX_PATH: /opt/toolchains
5+
SCALENODE_CPU: 4
6+
SCALENODE_RAM: 8192
7+
SCALENODE_DISK: 40
78

89
stages:
9-
- build_dependencies
10-
- build
11-
- test
10+
- Build dependencies
11+
- Build
12+
- Test
1213

13-
build_systemc:
14-
image: antmicro/renode:nightly
15-
stage: build_dependencies
14+
Build SystemC:
15+
image: debian:12.5-slim
16+
stage: Build dependencies
17+
before_get_sources:
18+
- apt-get -qqy update
19+
- apt-get install -qqy cmake clang git
1620
script:
17-
- apt-get -qqy update && apt-get install -qqy cmake clang git
18-
- git submodule update --init
19-
- pushd systemc
20-
- mkdir -p build
21-
- pushd build
22-
- cmake .. -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_STANDARD=14
23-
- make -j
24-
- popd
25-
- popd
26-
- mkdir -p artifacts/systemc
27-
- cp systemc/build/src/libsystemc.a artifacts/systemc
21+
- mkdir -p build artifacts/systemc
22+
- |
23+
pushd build
24+
cmake ../systemc -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_STANDARD=14
25+
make -j $(nproc)
26+
popd
27+
- cp build/src/libsystemc.a artifacts/systemc
2828
artifacts:
2929
paths:
3030
- artifacts/
3131

32-
build_zephyr_binaries:
33-
image: debian:12.5-slim
34-
stage: build_dependencies
32+
Build Zephyr Binaries:
33+
image: zephyrprojectrtos/ci:v0.28.2
34+
stage: Build dependencies
3535
script:
36-
- apt-get -qqy update && apt-get install -qqy wget python3-pip python3-venv cmake git ninja-build
37-
- python3 -m venv venv && source venv/bin/activate
38-
- pip3 install west==${WEST_VERSION}
39-
- wget --no-verbose https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/${ZEPHYR_SDK_FILENAME} && tar xf ${ZEPHYR_SDK_FILENAME} && pushd ${ZEPHYR_SDK_BASENAME} && ./setup.sh -t all -c && popd && export ZEPHYR_SDK_INSTALL_DIR=$(pwd)/${ZEPHYR_SDK_BASENAME}
40-
- west init zephyrproject
41-
- pushd zephyrproject/zephyr
42-
- git checkout ${ZEPHYR_VERSION} && west update
43-
- pip3 install -r scripts/requirements.txt
36+
- west init -l .
4437
- west update
45-
- popd
38+
- west zephyr-export
39+
- west packages pip --install
40+
4641
- mkdir -p artifacts/zephyr_binaries
47-
- for i in `find examples -name "zephyr"`;
48-
do
49-
EXAMPLE_NAME="$(echo $i | sed -e "s/examples\///" -e "s/\/zephyr//")";
50-
mkdir -p examples/$EXAMPLE_NAME/bin;
51-
pushd zephyrproject/zephyr;
52-
west build -b stm32f401_mini ../../examples/$EXAMPLE_NAME/zephyr;
53-
cp build/zephyr/zephyr.elf ../../examples/$EXAMPLE_NAME/bin/$EXAMPLE_NAME.elf;
54-
cp build/zephyr/zephyr.elf ../../artifacts/zephyr_binaries/$EXAMPLE_NAME.elf;
55-
rm -rf build/;
56-
popd;
42+
43+
- |
44+
for example in examples/*/zephyr; do
45+
example_name=$(echo $example | cut -f 2 -d '/')
46+
west build -p -b stm32f401_mini $example
47+
cp build/zephyr/zephyr.elf artifacts/zephyr_binaries/$example_name.elf
5748
done
5849
artifacts:
5950
paths:
6051
- artifacts/
6152

62-
build_examples:
63-
image: antmicro/renode:nightly
64-
stage: build
53+
Build Examples:
54+
image: antmicro/renode:nightly-dotnet
55+
stage: Build
56+
before_get_sources:
57+
- apt-get -qqy update
58+
- apt-get -qqy install clang cmake git
6559
script:
66-
- apt -qqy update
67-
- apt -qqy install clang cmake git
68-
- git submodule update --init
6960
- mkdir -p build
70-
- pushd build
71-
- cmake .. -DUSER_RENODE_DIR=/opt/renode -DUSER_SYSTEMC_INCLUDE_DIR=$(pwd)/../systemc/src -DUSER_SYSTEMC_LIB_DIR=$(pwd)/../artifacts/systemc -DCMAKE_CXX_STANDARD=14
72-
- make -j
73-
- popd
74-
- mkdir -p artifacts/example_binaries
75-
- mkdir -p artifacts/test_binaries
76-
- for i in examples/*/;
77-
do
78-
EXAMPLE_NAME="$(basename $i)";
79-
cp examples/$EXAMPLE_NAME/bin/$EXAMPLE_NAME artifacts/example_binaries/x64-systemc--$EXAMPLE_NAME.elf;
61+
- |
62+
pushd build
63+
cmake .. -DUSER_RENODE_DIR=/opt/renode -DUSER_SYSTEMC_INCLUDE_DIR=$(pwd)/../systemc/src -DUSER_SYSTEMC_LIB_DIR=$(pwd)/../artifacts/systemc -DCMAKE_CXX_STANDARD=14
64+
make -j $(nproc)
65+
popd
66+
67+
- mkdir -p artifacts/example_binaries artifacts/test_binaries
68+
- |
69+
for example in examples/*/; do
70+
example_name="$(basename $example)"
71+
cp examples/$example_name/bin/$example_name artifacts/example_binaries/x64-systemc--$example_name.elf
8072
done
81-
- for i in tests/*/;
82-
do
83-
TEST_NAME="$(basename $i)";
84-
cp tests/$TEST_NAME/bin/$TEST_NAME artifacts/test_binaries/x64-systemc--$TEST_NAME.elf;
73+
- |
74+
for test in tests/*/; do
75+
test_name="$(basename $test)"
76+
cp tests/$test_name/bin/$test_name artifacts/test_binaries/x64-systemc--$test_name.elf
8577
done
8678
artifacts:
8779
paths:
8880
- artifacts/
8981

90-
test_examples:
91-
image: antmicro/renode:nightly
92-
stage: test
82+
Test Examples:
83+
image: antmicro/renode:nightly-dotnet
84+
stage: Test
9385
dependencies:
94-
- build_examples
86+
- Build Examples
87+
before_get_sources:
88+
- apt-get -qqy update
89+
- apt-get -qqy install libsystemc libsystemc-dev
9590
script:
96-
- apt -qqy update
97-
- apt -qqy install libsystemc libsystemc-dev
98-
- for i in artifacts/example_binaries/*;
99-
do
100-
EXAMPLE_NAME="$(basename $i | sed -e 's/x64-systemc--//' -e 's/.elf//')";
101-
mkdir -p examples/$EXAMPLE_NAME/bin;
102-
cp $i examples/$EXAMPLE_NAME/bin/$EXAMPLE_NAME;
91+
- |
92+
for example in artifacts/example_binaries/*; do
93+
example_name="$(basename $example | sed -e 's/x64-systemc--//' -e 's/.elf//')"
94+
mkdir -p examples/$example_name/bin
95+
cp $example examples/$example_name/bin/$example_name
10396
done
104-
- pushd examples
105-
- renode-test -t all_examples.yaml
106-
- popd
107-
- for i in artifacts/test_binaries/*;
108-
do
109-
TEST_NAME="$(basename $i | sed -e 's/x64-systemc--//' -e 's/.elf//')";
110-
mkdir -p tests/$TEST_NAME/bin;
111-
cp $i tests/$TEST_NAME/bin/$TEST_NAME;
97+
- |
98+
for test in artifacts/test_binaries/*; do
99+
test_name="$(basename $test | sed -e 's/x64-systemc--//' -e 's/.elf//')"
100+
mkdir -p tests/$test_name/bin
101+
cp $test tests/$test_name/bin/$test_name
112102
done
113-
- pushd tests
114-
- renode-test -t all_tests.yaml
115-
- popd
103+
104+
- |
105+
pushd examples
106+
renode-test -t all_examples.yaml
107+
popd
108+
109+
- |
110+
pushd tests
111+
renode-test -t all_tests.yaml
112+
popd

.github/workflows/test.yml

Lines changed: 47 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -13,73 +13,46 @@ on:
1313
required: false
1414

1515
env:
16-
WEST_VERSION: 1.2.0
17-
ZEPHYR_SDK_VERSION: 0.16.5-1
18-
ZEPHYR_SDK_BASENAME: zephyr-sdk-${ZEPHYR_SDK_VERSION}
19-
ZEPHYR_SDK_FILENAME: zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz
20-
ZEPHYR_VERSION: d0ae1a8b1057c0a8b510860d1cbdbb1cb79f2411
16+
DEBIAN_FRONTEND: noninteractive
17+
CMAKE_PREFIX_PATH: /opt/toolchains
2118

2219
jobs:
2320
build-zephyr-binaries:
2421
name: Build Zephyr Binaries
2522
runs-on: ubuntu-22.04
2623
steps:
27-
- uses: actions/checkout@v4
24+
- name: Checkout
25+
uses: actions/checkout@v4
2826

2927
- name: Set up Python
3028
uses: actions/setup-python@v5
3129
with:
3230
python-version: '3.12'
3331

34-
- name: Install dependencies
32+
- name: Install Dependencies
3533
run: |
3634
sudo apt-get -qqy update
37-
sudo apt-get install -qqy wget python3-pip python3-venv cmake git ninja-build
38-
39-
- name: Set up Python virtual environment
40-
run: |
41-
python3 -m venv venv
42-
source venv/bin/activate
43-
echo "PATH=$PATH" >> "$GITHUB_ENV"
44-
pip3 install west=="$WEST_VERSION"
45-
46-
- name: Set up Zephyr SDK
47-
run: |
48-
wget --no-verbose https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${{ env.ZEPHYR_SDK_VERSION }}/${{ env.ZEPHYR_SDK_FILENAME }}
49-
tar xf ${{ env.ZEPHYR_SDK_FILENAME }}
50-
pushd ${{ env.ZEPHYR_SDK_BASENAME }}
51-
./setup.sh -t all -c
52-
popd
53-
echo "ZEPHYR_SDK_INSTALL_DIR=$(pwd)/${{ env.ZEPHYR_SDK_BASENAME }}" >> $GITHUB_ENV
54-
55-
- name: Get Zephyr source
56-
run: |
57-
west init zephyrproject
58-
pushd zephyrproject/zephyr
59-
git checkout ${{ env.ZEPHYR_VERSION }}
60-
west update
61-
echo "ZEPHYR_BASE=$PWD" >> "$GITHUB_ENV"
62-
pip3 install -r scripts/requirements.txt
63-
popd
35+
sudo apt-get install -qqy cmake ninja-build
36+
37+
- name: Setup Zephyr project
38+
uses: zephyrproject-rtos/action-zephyr-setup@v1
39+
with:
40+
app-path: .
41+
toolchains: arm-zephyr-eabi
6442

65-
- name: Build Zephyr examples
43+
- name: Build Zephyr
6644
run: |
6745
mkdir -p artifacts/zephyr_binaries
68-
for i in `find examples -name "zephyr"`; do
69-
EXAMPLE_NAME=`echo $i | sed -e "s/examples\///" | sed -e "s/\/zephyr//"`
70-
mkdir -p examples/$EXAMPLE_NAME/bin
71-
pushd zephyrproject/zephyr
72-
west build -b stm32f401_mini ../../examples/$EXAMPLE_NAME/zephyr
73-
cp build/zephyr/zephyr.elf ../../examples/$EXAMPLE_NAME/bin/$EXAMPLE_NAME.elf
74-
cp build/zephyr/zephyr.elf ../../artifacts/zephyr_binaries/$EXAMPLE_NAME.elf
75-
rm -rf build/
76-
popd
46+
for example in examples/*/zephyr; do
47+
example_name=$(echo $example | cut -f 2 -d '/')
48+
west build -p -b stm32f401_mini $example
49+
cp build/zephyr/zephyr.elf artifacts/zephyr_binaries/$example_name.elf
7750
done
7851
7952
- name: Upload Zephyr binaries
8053
uses: actions/upload-artifact@v4
8154
with:
82-
name: zephyr_binaries-${{ env.ZEPHYR_VERSION }}-${{ github.run_id }}
55+
name: zephyr_binaries-${{ github.run_id }}
8356
path: artifacts/zephyr_binaries
8457

8558
build-examples:
@@ -91,7 +64,7 @@ jobs:
9164
- name: Install dependencies
9265
run: |
9366
sudo apt-get -qqy update
94-
sudo apt-get install -qqy libsystemc libsystemc-dev clang cmake
67+
sudo apt-get install -qqy libsystemc libsystemc-dev clang cmake dotnet-sdk-8.0
9568
9669
- name: Download and build Renode
9770
uses: antmicro/renode-test-action@v5.0.0
@@ -103,25 +76,27 @@ jobs:
10376
run: |
10477
mkdir -p build
10578
pushd build
106-
cmake ..
107-
make CPPSTD=c++14 -j8
79+
cmake ..
80+
make CPPSTD=c++14 -j $(nproc)
10881
popd
109-
mkdir -p artifacts/example_binaries
110-
for i in examples/*/; do
111-
cp "$i"/bin/* artifacts/example_binaries
82+
83+
mkdir -p artifacts/example_binaries artifacts/test_binaries
84+
for example in examples/*/; do
85+
example_name="$(basename $example)"
86+
cp examples/$example_name/bin/$example_name artifacts/example_binaries/x64-systemc--$example_name.elf
11287
done
113-
mkdir -p artifacts/test_binaries
114-
for i in tests/*/; do
115-
cp "$i"/bin/* artifacts/test_binaries
88+
for test in tests/*/; do
89+
test_name="$(basename $test)"
90+
cp tests/$test_name/bin/$test_name artifacts/test_binaries/x64-systemc--$test_name.elf
11691
done
117-
118-
- name: Upload example binaries
92+
93+
- name: Upload Example Binaries
11994
uses: actions/upload-artifact@v4
12095
with:
12196
name: example_binaries-${{ github.run_id }}
12297
path: artifacts/example_binaries
12398

124-
- name: Upload test binaries
99+
- name: Upload Test Binaries
125100
uses: actions/upload-artifact@v4
126101
with:
127102
name: test_binaries-${{ github.run_id }}
@@ -137,7 +112,7 @@ jobs:
137112
- name: Install dependencies
138113
run: |
139114
sudo apt-get -qqy update
140-
sudo apt-get install -qqy libsystemc libsystemc-dev
115+
sudo apt-get install -qqy libsystemc libsystemc-dev dotnet-sdk-8.0
141116
142117
- name: Download example binaries
143118
uses: actions/download-artifact@v4
@@ -159,19 +134,22 @@ jobs:
159134

160135
- name: Run tests
161136
run: |
162-
for i in artifacts/example_binaries/*; do
163-
mkdir -p examples/"$(basename "$i")"/bin
164-
chmod +x "$i"
165-
cp $i examples/"$(basename "$i")"/bin
137+
for example in artifacts/example_binaries/*; do
138+
example_name="$(basename $example | sed -e 's/x64-systemc--//' -e 's/.elf//')"
139+
mkdir -p examples/$example_name/bin
140+
cp $example examples/$example_name/bin/$example_name
166141
done
142+
143+
for test in artifacts/test_binaries/*; do
144+
test_name="$(basename $test | sed -e 's/x64-systemc--//' -e 's/.elf//')"
145+
mkdir -p tests/$test_name/bin
146+
cp $test tests/$test_name/bin/$test_name
147+
done
148+
167149
pushd examples
168-
renode-test -t all_examples.yaml
150+
renode-test -t all_examples.yaml
169151
popd
170-
for i in artifacts/test_binaries/*; do
171-
mkdir -p tests/"$(basename "$i")"/bin
172-
chmod +x "$i"
173-
cp $i tests/"$(basename "$i")"/bin
174-
done
152+
175153
pushd tests
176-
renode-test -t all_tests.yaml
154+
renode-test -t all_tests.yaml
177155
popd

west.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
manifest:
2+
remotes:
3+
- name: zephyrproject-rtos
4+
url-base: https://github.com/zephyrproject-rtos
5+
6+
projects:
7+
- name: zephyr
8+
remote: zephyrproject-rtos
9+
revision: v4.3.0
10+
import:
11+
name-allowlist:
12+
- cmsis_6
13+
- hal_stm32

0 commit comments

Comments
 (0)