Skip to content

Commit 7fc0123

Browse files
committed
Fix jimtcl library issues, create universal MacOS builds of everything, and add tests
Fix library issues by switching back to building jimtcl inside openocd Make all builds on MacOS universal, built on an arm64 runner Add run tests of builds on clean systems, to check for missed libraries
1 parent c101485 commit 7fc0123

File tree

8 files changed

+237
-154
lines changed

8 files changed

+237
-154
lines changed

.github/workflows/build.yml

Lines changed: 96 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,11 @@ env:
1212
jobs:
1313
build_windows:
1414
name: Build Windows
15-
# runs-on: [self-hosted, Windows, x64]
1615
runs-on: 'windows-latest'
1716

1817
steps:
1918
- name: Checkout
2019
uses: actions/checkout@v4
21-
# - name: Setup SSH Auth
22-
# if: runner.environment == 'github-hosted'
23-
# uses: webfactory/[email protected]
24-
# with:
25-
# ssh-private-key: ${{ secrets.SSH_KEY }}
2620
- name: Setup MSYS2
2721
uses: msys2/setup-msys2@v2
2822
- name: Build
@@ -33,7 +27,7 @@ jobs:
3327
- name: Upload Artifact
3428
uses: actions/upload-artifact@v4
3529
with:
36-
name: tools-x64-win
30+
name: tools-win-${{ runner.arch }}
3731
path: |
3832
bin/picotool-*-x64-win.zip
3933
bin/pico-sdk-tools-*-x64-win.zip
@@ -49,38 +43,41 @@ jobs:
4943
bin/openocd-*-x64-win.zip
5044
bin/riscv-toolchain-*-x64-win.zip
5145
52-
build_macos_arm64:
53-
name: Build MacOS Arm64
54-
# runs-on: [self-hosted, macOS]
46+
build_macos:
47+
name: Build MacOS
5548
runs-on: 'macos-14'
5649

5750
steps:
5851
- name: Checkout
5952
uses: actions/checkout@v4
60-
- name: Set up Homebrew
61-
if: runner.environment == 'github-hosted'
53+
- name: Set up arm64 Homebrew
6254
id: set-up-homebrew
6355
uses: Homebrew/actions/setup-homebrew@master
56+
- name: Build arm64
57+
run: ./build_macos.sh
58+
- name: Uninstall arm64 Homebrew
59+
run: |
60+
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
61+
rm -rf /opt/homebrew || true
6462
- name: Set up x86_64 Homebrew
65-
if: runner.environment == 'github-hosted'
6663
run: |
6764
NONINTERACTIVE=1 arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
68-
# - name: Setup SSH Auth
69-
# if: runner.environment == 'github-hosted'
70-
# uses: webfactory/[email protected]
71-
# with:
72-
# ssh-private-key: ${{ secrets.SSH_KEY }}
73-
- name: Build
74-
run: ./build_macos.sh
65+
- name: Install x86_64 pkg-config & cmake
66+
run: |
67+
arch -x86_64 /usr/local/bin/brew install pkg-config cmake
68+
- name: Build x86_64
69+
run: arch -x86_64 ./build_macos.sh
70+
- name: Merge Universal Binaries
71+
run: ./merge_macos.sh
7572
- name: Upload Artifact
7673
uses: actions/upload-artifact@v4
7774
with:
78-
name: tools-mac-arm64
75+
name: tools-mac-universal
7976
path: |
8077
bin/picotool-*-mac.zip
8178
bin/pico-sdk-tools-*-mac.zip
8279
bin/openocd-*-mac.zip
83-
bin/riscv-toolchain-*.zip
80+
bin/riscv-toolchain-*-mac.zip
8481
- name: Add Release Asset
8582
uses: softprops/action-gh-release@v2
8683
if: startsWith(github.ref, 'refs/tags/')
@@ -89,57 +86,19 @@ jobs:
8986
bin/picotool-*-mac.zip
9087
bin/pico-sdk-tools-*-mac.zip
9188
bin/openocd-*-mac.zip
92-
bin/riscv-toolchain-*.zip
93-
94-
build_macos_x64:
95-
name: Build MacOS x64
96-
runs-on: 'macos-13'
97-
env:
98-
# Universal picotool is built on arm64
99-
SKIP_PICOTOOL: 1
100-
101-
steps:
102-
- name: Checkout
103-
uses: actions/checkout@v4
104-
- name: Set up Homebrew
105-
if: runner.environment == 'github-hosted'
106-
id: set-up-homebrew
107-
uses: Homebrew/actions/setup-homebrew@master
108-
- name: Build
109-
run: ./build_macos.sh
110-
- name: Upload Artifact
111-
uses: actions/upload-artifact@v4
112-
with:
113-
name: tools-mac-x64
114-
path: |
115-
bin/openocd-*-mac.zip
116-
bin/riscv-toolchain-*.zip
117-
- name: Add Release Asset
118-
uses: softprops/action-gh-release@v2
119-
if: startsWith(github.ref, 'refs/tags/')
120-
with:
121-
files: |
122-
bin/openocd-*-mac.zip
123-
bin/riscv-toolchain-*.zip
89+
bin/riscv-toolchain-*-mac.zip
12490
12591
build_linux:
12692
name: Build Linux
127-
# strategy:
128-
# matrix:
129-
# os: [[self-hosted, linux, x64], [self-hosted, linux, arm64]]
13093
strategy:
94+
fail-fast: false
13195
matrix:
132-
os: [ubuntu-22.04, [self-hosted, linux, arm64]]
96+
os: [ubuntu-22.04, [self-hosted, linux, arm64, bookworm, 8G]]
13397
runs-on: ${{ matrix.os }}
13498

