Update RPM spec #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |