Skip to content

Commit 1addf6a

Browse files
committed
ci: try another way
1 parent 4171665 commit 1addf6a

1 file changed

Lines changed: 38 additions & 54 deletions

File tree

.github/workflows/build.yml

Lines changed: 38 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -93,36 +93,34 @@ jobs:
9393
run: |
9494
git fetch origin $ATF_BRANCH --depth=1
9595
96-
- &build_boot
97-
env:
98-
BOARD: ${{ matrix.board }}
99-
ATF: ${{ matrix.atf }}
100-
RAM8G: ${{ matrix.ram8g }}
96+
- name: Init build helpers
97+
shell: bash
10198
run: |
102-
set -e
99+
build_boot() {
100+
BOOT="$1"
101+
set -euo pipefail
103102
104-
for boot in ${{ matrix.boots }}; do
105103
echo "::group::${boot}"
106104
echo "===================================="
107-
echo "Building ${BOARD} for ${BOOT}
105+
echo "Building ${BOARD} for ${BOOT}"
108106
echo "===================================="
109107
110108
git checkout $UBOOT_BRANCH
111109
112-
printf "board=%s\ndevice=%s\n" "${BOARD}" "${BOOT}" > build.conf
110+
echo "board=${{ matrix.board }}\ndevice=${BOOT}\n" > build.conf
113111
114112
bash build.sh importconfig
115113
bash build.sh build
116114
bash build.sh rename
117115
118116
# ATF builds (optional)
119-
if [ "${ATF}" = "true" ]; then
117+
if [ "${{ matrix.atf }}" = "true" ]; then
120118
git checkout build.conf
121-
echo "---- ATF build for $boot ----"
119+
echo "---- ATF build for ${BOOT} ----"
122120
123121
git checkout $ATF_BRANCH
124122
125-
echo -e "board=${{ matrix.board }}\ndevice=$boot" > build.conf
123+
echo -e "board=${{ matrix.board }}\ndevice=${BOOT}" > build.conf
126124
127125
# normal ATF build
128126
bash build.sh build
@@ -132,7 +130,7 @@ jobs:
132130
bash build.sh createimg non-interactive
133131
fi
134132
135-
if [ "${RAM8G}" == "true" ]; then
133+
if [ "${{ matrix.ram8g }}" == "true" ]; then
136134
echo "extraflags=DDR4_4BG_MODE=1" >> build.conf
137135
bash build.sh build
138136
bash build.sh rename
@@ -144,7 +142,7 @@ jobs:
144142
bash build.sh build
145143
bash build.sh rename
146144
147-
if [ "${RAM8G}" == "true" ]; then
145+
if [ "${{ matrix.ram8g }}" == "true" ]; then
148146
echo "extraflags=UBI=1 DDR4_4BG_MODE=1" >> build.conf
149147
bash build.sh build
150148
bash build.sh rename
@@ -161,52 +159,38 @@ jobs:
161159
git checkout build.conf
162160
fi
163161
echo "::endgroup::"
164-
done
162+
}
163+
export -f build_boot
165164
166-
- <<: *build_boot
167-
name: Build sdmmc
165+
- name: Build sdmmc
168166
if: contains(matrix.boots, 'sdmmc')
169-
env:
170-
BOARD: ${{ matrix.board }}
171-
ATF: ${{ matrix.atf }}
172-
RAM8G: ${{ matrix.ram8g }}
173-
BOOT: sdmmc
174-
175-
- <<: *build_boot
176-
name: Build emmc
167+
shell: bash
168+
run: |
169+
build_boot sdmmc
170+
171+
- name: Build emmc
177172
if: contains(matrix.boots, 'emmc')
178-
env:
179-
BOARD: ${{ matrix.board }}
180-
ATF: ${{ matrix.atf }}
181-
RAM8G: ${{ matrix.ram8g }}
182-
BOOT: emmc
183-
184-
- <<: *build_boot
185-
name: Build spi-nand
173+
shell: bash
174+
run: |
175+
build_boot emmc
176+
177+
- name: Build spi-nand
186178
if: contains(matrix.boots, 'spi-nand')
187-
env:
188-
BOARD: ${{ matrix.board }}
189-
ATF: ${{ matrix.atf }}
190-
RAM8G: ${{ matrix.ram8g }}
191-
BOOT: spi-nand
192-
193-
- <<: *build_boot
194-
name: Build spi-nor
179+
shell: bash
180+
run: |
181+
build_boot spi-nand
182+
183+
- name: Build spi-nor
195184
if: contains(matrix.boots, 'spi-nor')
196-
env:
197-
BOARD: ${{ matrix.board }}
198-
ATF: ${{ matrix.atf }}
199-
RAM8G: ${{ matrix.ram8g }}
200-
BOOT: spi-nor
201-
202-
- <<: *build_boot
203-
name: Build ram
185+
shell: bash
186+
run: |
187+
build_boot spi-nor
188+
189+
- name: Build ram
204190
if: contains(matrix.boots, 'ram')
205-
env:
206-
BOARD: ${{ matrix.board }}
207-
ATF: ${{ matrix.atf }}
208-
RAM8G: ${{ matrix.ram8g }}
209-
BOOT: ram
191+
shell: bash
192+
run: |
193+
build_boot ram
210194
211195
- name: Upload artifacts
212196
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)