13599
steps:
136100
- name: Checkout
137101
uses: actions/checkout@v4
138-
# - name: Setup SSH Auth
139-
# if: runner.environment == 'github-hosted'
140-
# uses: webfactory/[email protected]
141-
# with:
142-
# ssh-private-key: ${{ secrets.SSH_KEY }}
143102
- name: Build
144103
run: ./build_linux.sh
145104
- name: Upload Artifact
@@ -161,3 +120,77 @@ jobs:
161120
bin/openocd-*-lin.tar.gz
162121
bin/riscv-toolchain-*-lin.tar.gz
163122
123+
test_binaries:
124+
name: Test Binaries
125+
needs: [build_linux, build_macos, build_windows]
126+
if: always() && contains(needs.*.result, 'success')
127+
strategy:
128+
fail-fast: false
129+
matrix:
130+
# Test all GitHub supported versions, except for windows-11-arm
131+
os: [macos-15, macos-15-intel, macos-14, windows-2025, windows-2022, windows-11-arm, ubuntu-24.04, ubuntu-22.04, ubuntu-24.04-arm, ubuntu-22.04-arm, [self-hosted, linux, arm64, trixie_desktop], [self-hosted, linux, arm64, bookworm_desktop]]
132+
runs-on: ${{ matrix.os }}
133+
steps:
134+
- name: Download build (Windows)
135+
if: runner.os == 'Windows'
136+
uses: actions/download-artifact@v5
137+
with:
138+
# Only built for x64, but arm should still run it fine
139+
name: tools-win-X64
140+
- name: Download build (MacOS)
141+
if: runner.os == 'macOS'
142+
uses: actions/download-artifact@v5
143+
with:
144+
name: tools-mac-universal
145+
- name: Download build (Linux)
146+
if: runner.os == 'Linux'
147+
uses: actions/download-artifact@v5
148+
with:
149+
name: tools-lin-${{ runner.arch }}
150+
151+
- name: Extract build (zip)
152+
if: runner.os == 'Windows' || runner.os == 'macOS'
153+
shell: bash # Windows only has unzip in bash shell
154+
run: |
155+
unzip -o pico-sdk-tools*.zip
156+
ls
157+
unzip -o picotool*.zip
158+
ls
159+
unzip -o openocd*.zip || true
160+
ls
161+
unzip -o riscv-toolchain*.zip || true
162+
ls
163+
- name: Extract build (tar.gz)
164+
if: runner.os == 'Linux'
165+
run: |
166+
tar -xvf pico-sdk-tools*.tar.gz
167+
ls
168+
tar -xvf picotool*.tar.gz
169+
ls
170+
tar -xvf openocd*.tar.gz || true
171+
ls
172+
tar -xvf riscv-toolchain*.tar.gz || true
173+
ls
174+
175+
- name: Clean runner (MacOS)
176+
if: runner.os == 'macOS'
177+
run: |
178+
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
179+
- name: Install prerequisites (Ubuntu)
180+
if: runner.os == 'Linux' && runner.environment == 'github-hosted'
181+
run: sudo apt install libftdi1-2 libhidapi-hidraw0
182+
183+
- name: Test default stuff runs
184+
run: |
185+
./picotool/picotool version
186+
./pioasm/pioasm --version
187+
- name: Test openocd runs
188+
if: env.SKIP_OPENOCD != 1
189+
run: |
190+
./openocd --version
191+
- name: Test riscv-toolchain runs
192+
if: env.SKIP_RISCV != 1
193+
run: |
194+
./bin/riscv32-unknown-elf-gcc --version
195+
./bin/riscv32-unknown-elf-gdb --version
196+

