diff --git a/.github/workflows/makefile_main.yml b/.github/workflows/makefile_main.yml new file mode 100644 index 0000000000..3c3e4c65c6 --- /dev/null +++ b/.github/workflows/makefile_main.yml @@ -0,0 +1,100 @@ +name: Build Check (main) + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + platform: + - name: "Raspberry Pi" + makefile_path: "build/linux/rpi/makefile" + - name: "Banana Pi R4" + makefile_path: "build/linux/bpi/makefile" + fail-fast: false + + name: Build for ${{ matrix.platform.name }} + + steps: + - name: Checkout current repository + uses: actions/checkout@v4 + with: + path: 'OneWifi' + + - name: Clone unified-wifi-mesh repository + run: | + mkdir -p easymesh_project + git clone https://github.com/rdkcentral/unified-wifi-mesh.git easymesh_project/unified-wifi-mesh + mv OneWifi easymesh_project/OneWifi + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: /var/cache/apt + key: ${{ runner.os }}-apt-${{ hashFiles('**/apt-packages') }} + restore-keys: | + ${{ runner.os }}-apt- + + - name: Set up dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential \ + cmake \ + python3 \ + python3-pip \ + git \ + vim \ + libev-dev \ + libjansson-dev \ + zlib1g-dev \ + libnl-3-dev \ + libnl-genl-3-dev \ + libnl-route-3-dev \ + libavro-dev \ + libcjson1 libcjson-dev \ + libssl-dev \ + uuid-dev \ + libmysqlcppconn-dev \ + libreadline-dev \ + iptables \ + mariadb-server \ + gnupg \ + file \ + golang + + - name: Setup OneWiFi for ${{ matrix.platform.name }} + working-directory: easymesh_project/OneWifi + run: | + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + git config --global user.name "${{ github.actor }}" + + MF="${{ matrix.platform.makefile_path }}" + if [ ! -f "$MF" ]; then + echo "Makefile '$MF' not on main; pulling its folder from develop…" + git remote add upstream https://github.com/rdkcentral/OneWifi.git || true + git fetch --depth=1 upstream develop + plat_dir="$(dirname "$MF")" + git checkout upstream/develop -- "$plat_dir" + fi + + if [ ! -f "$MF" ]; then + echo "Still missing '$MF'; falling back to generic build/linux/makefile" + MF="build/linux/makefile" + fi + + make -f "$MF" setup + env: + GITHUB_ACTOR: ${{ github.actor }} + + - name: Build OneWiFi for ${{ matrix.platform.name }} + working-directory: easymesh_project/OneWifi + run: | + MF="${{ matrix.platform.makefile_path }}" + [ -f "$MF" ] || MF="build/linux/makefile" + make -f "$MF" all