-
Notifications
You must be signed in to change notification settings - Fork 3
211 lines (203 loc) · 8.35 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Build OpenOCD
on:
push:
branches:
- '*'
workflow_dispatch:
env:
OPENOCD_VERSION: "0.12.0+dev~snapshot"
jobs:
init:
runs-on: ubuntu-24.04
steps:
- name: Build Version
id: build_version
run: |
export BUILD_VERSION_TMP="$(date +'%Y%m%d.%H%M')"
echo $BUILD_VERSION_TMP
echo "BUILD_VERSION=$BUILD_VERSION_TMP" >> $GITHUB_ENV
echo "build_version=$BUILD_VERSION_TMP" >> "$GITHUB_OUTPUT"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: OpenOCD ${{ env.OPENOCD_VERSION }}.${{ env.BUILD_VERSION }}
draft: true
prerelease: false
outputs:
build_version: ${{ steps.build_version.outputs.build_version }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
build-deb:
needs: init
runs-on: ubuntu-24.04
steps:
- name: Build Version
run: |
echo "BUILD_VERSION=${{ needs.init.outputs.build_version }}" >> $GITHUB_ENV
echo $BUILD_VERSION
- name: Setup build environment
run: |
sudo apt-get update
sudo apt-get -y install \
make libtool pkg-config autoconf automake \
rsync texinfo tree libusb-dev libusb-1.0 \
libhidapi-dev libftdi-dev libjaylink-dev
- name: Check out repository
uses: actions/checkout@v3
- name: Clone OpenOCD repo
run: |
git clone http://openocd.zylin.com/openocd.git
- name: "./bootstrap"
run: |
(cd openocd && ./bootstrap)
- name: "./configure"
run: |
(cd openocd && ./configure --prefix=/usr/local \
--enable-ftdi --enable-stlink --enable-ti-icdi \
--enable-ulink --enable-usb-blaster-2 --enable-ft232r \
--enable-vsllink --enable-xds110 --enable-osbdm \
--enable-opendous --enable-aice --enable-usbprog \
--enable-rlink --enable-armjtagew --enable-cmsis-dap \
--enable-kitprog --enable-usb-blaster --enable-presto \
--enable-openjtag --enable-jlink)
- name: Make
run: (cd openocd && make -j8)
- name: Make install
run: (cd openocd && sudo make install)
- name: Debian package
run: |
sed -i s/BUILD_VERSION/${{ env.BUILD_VERSION }}/g deb-package/DEBIAN/control
sed -i s/OPENOCD_VERSION/${{ env.OPENOCD_VERSION }}/g deb-package/DEBIAN/control
mkdir -p deb-package
rsync -aR /usr/local/{bin/openocd,share/info/openocd*,share/man/*/openocd*,share/openocd/} deb-package/
sudo chown -R root:root deb-package/
dpkg-deb --build deb-package
- name: Test package installation
run: sudo apt-get -y install ./deb-package.deb
#- name: Debian package artifact
# uses: actions/upload-artifact@v1
# with:
# name: debian-package
# path: deb-package.deb
- name: Upload DEB Release Asset
id: upload-release-asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export UPLOAD_URL=$(echo "${{ needs.init.outputs.upload_url }}" | sed s/\{\?name,label\}//g)
echo $UPLOAD_URL
curl -L -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/vnd.debian.binary-package" \
$UPLOAD_URL?name=openocd-${{ env.OPENOCD_VERSION }}.${{ env.BUILD_VERSION }}.amd64.deb \
--data-binary "@deb-package.deb"
build-rpm:
needs: init
runs-on: ubuntu-24.04
container:
image: fedora:41
steps:
- name: Update Fedora and install dependencies
run: |
dnf update -y
dnf install -y make libtool pkg-config autoconf automake texinfo tree libusbx-devel hidapi-devel libftdi-devel rpm git which zip rpm-build capstone-devel chrpath jimtcl-devel libjaylink-devel libgpiod-devel sdcc
- name: Build Version
run: |
echo "BUILD_VERSION=${{ needs.init.outputs.build_version }}" >> $GITHUB_ENV
echo $BUILD_VERSION
- name: Check out repository
uses: actions/checkout@v3
- name: Prepare RPM build
run: |
mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/SPECS ~/rpmbuild/BUILD
cp rpm-package/openocd.spec ~/rpmbuild/SPECS/openocd.spec
sed -i s/BUILD_VERSION/${{ env.BUILD_VERSION }}/g ~/rpmbuild/SPECS/openocd.spec
sed -i s/OPENOCD_VERSION/${{ env.OPENOCD_VERSION }}/g ~/rpmbuild/SPECS/openocd.spec
- name: Clone OpenOCD repo and run Bootstrap
run: |
git clone --filter=tree:0 http://openocd.zylin.com/openocd.git openocd-${{ env.OPENOCD_VERSION }}
(cd openocd-${{ env.OPENOCD_VERSION }}/ && ./bootstrap)
rm -rf openocd-$OPENOCD_VERSION/.git/
zip -q -r ~/rpmbuild/SOURCES/openocd-${{ env.OPENOCD_VERSION }}.zip openocd-${{ env.OPENOCD_VERSION }}
rm -rf openocd-${{ env.OPENOCD_VERSION }}/
- name: Build RPM from spec file
run: |
cd ~/rpmbuild/SPECS
rpmbuild -ba openocd.spec
ls ~/rpmbuild/RPMS/x86_64/
export RPM_FILE_TMP="$(ls ~/rpmbuild/RPMS/x86_64/ | grep -v debug)"
echo "RPM_FILE: $RPM_FILE_TMP"
echo "RPM_FILE=$RPM_FILE_TMP" >> $GITHUB_ENV
#- name: RPM package artifact
# uses: actions/upload-artifact@v2
# with:
# name: rpm-package
# path: ~/rpmbuild/RPMS/x86_64/*.rpm
- name: Upload RPM Release Asset
id: upload-release-asset
run: |
export UPLOAD_URL=$(echo "${{ needs.init.outputs.upload_url }}" | sed s/\{\?name,label\}//g)
echo $UPLOAD_URL
curl -L -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/x-rpm" \
$UPLOAD_URL?name=${{ env.RPM_FILE }} \
--data-binary "@/github/home/rpmbuild/RPMS/x86_64/${{ env.RPM_FILE }}"
build-deb-arm64:
needs: init
runs-on: ubuntu-24.04
steps:
- name: Build Version
run: |
echo "BUILD_VERSION=${{ needs.init.outputs.build_version }}" >> $GITHUB_ENV
echo $BUILD_VERSION
- name: Check out repository
uses: actions/checkout@v3
- name: Build on Arm64
uses: uraimo/run-on-arch-action@v2
id: runcmd
with:
arch: aarch64
distro: ubuntu_latest
githubToken: ${{ github.token }}
run: |
uname -a
apt-get update
apt-get -y install make libtool pkg-config autoconf automake texinfo tree rsync libusb-dev libusb-1.0 libhidapi-dev libftdi-dev libjaylink-dev git build-essential
(git clone http://openocd.zylin.com/openocd.git && cd openocd && ./bootstrap)
(cd openocd && ./configure --prefix=/usr/local \
--enable-ftdi --enable-stlink --enable-ti-icdi \
--enable-ulink --enable-usb-blaster-2 --enable-ft232r \
--enable-vsllink --enable-xds110 --enable-osbdm \
--enable-opendous --enable-aice --enable-usbprog \
--enable-rlink --enable-armjtagew --enable-cmsis-dap \
--enable-kitprog --enable-usb-blaster --enable-presto \
--enable-openjtag --enable-jlink)
(cd openocd && make -j8)
(cd openocd && make install)
sed -i s/BUILD_VERSION/${{ env.BUILD_VERSION }}/g deb-package/DEBIAN/control
sed -i s/OPENOCD_VERSION/${{ env.OPENOCD_VERSION }}/g deb-package/DEBIAN/control
sed -i s/amd64/arm64/g deb-package/DEBIAN/control
mkdir -p deb-package
rsync -aR /usr/local/{bin/openocd,share/info/openocd*,share/man/*/openocd*,share/openocd/} deb-package/
chown -R root:root deb-package
dpkg-deb --build deb-package
apt-get -y install ./deb-package.deb
#- name: Debian package artifact
# uses: actions/upload-artifact@v2
# with:
# name: debian-package-arm64
# path: deb-package.deb
- name: Upload DEB Arm64 Release Asset
id: upload-release-asset
run: |
export UPLOAD_URL=$(echo "${{ needs.init.outputs.upload_url }}" | sed s/\{\?name,label\}//g)
echo $UPLOAD_URL
curl -L -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/vnd.debian.binary-package" \
$UPLOAD_URL?name=openocd-${{ env.OPENOCD_VERSION }}.${{ env.BUILD_VERSION }}.arm64.deb \
--data-binary "@deb-package.deb"