build_linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SKIP_RISCV=${SKIP_RISCV-0}
77
SKIP_OPENOCD=${SKIP_OPENOCD-0}
88

99
# Install prerequisites
10-
sudo apt install -y jq cmake libtool automake libusb-1.0-0-dev libhidapi-dev libftdi1-dev libjim-dev patchelf
10+
sudo apt install -y jq cmake libtool automake libusb-1.0-0-dev libhidapi-dev libftdi1-dev patchelf
1111
# RISC-V prerequisites
1212
sudo apt install -y autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev ninja-build git cmake libglib2.0-dev libslirp-dev
1313
# RPi Only prerequisites

build_macos.sh

Lines changed: 10 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ SKIP_RISCV=${SKIP_RISCV-0}
77
SKIP_OPENOCD=${SKIP_OPENOCD-0}
88
SKIP_PICOTOOL=${SKIP_PICOTOOL-0}
99

10+
echo "Running on $(uname -m)"
11+
1012
# Install prerequisites
11-
arch -x86_64 /usr/local/bin/brew install jq libtool libusb automake hidapi jimtcl --quiet
1213
if [[ $(uname -m) == 'arm64' ]]; then
13-
arch -arm64 /opt/homebrew/bin/brew install jq libtool libusb automake hidapi jimtcl --quiet
14+
arch -arm64 /opt/homebrew/bin/brew install jq libtool libusb automake hidapi --quiet
15+
else
16+
arch -x86_64 /usr/local/bin/brew install jq libtool libusb automake hidapi --quiet
1417
fi
1518
# RISC-V prerequisites
1619
echo "Listing local"
@@ -19,9 +22,10 @@ rm /usr/local/bin/2to3* || true
1922
rm /usr/local/bin/idle3* || true
2023
rm /usr/local/bin/pip* || true
2124
rm /usr/local/bin/py* || true
22-
arch -x86_64 /usr/local/bin/brew install python3 gawk gnu-sed make gmp mpfr libmpc isl zlib expat texinfo flock libslirp --quiet
2325
if [[ $(uname -m) == 'arm64' ]]; then
24-
arch -arm64 /opt/homebrew/bin/brew install python3 gawk gnu-sed make gmp mpfr libmpc isl zlib expat texinfo flock libslirp --quiet
26+
arch -arm64 /opt/homebrew/bin/brew install python3 gawk gnu-sed make gmp mpfr libmpc isl zlib expat texinfo flock libslirp --quiet
27+
else
28+
arch -x86_64 /usr/local/bin/brew install python3 gawk gnu-sed make gmp mpfr libmpc isl zlib expat texinfo flock libslirp --quiet
2529
fi
2630

