Skip to content

Commit bc6223a

Browse files
committed
test reuse workflow subdir
1 parent 9929b31 commit bc6223a

File tree

2 files changed

+77
-51
lines changed

2 files changed

+77
-51
lines changed

.github/workflows/sophgo-sg204x.yml

Lines changed: 19 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,56 +8,24 @@ on:
88

99
jobs:
1010

11-
build-zsbl:
12-
name: Build ZSBL
13-
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
include:
17-
- target_name: sophgo-sg2044-srd3-10
18-
zsbl_defconfig: sg2044_defconfig
19-
- target_name: sophgo-sg2042-milkv-pioneer
20-
zsbl_defconfig: sg2042_defconfig
21-
env:
22-
ZSBL_COMMIT_ID: 45054e711d81fbfa1c2167829402d26795199ae7
23-
steps:
24-
- name: Cache ZSBL Build
25-
id: cache-zsbl-build
26-
uses: actions/cache@v5
27-
with:
28-
path: dist
29-
key: cache-zsbl-build-${{ matrix.target_name }}-${{ env.ZSBL_COMMIT_ID }}
30-
- uses: actions/checkout@v5
31-
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
32-
- name: Setup Toolchains
33-
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
34-
id: setup-gcc-toolchain
35-
uses: ./.github/actions/riscv64-gcc-toolchain
36-
- name: Checkout ZSBL
37-
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
38-
uses: actions/checkout@v6
39-
with:
40-
repository: revyos/zsbl
41-
path: zsbl
42-
# Branch sg204x as of 20260224
43-
ref: ${{ env.ZSBL_COMMIT_ID }}
44-
fetch-depth: 1
45-
- name: Build ZSBL
46-
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
47-
working-directory: zsbl
48-
run: |
49-
make -j"$(nproc)" CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} "${{ matrix.zsbl_defconfig }}"
50-
make -j"$(nproc)" CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} USE_LINUX_BOOT=1 zsbl.bin
51-
- name: Collect ZSBL Binary
52-
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
53-
run: |
54-
mkdir dist
55-
cp zsbl/zsbl.bin dist/zsbl.bin
56-
- name: Upload Artifacts
57-
uses: actions/upload-artifact@v4
58-
with:
59-
name: "zsbl-${{ matrix.target_name }}"
60-
path: dist
11+
build-zsbl-sg2042:
12+
name: Build ZSBL for SG2042
13+
uses: ./.github/workflows/sophgo-sg204x/zsbl-build.yml
14+
with:
15+
target_name: sophgo-sg2042
16+
zsbl_repo: revyos/zsbl
17+
# Branch sg204x as of 20260227
18+
zsbl_ref: 45054e711d81fbfa1c2167829402d26795199ae7
19+
zsbl_defconfig: sg2042_defconfig
20+
build-zsbl-sg2044:
21+
name: Build ZSBL for SG2044
22+
uses: ./.github/workflows/sophgo-sg204x/zsbl-build.yml
23+
with:
24+
target_name: sophgo-sg2044
25+
zsbl_repo: revyos/zsbl
26+
# Branch sg204x as of 20260227
27+
zsbl_ref: 45054e711d81fbfa1c2167829402d26795199ae7
28+
zsbl_defconfig: sg2044_defconfig
6129

6230
build-opensbi:
6331
name: Build OpenSBI
@@ -216,7 +184,7 @@ jobs:
216184
pack-sdimage-sg2042:
217185
name: Pack SD Card Boot Image for SG2042
218186
needs:
219-
- build-zsbl
187+
- build-zsbl-sg2042
220188
- build-opensbi
221189
- build-u-root
222190
- build-kernel
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build ZSBL
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
target_name:
7+
required: true
8+
type: string
9+
zsbl_repo:
10+
required: true
11+
type: string
12+
zsbl_ref:
13+
required: true
14+
type: string
15+
zsbl_defconfig:
16+
required: true
17+
type: string
18+
19+
jobs:
20+
build-zsbl:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Cache ZSBL Build
24+
id: cache-zsbl-build
25+
uses: actions/cache@v5
26+
with:
27+
path: dist
28+
key: cache-zsbl-build-${{ inputs.target_name }}-${{ inputs.zsbl_ref }}
29+
- uses: actions/checkout@v5
30+
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
31+
- name: Setup Toolchains
32+
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
33+
id: setup-gcc-toolchain
34+
uses: ./.github/actions/riscv64-gcc-toolchain
35+
- name: Checkout ZSBL
36+
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
37+
uses: actions/checkout@v6
38+
with:
39+
repository: ${{ inputs.zsbl_repo }}
40+
path: zsbl
41+
ref: ${{ inputs.zsbl_ref }}
42+
fetch-depth: 1
43+
- name: Build ZSBL
44+
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
45+
working-directory: zsbl
46+
run: |
47+
make -j"$(nproc)" CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} "${{ inputs.zsbl_defconfig }}"
48+
make -j"$(nproc)" CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} USE_LINUX_BOOT=1 zsbl.bin
49+
- name: Collect ZSBL Binary
50+
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
51+
run: |
52+
mkdir dist
53+
cp zsbl/zsbl.bin dist/zsbl.bin
54+
- name: Upload Artifacts
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: "zsbl-${{ inputs.target_name }}"
58+
path: dist

0 commit comments

Comments
 (0)