Skip to content

Building images πŸš€ #3

Building images πŸš€

Building images πŸš€ #3

name: Build testing
run-name: "Building images πŸš€"
on: [push, pull_request]
jobs:
build-job:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cfg:
- { model: "rt-ax89u", sdk: "src-qca-ipq806x", skip: false }
container:
image: paldier/swrt-docker:latest
env:
MODELCFG: ${{ matrix.cfg.model }}
SDK: ${{ matrix.cfg.sdk }}
SKIP_BUILD: ${{ matrix.cfg.skip }}
GIT_REPO: "https://github.com/SWRT-dev/rtax89x.git"
PROJECT_DIR: "/project/rtax89x"
PROJECTBASEDIR: "/project" # REMOVE_ME: Fixes https://github.com/SonarSource/sonarcloud-github-action/pull/58
options: --user docker
volumes:
- /mnt:/project # HACK: Use /mnt partition since bigger than others. This prevents to run out of space
steps:
- name: Run debug commands - post
run: |
cd /
echo "--- Disk available ----"
df -h
- name: Fix permissions in docker image
if: matrix.cfg.skip == false
run: |
sudo chown -R docker:docker /github/home /home/docker /project
- name: "Fetch code"
if: matrix.cfg.skip == false
run: |
cd /project
if [[ $SKIP_BUILD == "true" ]]; then
echo "Skipping build!"
exit 0
fi
if [[ $GITHUB_REF_TYPE == "tag" ]]; then
export TAG="${GITHUB_REF#refs/tags/}"
echo "Fetching code from tag $TAG"
else
export BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
echo "Fetching code from branch $BRANCH"
fi
if git clone --depth 1 --branch "${TAG:-$BRANCH}" "$GIT_REPO"; then
echo "Code fetched successfully."
else
echo "Failed to fetch code. Check the repository and settings."
exit 1
fi
ls /home/docker
- name: "Build"
if: matrix.cfg.skip == false
run: |
if [[ $SKIP_BUILD == "true" ]]; then
echo "Skipping build!"
exit 0
fi
echo "----- Space available -----"
df -h
echo "----- I am: $(id) -----"
cd ${PROJECT_DIR}/release/${SDK}
echo "----- Files in dir: $(pwd) -----"
ls -alh
echo "----- Setting toolchains for ${SDK} -----"
sudo ln -sf /home/docker/qca-toolchains/openwrt-gcc463.arm /opt/
echo "----- Check envs dir ---------"
ls -alh /home/docker/envs/
echo "----- Debugging env vars -----"
env
echo "----- BUILD ${MODELCFG}-----"
make "${MODELCFG}"