Skip to content

Commit 1ba3895

Browse files
authored
Strip released binaries
1 parent 0930e55 commit 1ba3895

File tree

7 files changed

+135
-14
lines changed

7 files changed

+135
-14
lines changed

.github/matrix_includes_packchk.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,42 @@
33
"runs_on":"macos-13",
44
"target":"darwin",
55
"arch": "amd64",
6-
"runOn": "publicRepo"
6+
"runOn": "publicRepo",
7+
"binary": "packchk"
78
},
89
{
910
"runs_on":"macos-14",
1011
"target":"darwin",
1112
"arch": "arm64",
12-
"runOn": "publicRepo"
13+
"runOn": "publicRepo",
14+
"binary": "packchk"
1315
},
1416
{
1517
"runs_on":"ubuntu-22.04",
1618
"target":"linux",
1719
"arch": "amd64",
18-
"runOn": "always"
20+
"runOn": "always",
21+
"binary": "packchk"
1922
},
2023
{
2124
"runs_on":"ubuntu-22.04",
2225
"target":"linux",
2326
"arch": "arm64",
24-
"runOn": "always"
27+
"runOn": "always",
28+
"binary": "packchk"
2529
},
2630
{
2731
"runs_on":"windows-2019",
2832
"target":"windows",
2933
"arch": "amd64",
30-
"runOn": "always"
34+
"runOn": "always",
35+
"binary": "packchk.exe"
3136
},
3237
{
3338
"runs_on":"windows-2019",
3439
"target":"windows",
3540
"arch": "arm64",
36-
"runOn": "always"
41+
"runOn": "always",
42+
"binary": "packchk.exe"
3743
}
3844
]

.github/matrix_includes_svdconv.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,42 @@
33
"runs_on":"macos-13",
44
"target":"darwin",
55
"arch": "amd64",
6-
"runOn": "publicRepo"
6+
"runOn": "publicRepo",
7+
"binary": "svdconv"
78
},
89
{
910
"runs_on":"macos-14",
1011
"target":"darwin",
1112
"arch": "arm64",
12-
"runOn": "publicRepo"
13+
"runOn": "publicRepo",
14+
"binary": "svdconv"
1315
},
1416
{
1517
"runs_on":"ubuntu-22.04",
1618
"target":"linux",
1719
"arch": "amd64",
18-
"runOn": "always"
20+
"runOn": "always",
21+
"binary": "svdconv"
1922
},
2023
{
2124
"runs_on":"ubuntu-22.04",
2225
"target":"linux",
2326
"arch": "arm64",
24-
"runOn": "always"
27+
"runOn": "always",
28+
"binary": "svdconv"
2529
},
2630
{
2731
"runs_on":"windows-2019",
2832
"target":"windows",
2933
"arch": "amd64",
30-
"runOn": "always"
34+
"runOn": "always",
35+
"binary": "svdconv.exe"
3136
},
3237
{
3338
"runs_on":"windows-2019",
3439
"target":"windows",
3540
"arch": "arm64",
36-
"runOn": "always"
41+
"runOn": "always",
42+
"binary": "svdconv.exe"
3743
}
3844
]

.github/workflows/buildmgr.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ jobs:
8282
target: cbuildgen
8383
arch: ${{ matrix.arch }}
8484

85+
- name: Strip projmgr release binary
86+
if: |
87+
github.event_name == 'release' &&
88+
(startsWith(matrix.runs_on, 'macos') || startsWith(matrix.runs_on, 'ubuntu'))
89+
run: |
90+
binary_path="./build/tools/buildmgr/cbuildgen/${{ matrix.target }}-${{ matrix.arch }}/Release/cbuildgen${{ matrix.binary_extension }}"
91+
echo "Stripping binary at: $binary_path"
92+
strip "$binary_path"
93+
8594
- name: Archive cbuildgen
8695
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
8796
with:

.github/workflows/packchk.yml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,48 @@ jobs:
8888
retention-days: ${{ needs.setup.outputs.retention_days }}
8989
if-no-files-found: error
9090

