Release to GitHub and NPM #779
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
name: Build & Compile CPP SDK | |
on: | |
workflow_dispatch: | |
env: | |
HUSKY: 0 | |
jobs: | |
build-and-compile: | |
name: Build & Compile CPP SDK | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install node modules | |
run: npm ci | |
- name: Install C++ dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
python3-pip \ | |
build-essential \ | |
cmake \ | |
pkg-config \ | |
wget \ | |
git \ | |
software-properties-common \ | |
python3 \ | |
curl \ | |
libssl-dev \ | |
vim \ | |
lcov \ | |
gcovr \ | |
jq \ | |
libxml2-utils \ | |
bc \ | |
cloc \ | |
libdbus-1-dev \ | |
unzip \ | |
ssh \ | |
openssl \ | |
libusb-1.0-0-dev \ | |
libsystemd-dev \ | |
gawk \ | |
sudo \ | |
ninja-build \ | |
dpkg | |
- name: Add toolchain for GCC 9 | |
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt-get update | |
- name: Install cross compilation tools | |
run: | | |
sudo apt-get install -y \ | |
gcc-9 \ | |
g++-9 \ | |
gcc-9-arm-linux-gnueabihf \ | |
g++-9-arm-linux-gnueabihf \ | |
libc6-armhf-cross \ | |
libc6-dev-armhf-cross | |
- name: Set up env variables for cross-compilation | |
run: | | |
echo "CC=arm-linux-gnueabihf-gcc-9" >> $GITHUB_ENV | |
echo "CXX=arm-linux-gnueabihf-g++-9" >> $GITHUB_ENV | |
echo "CFLAGS='-O2 -march=armv7-a'" >> $GITHUB_ENV | |
echo "CXXFLAGS='-O2 -march=armv7-a'" >> $GITHUB_ENV | |
echo "LDFLAGS='-L/usr/arm-linux-gnueabihf/lib'" >> $GITHUB_ENV | |
echo "SYSROOT=/usr/arm-linux-gnueabihf" >> $GITHUB_ENV | |
echo "PKG_CONFIG_PATH=$SYSROOT/lib/pkgconfig" >> $GITHUB_ENV | |
echo "LD_LIBRARY_PATH=$SYSROOT/lib" >> $GITHUB_ENV | |
- name: Install zlib from source | |
run: | | |
wget https://zlib.net/zlib-1.3.1.tar.gz | |
tar -xzf zlib-1.3.1.tar.gz | |
cd zlib-1.3.1 | |
CFLAGS="-O2 -pipe" CC=${CC} ./configure --prefix=${SYSROOT} | |
make | |
sudo make install | |
- name: Set file permissions | |
run: | | |
chmod -R 755 ./ | |
chown -R $(id -u):$(id -g) ./ | |
- name: Install jsonref | |
run: pip3 install jsonref | |
- name: Generate js sdk | |
run: npm run dist | |
- name: Get version from package.json | |
run: | | |
RELEASE_VERSION=$(node -p "require('./package.json').version") | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
echo "build_cpp_source=true" >> $GITHUB_ENV | |
- name: Generate native sdk source | |
if: env.build_cpp_source == 'true' | |
run: | | |
.github/workflows/utils.sh generateSource | |
- name: Clone and Install Thunder | |
if: env.build_cpp_source == 'true' | |
id: install_thunder | |
run: | | |
.github/workflows/utils.sh cloneAndInstallThunder | |
- name: Build Core SDK CPP | |
if: env.build_cpp_source == 'true' | |
id: build_core_cpp | |
run: | | |
.github/workflows/utils.sh buildCoreCPPSDK $RELEASE_VERSION | |
# - name: Upload SDK artifact | |
# if: success() | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: core-sdk | |
# path: firebolt-apis/src/sdks/core/build/cpp/src/*.tgz |