2731
repos=$(cat config/repositories.json | jq -c '.repositories.[]')
@@ -76,82 +80,10 @@ if [[ "$SKIP_RISCV" != 1 ]]; then
7680
echo "RISC-V dylibs copied"
7781
fi
7882
if [[ "$SKIP_PICOTOOL" != 1 ]]; then
79-
arch -x86_64 ../packages/macos/picotool/build-picotool.sh
80-
if [[ $(uname -m) == 'arm64' ]]; then
81-
arch -arm64 ../packages/macos/picotool/build-picotool.sh
82-
fi
83+
../packages/macos/picotool/build-picotool.sh
8384
echo "Picotool Build Complete"
8485

85-
../packages/macos/get-dylibs.sh "picotool-install-x86_64"
86-
if [[ $(uname -m) == 'arm64' ]]; then
87-
../packages/macos/get-dylibs.sh "picotool-install-arm64"
88-
fi
86+
../packages/macos/get-dylibs.sh "picotool-install-$(uname -m)"
8987
echo "Picotool dylibs copied"
90-
91-
../packages/macos/make-universal.sh "pico-sdk-tools" "pioasm" "pioasm"
92-
echo "Pioasm Universal Merge Complete"
93-
../packages/macos/make-universal.sh "picotool-install" "picotool" "picotool"
94-
echo "Picotool Universal Merge Complete"
9588
fi
9689
cd ..
97-
98-
topd=$PWD
99-
100-
if [[ "$SKIP_PICOTOOL" != 1 ]]; then
101-
echo "Packaging picotool"
102-
if [ ${version:0:1} -ge 2 ]; then
103-
# Package pico-sdk-tools separately as well
104-
105-
filename="pico-sdk-tools-${version}-${suffix}.zip"
106-
107-
echo "Saving pico-sdk-tools package to $filename"
108-
pushd "$builddir/pico-sdk-tools/"
109-
tar -a -cf "$topd/bin/$filename" * .keep
110-
popd
111-
fi
112-
113-
# Package picotool separately as well
114-
version=$("./$builddir/picotool-install/picotool/picotool" version -s)
115-
echo "Picotool version $version"
116-
117-
filename="picotool-${version}-${suffix}.zip"
118-
119-
echo "Saving picotool package to $filename"
120-
pushd "$builddir/picotool-install/"
121-
tar -a -cf "$topd/bin/$filename" * .keep
122-
popd
123-
fi
124-
125-
if [[ "$SKIP_OPENOCD" != 1 ]]; then
126-
echo "Packaging OpenOCD"
127-
# Package OpenOCD separately as well
128-
129-
version=($("./$builddir/openocd-install-$(uname -m)/usr/local/bin/openocd" --version 2>&1))
130-
version=${version[0]}
131-
version=${version[3]}
132-
version=$(echo $version | cut -d "-" -f 1)
133-
134-
echo "OpenOCD version $version"
135-
136-
filename="openocd-${version}-$(uname -m)-${suffix}.zip"
137-
138-
echo "Saving OpenOCD package to $filename"
139-
pushd "$builddir/openocd-install-$(uname -m)/usr/local/bin"
140-
tar -a -cf "$topd/bin/$filename" * -C "../share/openocd" "scripts"
141-
popd
142-
fi
143-
144-
if [[ "$SKIP_RISCV" != 1 ]]; then
145-
echo "Packaging RISC-V Toolchain"
146-
# Package riscv toolchain separately as well
147-
version=$("./$builddir/riscv-install-$(uname -m)/bin/riscv32-unknown-elf-gcc" -dumpversion)
148-
version=$(echo $version | cut -d "." -f 1)
149-
echo "Risc-V Toolchain version $version"
150-
151-
filename="riscv-toolchain-${version}-$(uname -m)-${suffix}.zip"
152-
153-
echo "Saving RISC-V Toolchain package to $filename"
154-
pushd "$builddir/riscv-install-$(uname -m)/"
155-
tar -a -cf "$topd/bin/$filename" *
156-
popd
157-
fi

0 commit comments

Comments
 (0)