Skip to content

Commit dcc65e6

Browse files
committed
ci: split "build-and-test-examples" to reduce runtime
1 parent bb6bdb2 commit dcc65e6

2 files changed

Lines changed: 114 additions & 121 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: "[Workflow Call]Host Build and QEMU run"
19+
20+
on:
21+
workflow_call:
22+
inputs:
23+
runs-on:
24+
required: true
25+
type: string
26+
container:
27+
required: true
28+
type: string
29+
std:
30+
required: true
31+
type: boolean
32+
ta_arch:
33+
required: true
34+
type: string
35+
36+
defaults:
37+
run:
38+
shell: bash
39+
40+
jobs:
41+
# compile on host and run tests in QEMU
42+
build-and-test-examples:
43+
env:
44+
# Setup the env for the build, currently our QEMU image only support
45+
# aarch64 CA
46+
ARCH_HOST: aarch64
47+
ARCH_TA: ${{ inputs.ta_arch }}
48+
OPTEE_DIR: /tmp/optee
49+
runs-on: ${{ inputs.runs-on }}
50+
container: ${{ inputs.container }}
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
# Setup Rust and toolchains
55+
- name: Setup
56+
run: |
57+
./setup.sh
58+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
59+
# Setup std dependencies
60+
- name: Setup STD
61+
if: ${{ inputs.std }}
62+
run: |
63+
./setup_std_dependencies.sh
64+
echo "STD=y" >> $GITHUB_ENV
65+
66+
- name: Build
67+
run: |
68+
# print the env
69+
env
70+
# Build optee_os and optee_client for qemu_v8
71+
mkdir -p $OPTEE_DIR
72+
./build_optee_libraries.sh $OPTEE_DIR
73+
# Setup environment
74+
source environment
75+
if [ "${{ inputs.std }}" == "true" ]; then
76+
make std-examples -j2
77+
(cd projects/web3/eth_wallet && make)
78+
else
79+
make no-std-examples -j2
80+
fi
81+
- name: Run
82+
run: |
83+
source environment
84+
(cd ci && ./ci.sh)

.github/workflows/reuse_test.yml

Lines changed: 30 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
name: "[Workflow Call]Test"
19+
1820
on:
1921
workflow_call:
2022
inputs:
@@ -63,127 +65,34 @@ jobs:
6365
(cd optee-utee && cargo clippy --target aarch64-unknown-linux-gnu -- -D warnings)
6466
(cd optee-teec && cargo clippy --target aarch64-unknown-linux-gnu -- -D warnings)
6567

66-
# Cross-compile on host and run tests in QEMU
67-
#
68-
# Cross-compile target pairs:
69-
# - (arm32 host, arm32 ta)
70-
# - (arm32 host, arm64 ta)
71-
# - (arm64 host, arm32 ta)
72-
# - (arm64 host, arm64 ta)
73-
#
74-
# Run tests target: (arm64 host, arm64 ta)
75-
build-and-test-examples:
76-
runs-on: ${{ inputs.runs-on }}
77-
container: ${{ inputs.container }}
78-
steps:
79-
- name: Checkout repository
80-
uses: actions/checkout@v4
81-
- name: Building
82-
run: |
83-
# Setup Rust and toolchains
84-
./setup.sh
85-
source "$HOME/.cargo/env"
86-
87-
# Build optee_os and optee_client for qemu_v8
88-
./build_optee_libraries.sh $HOME
89-
export OPTEE_DIR=$HOME
90-
91-
# Build OP-TEE Rust examples for Arm 32-bit both host and TA
92-
export ARCH_HOST=arm
93-
export ARCH_TA=arm
94-
source environment
95-
make examples -j`nproc`
68+
build-and-test-examples-for-32bit-no-std-TAs:
69+
uses: ./.github/workflows/reuse_host_build_and_qemu_run.yml
70+
with:
71+
runs-on: ${{ inputs.runs-on }}
72+
container: ${{ inputs.container }}
73+
std: false
74+
ta_arch: arm
75+
76+
build-and-test-examples-for-64bit-no-std-TAs:
77+
uses: ./.github/workflows/reuse_host_build_and_qemu_run.yml
78+
with:
79+
runs-on: ${{ inputs.runs-on }}
80+
container: ${{ inputs.container }}
81+
std: false
82+
ta_arch: aarch64
9683

