Skip to content

Commit c4355a7

Browse files
committed
Skip openocd if git2cl clone is failing
1 parent 76c579e commit c4355a7

File tree

3 files changed

+40
-16
lines changed

3 files changed

+40
-16
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
with:
5959
ssh-private-key: ${{ secrets.SSH_KEY }}
6060
- name: Build
61-
run: SKIP_RISCV=0 ./build_macos.sh
61+
run: ./build_macos.sh
6262
- name: Upload Artifact
6363
uses: actions/upload-artifact@v4
6464
with:
@@ -97,7 +97,7 @@ jobs:
9797
with:
9898
ssh-private-key: ${{ secrets.SSH_KEY }}
9999
- name: Build
100-
run: SKIP_RISCV=0 ./build_linux.sh
100+
run: ./build_linux.sh
101101
- name: Upload Artifact
102102
uses: actions/upload-artifact@v4
103103
with:

build_linux.sh

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
set -euo pipefail
44

5+
# Defaults
6+
SKIP_RISCV=${SKIP_RISCV-0}
7+
if git clone https://git.savannah.nongnu.org/git/git2cl.git; then
8+
SKIP_OPENOCD=${SKIP_OPENOCD-0}
9+
else
10+
# Clone is failing, so skip build
11+
echo "Skipping openocd build, as likely to fail"
12+
SKIP_OPENOCD=${SKIP_OPENOCD-1}
13+
fi
14+
515
# Install prerequisites
616
sudo apt install -y jq cmake libtool automake libusb-1.0-0-dev libhidapi-dev libftdi1-dev
717
# Risc-V prerequisites
@@ -36,7 +46,9 @@ if [[ "$SKIP_RISCV" != 1 ]]; then
3646
# Takes ages to build
3747
../packages/linux/riscv/build-riscv-gcc.sh
3848
fi
39-
../packages/linux/openocd/build-openocd.sh
49+
if [[ "$SKIP_OPENOCD" != 1 ]]; then
50+
../packages/linux/openocd/build-openocd.sh
51+
fi
4052
../packages/linux/picotool/build-picotool.sh
4153
cd ..
4254

@@ -64,21 +76,23 @@ pushd "$builddir/picotool-install/"
6476
tar -a -cf "$topd/bin/$filename" * .keep
6577
popd
6678

67-
# Package OpenOCD separately as well
79+
if [[ "$SKIP_OPENOCD" != 1 ]]; then
80+
# Package OpenOCD separately as well
6881

69-
version=($("./$builddir/openocd-install/usr/local/bin/openocd" --version 2>&1))
70-
version=${version[0]}
71-
version=${version[3]}
72-
version=$(echo $version | cut -d "-" -f 1)
82+
version=($("./$builddir/openocd-install/usr/local/bin/openocd" --version 2>&1))
83+
version=${version[0]}
84+
version=${version[3]}
85+
version=$(echo $version | cut -d "-" -f 1)
7386

74-
echo "OpenOCD version $version"
87+
echo "OpenOCD version $version"
7588

76-
filename="openocd-${version}-${suffix}.tar.gz"
89+
filename="openocd-${version}-${suffix}.tar.gz"
7790

78-
echo "Saving OpenOCD package to $filename"
79-
pushd "$builddir/openocd-install/usr/local/bin"
80-
tar -a -cf "$topd/bin/$filename" * -C "../share/openocd" "scripts"
81-
popd
91+
echo "Saving OpenOCD package to $filename"
92+
pushd "$builddir/openocd-install/usr/local/bin"
93+
tar -a -cf "$topd/bin/$filename" * -C "../share/openocd" "scripts"
94+
popd
95+
fi
8296

8397
if [[ "$SKIP_RISCV" != 1 ]]; then
8498
# Package riscv toolchain separately as well

build_macos.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
set -euo pipefail
44

5+
# Defaults
6+
SKIP_RISCV=${SKIP_RISCV-0}
7+
if git clone https://git.savannah.nongnu.org/git/git2cl.git; then
8+
SKIP_OPENOCD=${SKIP_OPENOCD-0}
9+
else
10+
# Clone is failing, so skip build
11+
echo "Skipping openocd build, as likely to fail"
12+
SKIP_OPENOCD=${SKIP_OPENOCD-1}
13+
fi
14+
515
# Install prerequisites
616
arch -x86_64 /usr/local/bin/brew install jq libtool libusb automake hidapi
717
arch -arm64 /opt/homebrew/bin/brew install jq libtool libusb automake hidapi
@@ -47,7 +57,7 @@ if [[ "$SKIP_RISCV" != 1 ]]; then
4757
# Takes ages to build
4858
../packages/macos/riscv/build-riscv-gcc.sh
4959
fi
50-
if [[ $(uname -m) == 'arm64' ]]; then
60+
if [[ "$SKIP_OPENOCD" != 1 ]] && [[ $(uname -m) == 'arm64' ]]; then
5161
../packages/macos/openocd/build-openocd.sh
5262
fi
5363
arch -x86_64 ../packages/macos/picotool/build-picotool.sh
@@ -78,7 +88,7 @@ pushd "$builddir/picotool-install/"
7888
tar -a -cf "$topd/bin/$filename" * .keep
7989
popd
8090

81-
if [[ $(uname -m) == 'arm64' ]]; then
91+
if [[ "$SKIP_OPENOCD" != 1 ]] && [[ $(uname -m) == 'arm64' ]]; then
8292
# Package OpenOCD separately as well
8393

8494
version=($("./$builddir/openocd-install/usr/local/bin/openocd" --version 2>&1))

0 commit comments

Comments
 (0)