91+
- name: Install strip tools
92+
if: |
93+
github.event_name == 'release' &&
94+
matrix.arch == 'arm64' &&
95+
startsWith(matrix.runs_on, 'ubuntu')
96+
run: |
97+
sudo apt-get update
98+
sudo apt-get install binutils-aarch64-linux-gnu
99+
100+
# Run only for release events on macOS or Ubuntu runners
101+
- name: Strip and bundle packchk release binary
102+
if: |
103+
github.event_name == 'release' &&
104+
(startsWith(matrix.runs_on, 'macos') || startsWith(matrix.runs_on, 'ubuntu'))
105+
shell: bash
106+
working-directory: build/tools/packchk/
107+
run: |
108+
mkdir -p packchk_release_bin
109+
110+
# Extract the binary tarball into the release directory
111+
tar -xvf packchk-*-${{ matrix.target }}-${{ matrix.arch }}.tbz2 -C packchk_release_bin
112+
113+
# Construct the path to the extracted binary
114+
binary_path="./packchk_release_bin/${{ matrix.binary }}"
115+
echo "Stripping binary at: $binary_path"
116+
117+
# Use appropriate strip tool based on architecture and target
118+
if [[ "${{ matrix.arch }}" == "arm64" && "${{ matrix.target }}" == "linux" ]]; then
119+
aarch64-linux-gnu-strip "$binary_path"
120+
else
121+
strip "$binary_path"
122+
fi
123+
124+
# Temporarily rename the original archive
125+
original_filename=$(find . -maxdepth 1 -type f -name "packchk-*-${{ matrix.target }}-${{ matrix.arch }}.tbz2" | head -n 1)
126+
mv "$original_filename" ./temp.tbz2
127+
128+
# Repack the modified binary into a new tarball
129+
output_name=$(basename "$original_filename")
130+
echo "Repacking into: $output_name"
131+
tar -cjf "$output_name" -C packchk_release_bin .
132+
91133
- name: Attach zipped binary to the release
92134
if: ${{ github.event_name == 'release' }}
93135
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
@@ -185,8 +227,7 @@ jobs:
185227
- name: Install dependencies
186228
run: |
187229
sudo apt-get update
188-
sudo apt-get install \
189-
lcov
230+
sudo apt-get install lcov
190231
191232
- name: Checkout devtools
192233
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

.github/workflows/packgen.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ jobs:
7575
target: packgen
7676
arch: ${{ matrix.arch }}
7777

78+
- name: Strip packgen release binary
79+
if: |
80+
github.event_name == 'release' &&
81+
(startsWith(matrix.runs_on, 'macos') || startsWith(matrix.runs_on, 'ubuntu'))
82+
run: |
83+
binary_path="./build/tools/packgen/${{ matrix.target }}-${{ matrix.arch }}/Release/${{ matrix.binary }}"
84+
echo "Stripping binary at: $binary_path"
85+
strip "$binary_path"
86+
7887
- name: Archive packgen
7988
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
8089
with:

.github/workflows/projmgr.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ jobs:
8080
target: projmgr
8181
arch: ${{ matrix.arch }}
8282

83+
- name: Strip projmgr release binary
84+
if: |
85+
github.event_name == 'release' &&
86+
(startsWith(matrix.runs_on, 'macos') || startsWith(matrix.runs_on, 'ubuntu'))
87+
run: |
88+
binary_path="./build/tools/projmgr/${{ matrix.target }}-${{ matrix.arch }}/Release/${{ matrix.binary }}"
89+
echo "Stripping binary at: $binary_path"
90+
strip "$binary_path"
91+
8392
- name: Archive projmgr
8493
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
8594
with:

.github/workflows/svdconv.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,47 @@ jobs:
7979
retention-days: ${{ needs.setup.outputs.retention_days }}
8080
if-no-files-found: error
8181

82+
- name: Install strip tools
83+
if: |
84+
github.event_name == 'release' &&
85+
matrix.arch == 'arm64' &&
86+
startsWith(matrix.runs_on, 'ubuntu')
87+
run: |
88+
sudo apt-get update
89+
sudo apt-get install binutils-aarch64-linux-gnu
90+
91+
# Run only for release events on macOS or Ubuntu runners
92+
- name: Strip and bundle svdconv release binary
93+
if: |
94+
github.event_name == 'release' &&
95+
(startsWith(matrix.runs_on, 'macos') || startsWith(matrix.runs_on, 'ubuntu'))
96+
working-directory: build/tools/svdconv/SVDConv
97+
run: |
98+
mkdir -p svdconv_release_bin
99+
100+
# Extract the binary tarball into the release directory
101+
tar -xvf svdconv-*-${{ matrix.target }}-${{ matrix.arch }}.tbz2 -C svdconv_release_bin
102+
103+
# Construct the path to the extracted binary
104+
binary_path="./svdconv_release_bin/${{ matrix.binary }}"
105+
echo "Stripping binary at: $binary_path"
106+
107+
# Use appropriate strip tool based on architecture and target
108+
if [[ "${{ matrix.arch }}" == "arm64" && "${{ matrix.target }}" == "linux" ]]; then
109+
aarch64-linux-gnu-strip "$binary_path"
110+
else
111+
strip "$binary_path"
112+
fi
113+
114+
# Temporarily rename the original archive
115+
original_filename=$(find . -maxdepth 1 -type f -name "svdconv-*-${{ matrix.target }}-${{ matrix.arch }}.tbz2" | head -n 1)
116+
mv "$original_filename" ./temp.tbz2
117+
118+
# Repack the modified binary into a new tarball
119+
output_name=$(basename "$original_filename")
120+
echo "Repacking into: $output_name"
121+
tar -cjf "$output_name" -C svdconv_release_bin .
122+
82123
- name: Attach svdconv binary to release
83124
if: ${{ github.event_name == 'release' }}
84125
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2

0 commit comments

Comments
 (0)