97-
# Build OP-TEE Rust examples for Arm 32-bit host and 64-bit TA
98-
export ARCH_HOST=arm
99-
unset ARCH_TA
100-
source environment
101-
make clean && make examples -j`nproc`
102-
103-
# Build OP-TEE Rust examples for Arm 64-bit host and 32-bit TA
104-
unset ARCH_HOST
105-
export ARCH_TA=arm
106-
source environment
107-
make clean && make examples -j`nproc`
108-
109-
# Build OP-TEE Rust examples for Arm 64-bit both host and TA
110-
unset ARCH_TA
111-
unset ARCH_HOST
112-
source environment
113-
make clean && make examples -j`nproc`
114-
- name: Run tests for Arm 64-bit both host and TA
115-
run: |
116-
source environment
117-
(cd ci && ./ci.sh)
118-
119-
# Cross-compile for ARM64 on host and run tests in QEMU
120-
build-and-test-examples-for-64bit-std-TAs:
121-
runs-on: ${{ inputs.runs-on }}
122-
container: ${{ inputs.container }}
123-
steps:
124-
- name: Checkout repository
125-
uses: actions/checkout@v4
126-
- name: Building Arm 64-bit both host and TA (with STD enabled)
127-
run: |
128-
# Setup Rust and toolchains
129-
./setup.sh
130-
source "$HOME/.cargo/env"
131-
132-
# Setup std dependencies
133-
./setup_std_dependencies.sh
134-
135-
# Build optee_os and optee_client for qemu_v8
136-
./build_optee_libraries.sh $HOME
137-
138-
# Setup environment
139-
export OPTEE_DIR=$HOME
140-
export STD=y
141-
source environment
142-
143-
# Build OP-TEE Rust examples for Arm 64-bit both host and TA
144-
make std-examples -j2
145-
146-
# Build project
147-
(cd projects/web3/eth_wallet && make)
148-
- name: Run tests for Arm 64-bit both host and TA
149-
run: |
150-
export STD=y
151-
source environment
152-
(cd ci && ./ci.sh)
153-
154-
# Cross-compile for ARM32 on host and run tests in QEMU
15584
build-and-test-examples-for-32bit-std-TAs:
156-
runs-on: ${{ inputs.runs-on }}
157-
container: ${{ inputs.container }}
158-
steps:
159-
- name: Checkout repository
160-
uses: actions/checkout@v4
161-
- name: Building Arm 64-bit both host and TA (with STD enabled)
162-
run: |
163-
# Setup Rust and toolchains
164-
./setup.sh
165-
source "$HOME/.cargo/env"
166-
167-
# Setup std dependencies
168-
./setup_std_dependencies.sh
169-
170-
# Build optee_os and optee_client for qemu_v8
171-
./build_optee_libraries.sh $HOME
85+
uses: ./.github/workflows/reuse_host_build_and_qemu_run.yml
86+
with:
87+
runs-on: ${{ inputs.runs-on }}
88+
container: ${{ inputs.container }}
89+
std: true
90+
ta_arch: arm
17291

173-
# Setup environment
174-
export OPTEE_DIR=$HOME
175-
export ARCH_TA=arm
176-
export STD=y
177-
source environment
178-
179-
# Build OP-TEE Rust examples for Arm 64-bit both host and TA
180-
make std-examples -j2
181-
182-
# Build project
183-
(cd projects/web3/eth_wallet && make)
184-
- name: Run tests for Arm 32-bit both host and TA
185-
run: |
186-
export ARCH_TA=arm
187-
export STD=y
188-
source environment
189-
(cd ci && ./ci.sh)
92+
build-and-test-examples-for-64bit-std-TAs:
93+
uses: ./.github/workflows/reuse_host_build_and_qemu_run.yml
94+
with:
95+
runs-on: ${{ inputs.runs-on }}
96+
container: ${{ inputs.container }}
97+
std: true
98+
ta_arch: aarch64

0 commit comments

Comments
 (0)