Skip to content

Build workflow for macOS (#36) #1

Build workflow for macOS (#36)

Build workflow for macOS (#36) #1

Workflow file for this run

# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2024 Analog Devices, Inc.
on:
push:
branches: [ "**/**", "!adi-main", "!milestone/**" ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
name: OpenOCD Debug Build
jobs:
build:
runs-on: [self-hosted, openocd]
container:
image: ${{ vars.DOCKER_IMAGE }}
credentials:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
options: '--entrypoint /bin/bash'
strategy:
fail-fast: false
matrix:
platform: [
{
name: "Linux64",
compiler_flags: "-g -Wno-error",
configure_options: "--prefix=`pwd`/output/openocd",
pkg_cfg_path: ""
},
{
name: "Windows",
compiler_flags: "-g -Wno-error",
configure_options: "--prefix=`pwd`/output/openocd --host=x86_64-w64-mingw32",
pkg_cfg_path: "/usr/x86_64-w64-mingw32/lib/pkgconfig"
},
{
name: "Windows-usbmux",
compiler_flags: "-g -Wno-error",
configure_options: "--prefix=`pwd`/output/openocd --enable-usbmux --host=x86_64-w64-mingw32",
pkg_cfg_path: "/usr/x86_64-w64-mingw32/lib/pkgconfig"
}
]
steps:
- name: Apply container owner mismatch workaround
run: |
# FIXME: The owner UID of the GITHUB_WORKSPACE directory may not
# match the container user UID because of the way GitHub
# Actions runner is implemented. Remove this workaround when
# GitHub comes up with a fundamental fix for this problem.
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Cleanup Workspace
run: |
rm -rf ./* || true
rm -rf ./.??* || true
- name: Checkout ${{ matrix.platform.name }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Build ${{ matrix.platform.name }}
env:
CPPFLAGS: ${{ matrix.platform.compiler_flags }}
CFLAGS: ${{ matrix.platform.compiler_flags }}
PKG_CONFIG_PATH: ${{ matrix.platform.pkg_cfg_path }}
run: |
./bootstrap
./configure ${{ matrix.platform.configure_options }}
make -j4
- name: Install to local folder
run: |
make install
- name: Generate ARTIFACT_NAME
run: |
echo "ARTIFACT_NAME=openocd-${{ github.ref_name }}-${{ matrix.platform.name }}" | tr '/' '-' >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: "output"
retention-days: 30