Build workflow for macOS (#36) #1
Workflow file for this run
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
# SPDX-License-Identifier: GPL-2.0-or-later | |
# Copyright (C) 2024 Analog Devices, Inc. | |
on: | |
push: | |
tags: | |
- '[0-9]+\.[0-9]+\.[0-9]+-[0-9]+\.[0-9]+\.[0-9]+' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
name: OpenOCD macOS Release Build | |
env: | |
DEPS_DIR: "${GITHUB_WORKSPACE}/openocd_deps" | |
jobs: | |
build: | |
runs-on: [self-hosted, macOS, ARM64] | |
strategy: | |
matrix: | |
platform: [ | |
{ | |
name: "macOS-ARM64", | |
configure_options: "--prefix=${GITHUB_WORKSPACE}/output/openocd", | |
pkg_cfg_path: "" | |
}, | |
] | |
build: [ | |
{ | |
name: "release", | |
compiler_flags: "-O2 -Wno-error", | |
linker_flags: "-L${GITHUB_WORKSPACE}/openocd_deps/lib" | |
}, | |
{ | |
name: "debug", | |
compiler_flags: "-g -Wno-error", | |
linker_flags: "-L${GITHUB_WORKSPACE}/openocd_deps/lib" | |
} | |
] | |
steps: | |
- name: Cleanup Workspace | |
run: | | |
rm -rf ./* ./.??* | |
- name: Checkout ${{ matrix.platform.name }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
path: openocd | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Checkout libusb | |
uses: actions/checkout@v4 | |
with: | |
repository: libusb/libusb | |
ref: v1.0.24 | |
path: libusb | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Checkout hidapi | |
uses: actions/checkout@v4 | |
with: | |
repository: libusb/hidapi | |
ref: hidapi-0.13.1 | |
path: hidapi | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Get Tag | |
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Package Version | |
run: | | |
PKG_VERSION="Analog Devices ${{ env.TAG_NAME }}" | |
echo "CONF_OPTS=${{ matrix.platform.configure_options }} --with-pkgversion=\"${PKG_VERSION}\"" >> $GITHUB_ENV | |
- name: Build libusb | |
run: | | |
cd libusb &&\ | |
./bootstrap.sh &&\ | |
./configure --prefix=${{ env.DEPS_DIR }} --disable-shared --enable-static &&\ | |
make -j$(nproc) &&\ | |
make install &&\ | |
cd .. | |
- name: Build hidapi | |
run: | | |
cd hidapi &&\ | |
./bootstrap &&\ | |
./configure --prefix=${{ env.DEPS_DIR }} --disable-shared --enable-static &&\ | |
make -j$(nproc) &&\ | |
make install &&\ | |
cd .. | |
- name: Build ${{ matrix.platform.name }} | |
env: | |
PKG_CONFIG_PATH: ${{ matrix.platform.pkg_cfg_path }} | |
CPPFLAGS: ${{ matrix.build.compiler_flags }} | |
CFLAGS: ${{ matrix.build.compiler_flags }} | |
LDFLAGS: ${{ matrix.build.linker_flags }} | |
run: | | |
cd openocd &&\ | |
./bootstrap &&\ | |
./configure ${{ env.CONF_OPTS }} &&\ | |
make -j$(nproc) &&\ | |
cd .. | |
- name: Install to local folder | |
run: | | |
cd openocd &&\ | |
make install &&\ | |
cd .. | |
- name: Generate ARTIFACT_NAME | |
run: | | |
echo "ARTIFACT_NAME=openocd-${{ env.TAG_NAME }}-${{ matrix.platform.name }}-${{ matrix.build.name }}" | tr '/' '-' >> $GITHUB_ENV | |
- name: Zip files | |
run: | |
cd output && zip -qq -r ../${{ env.ARTIFACT_NAME }}.zip openocd/ | |
- name: Setup JFrog CLI | |
uses: jfrog/setup-jfrog-cli@v4 | |
env: | |
JF_URL: ${{ vars.ARTIFACTORY_URL }} | |
JF_USER: ${{ secrets.JF_USER }} | |
JF_PASSWORD: ${{ secrets.JF_PASSWORD }} | |
- name: Run JFrog CLI | |
run: | | |
# Ping the server | |
jf rt ping | |
jf rt u "${{ env.ARTIFACT_NAME }}.zip" "dte-products/standalone/openocd/${{ github.ref_name }}/${{ env.ARTIFACT_NAME }}.zip" |