Skip to content

Commit 96d7816

Browse files
committed
GHA: Cache built gdb executable
1 parent e1a99af commit 96d7816

2 files changed

Lines changed: 41 additions & 13 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build gdb from source
2+
inputs:
3+
arch:
4+
required: true
5+
runs:
6+
using: composite
7+
steps:
8+
- name: Try to restore cached gdb executable
9+
uses: actions/cache@v4
10+
with:
11+
path: /usr/local/bin/gdb
12+
key: gdb-${{ inputs.arch }}
13+
14+
- shell: bash
15+
run: |
16+
set -eux
17+
18+
if [[ -f /usr/local/bin/gdb ]]; then
19+
echo "Already cached"
20+
exit 0
21+
fi
22+
23+
sudo apt-get -yq install libmpfr-dev
24+
25+
cd ..
26+
curl -fL --retry 3 --max-time 60 -O https://mirrors.ocf.berkeley.edu/gnu/gdb/gdb-16.2.tar.xz
27+
tar xf gdb-16.2.tar.xz
28+
29+
cd gdb-16.2
30+
./configure
31+
make -j$(nproc)
32+
sudo make install
33+
cd ..
34+
35+
rm -rf gdb-16.2 gdb-16.2.tar.xz
36+
37+
- shell: bash
38+
run: gdb --version

.github/workflows/main.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,9 @@ jobs:
153153
arch: ${{ matrix.arch }}
154154
- name: 'Ubuntu 22: Build recent gdb from source' # see https://github.com/ldc-developers/ldc/issues/4389
155155
if: startsWith(matrix.os, 'ubuntu-22.04')
156-
run: |
157-
set -eux
158-
cd ..
159-
sudo apt-get -yq install libmpfr-dev
160-
curl -fL --retry 3 --max-time 60 -O https://mirrors.ocf.berkeley.edu/gnu/gdb/gdb-16.2.tar.xz
161-
tar xf gdb-16.2.tar.xz
162-
cd gdb-16.2
163-
./configure
164-
make -j$(nproc)
165-
sudo make install
166-
cd ..
167-
rm -rf gdb-16.2 gdb-16.2.tar.xz
168-
gdb --version
156+
uses: ./.github/actions/helper-build-gdb
157+
with:
158+
arch: ${{ matrix.arch }}
169159
- name: Build bootstrap LDC
170160
if: runner.os != 'macOS'
171161
uses: ./.github/actions/2-build-bootstrap

0 commit comments

Comments
 (0)