Skip to content

Commit

Permalink
Added deps, toolchain & host tools caching
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Storm committed Nov 5, 2024
1 parent cf170ee commit 67fe18d
Showing 1 changed file with 43 additions and 20 deletions.
63 changes: 43 additions & 20 deletions .github/workflows/BPI-r4_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
CUSTOM_FILES_PATH: files/
RELEASE_PREFIX: nstorm-bpi-r4

jobs:
jobs:
build:
name: Build OpenWrt
runs-on: ubuntu-24.04
Expand All @@ -26,33 +26,74 @@ jobs:
sudo apt update
sudo apt full-upgrade -y
sudo apt install -y build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev python3-setuptools rsync swig unzip zlib1g-dev file wget jq
- name: Checkout remote repository
uses: actions/checkout@v4
with:
repository: ${{ env.REMOTE_REPOSITORY }}
ref: ${{ env.REMOTE_BRANCH }}

- name: Checkout current repository
uses: actions/checkout@v4
with:
path: "custom_repo"

- name: Update and install feeds
run: |
./scripts/feeds update -a
./scripts/feeds install -a
- name: Configure firmware image
run: |
cat ${{ env.CONFIG_FILE }} > .config
make defconfig
- name: Include custom files
run: |
mkdir -p ${{ env.CUSTOM_FILES_PATH }}
mv custom_repo/BPI-r4/${{ env.CUSTOM_FILES_PATH }}* ${{ env.CUSTOM_FILES_PATH }}
- name: Try to fetch dependencies cache
uses: actions/cache/restore@v4
with:
path: dl
key: dl-${{ runner.os }}-${{ github.run_id }}
restore-keys: dl-${{ runner.os }}

- name: Download dependencies
run: make -j$(($(nproc)+1)) download

- name: Update dependencies cache every run
uses: actions/cache/save@v4
with:
path: dl
key: dl-${{ runner.os }}-${{ github.run_id }} # Can use time based key as well

- name: Try to fetch host packages and toolchain cache
uses: actions/cache/restore@v4
with:
path: |
staging_dir/host
staging_dir/hostpkg
staging_dir/toolchain-aarch64_cortex-a53_gcc-14.2.0_musl
key: toolchain-${{ runner.os }}-${{ github.run_id }}
restore-keys: toolchain-${{ runner.os }}

- name: Build the firmware image
run: ntry=1; while [[ $ntry -le 3 ]]; do make -j$(($(nproc)+1)) world && ntry=5 || (( ntry++ )); [[ $ntry -eq 4 ]] && exit 255; true; done

- name: Update host packages and toolchain cache
uses: actions/cache/save@v4
with:
path: |
staging_dir/host
staging_dir/hostpkg
staging_dir/toolchain-aarch64_cortex-a53_gcc-14.2.0_musl
key: toolchain-${{ runner.os }}-${{ github.run_id }}

- name: Package output
run: tar -cvf bpi_r4-images.tar bin/targets/mediatek/filogic

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -75,22 +116,4 @@ jobs:
run: |
echo "RELEASE_DATE=$(date +%F)" >> $GITHUB_ENV
echo -n "BUILD_VER_STR=$( cat bin/targets/mediatek/filogic/profiles.json | jq -r '.profiles.[].image_prefix' | sed -E 's/openwrt-(v24-snapshot-.*?-r[0-9]{2,3})-mediatek-filogic-bananapi_bpi-r4/\1/' )" >> $GITHUB_ENV
- name: Create release
uses: softprops/action-gh-release@master
with:
files: bin/targets/mediatek/filogic/*
prerelease: true
tag_name: ${{ env.RELEASE_PREFIX }}-${{ env.BUILD_VER_STR }}
name: (AUTO) NStorm-BPI-R4-${{ env.BUILD_VER_STR }}
body: |
(!) Automated and untested / experimental build.
Image version: NStorm-BPI-R4-${{ env.BUILD_VER_STR }}
Uploaded on: ${{ env.RELEASE_DATE }}
Build Commit: ${{ needs.check_commits.outputs.latest_commit_sha }}
- name: Clean up old releases
uses: dev-drprasad/delete-older-releases@master
with:
keep_latest: 30
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ls -l

0 comments on commit 67fe18d

Please sign in to comment.