Skip to content

Commit 6e7d164

Browse files
use docker to build BCU
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
1 parent 9ed8294 commit 6e7d164

1 file changed

Lines changed: 39 additions & 22 deletions

File tree

.github/workflows/main.yml

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,25 @@ jobs:
2323
- name: Initialize submodules
2424
run: git submodule update --init
2525

26-
# Install dependencies
27-
- name: Install dependencies
26+
# Install dependencies and build
27+
- name: Build with Ubuntu 20.04 Docker
2828
if: matrix.os == 'ubuntu-latest'
2929
run: |
30-
sudo apt-get update
31-
sudo apt-get install -y libyaml-dev libftdi1-dev libusb-1.0-0-dev
30+
echo $CI_BUILD_VERSION
31+
# Use Docker to build in Ubuntu 20.04 environment
32+
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace -e CI_BUILD_VERSION="$CI_BUILD_VERSION" -e DEBIAN_FRONTEND=noninteractive -e TZ=UTC ubuntu:20.04 bash -c "
33+
apt-get update &&
34+
apt-get install -y libyaml-dev libftdi1-dev libusb-1.0-0-dev cmake build-essential pkg-config git &&
35+
cmake . &&
36+
make
37+
"
38+
# The built binary should already be named 'bcu' for Linux
3239
3340
- name: Install dependencies (macOS)
3441
if: matrix.os == 'macos-latest'
3542
run: |
36-
brew reinstall pkgconfig
37-
export PATH="/usr/local/Cellar/pkg-config/0.29.2_3/bin:${PATH}"
38-
brew reinstall libyaml
39-
brew install libftdi
43+
brew update
44+
brew install pkgconfig libyaml libftdi libusb
4045
pkg-config --list-all
4146
4247
- name: Create env variables (Linux/macOS)
@@ -49,18 +54,18 @@ jobs:
4954
run: |
5055
echo "CI_BUILD_VERSION=${{ github.ref_name }}" >> $env:GITHUB_ENV
5156
52-
# Build Project
53-
- name: Build (Linux/macOS)
54-
if: matrix.os != 'windows-latest'
57+
- name: Build (macOS)
58+
if: matrix.os == 'macos-latest'
5559
run: |
5660
echo $CI_BUILD_VERSION
57-
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
58-
cmake .
59-
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
60-
export PATH="/usr/local/Cellar/pkg-config/0.29.2_3/bin:${PATH}"
61-
cmake .
62-
fi
61+
# Use pkg-config from homebrew
62+
export PKG_CONFIG_PATH="$(brew --prefix)/lib/pkgconfig:$PKG_CONFIG_PATH"
63+
cmake .
6364
make
65+
# Rename the binary for macOS
66+
if [ -f "bcu" ]; then
67+
mv bcu bcu_mac
68+
fi
6469
6570
# Windows build
6671
- name: Windows setup selection
@@ -81,14 +86,26 @@ jobs:
8186
}
8287
8388
# Upload build artifacts
84-
- name: Upload artifact
89+
- name: Upload artifact (Ubuntu)
90+
if: matrix.os == 'ubuntu-latest'
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: bcu-artifacts-${{ github.run_id }}-${{ matrix.os }}
94+
path: ${{ github.workspace }}/bcu
95+
96+
- name: Upload artifact (macOS)
97+
if: matrix.os == 'macos-latest'
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: bcu-artifacts-${{ github.run_id }}-${{ matrix.os }}
101+
path: ${{ github.workspace }}/bcu_mac
102+
103+
- name: Upload artifact (Windows)
104+
if: matrix.os == 'windows-latest'
85105
uses: actions/upload-artifact@v4
86106
with:
87107
name: bcu-artifacts-${{ github.run_id }}-${{ matrix.os }}
88-
path: |
89-
${{ github.workspace }}/bcu.exe
90-
${{ github.workspace }}/bcu
91-
${{ github.workspace }}/bcu_mac
108+
path: ${{ github.workspace }}/bcu.exe
92109

93110
deploy:
94111
needs: build

0 commit comments

Comments
 (0)