Skip to content

202412131038

202412131038 #1408

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
workflow_dispatch:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
do_repository_dispatch:
name: repository dispatch
runs-on: ubuntu-24.04
steps:
- name: Repository dispatch
if: ${{ github.repository == 'HiGarfield/lede-17.01.4-Mod' && github.event_name == 'push' }}
uses: HiGarfield/repository-dispatch@main
with:
token: ${{ secrets.MY_TOKEN }}
repository: ${{ secrets.SECOND_REPO }}
event-type: ${{ github.event.head_commit.message }}
build:
name: build
needs: [ do_repository_dispatch ]
runs-on: ubuntu-24.04
permissions:
contents: write
env:
TARGET_DEVICE: ${{ matrix.target }}
SOURCE_REPO: 'HiGarfield/lede-17.01.4-Mod'
strategy:
max-parallel: 20
matrix:
target: [ "dl", "hw24g", "csac", "wr1200js", "a3004ns", "link7", "domywifi-dw33d", "rg-nbr700gw", "treebear-x1", "ghl-r-001", "yyets-le2", "hq55", "newifi-d1", "newifi-d2", "tl-wdr4310-v1", "tl-wdr7500-v3", "tl-wr841-v9", "tl-wr885n-v1", "tl-wr941nd-v6-cn", "tl-wr941n-v7", "domywifi-dw22d-v1", "domywifi-dw22d-v2", "mw450r-v3", "tl-wr841-v8", "tl-wr841-v8-cn", "tl-wr941nd-v6", "tl-wr842n-v2", "tl-wr842n-v2-cn", "tl-wr941nd-v2", "tl-wr740n-v3", "tl-wr740n-v4", "tl-wr841-v3", "tl-wr841-v5", "tl-wr841-v7", "tl-wr842n-v3", "tl-wr1041n-v2", "phicomm-k2t", "y1s", "5k-w20", "hd51-n", "youku-yk1", "miwifi-mini", "hc5661" ]
steps:
- name: Checkout
uses: actions/checkout@main
with:
ref: master
fetch-depth: 0
- name: Clone source code
working-directory: ${{ github.workspace }}
run: |
if [ -f "$GITHUB_WORKSPACE/version" ]; then
WORKING_DIR="$GITHUB_WORKSPACE"
else
git clone "https://github.com/$SOURCE_REPO" -b master source
WORKING_DIR="$GITHUB_WORKSPACE/source"
fi
echo "WORKING_DIR=${WORKING_DIR}" >>$GITHUB_ENV
- name: Set environment variables
working-directory: ${{ env.WORKING_DIR }}
run: |
echo "MY_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
LEDE_VERSION="$(cat "${WORKING_DIR}/version")"
echo "LEDE_VERSION=${LEDE_VERSION}" >>$GITHUB_ENV
if [ "$TARGET_DEVICE" != "dl" ]; then
LEDE_OUTPUT_NAME="lede-${LEDE_VERSION}-${TARGET_DEVICE}"
else
LEDE_OUTPUT_NAME="dl-${LEDE_VERSION}"
fi
echo "LEDE_OUTPUT_NAME=${LEDE_OUTPUT_NAME}" >>$GITHUB_ENV
echo "OUTPUT_DIR=${WORKING_DIR}/out" >> $GITHUB_ENV
- name: Initialize environment
working-directory: ${{ env.WORKING_DIR }}
run: |
sudo swapoff -a
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt -qq update
sudo -E apt -y -qq install aria2 build-essential binutils bzip2 gettext \
flex perl findutils diffutils unzip gawk util-linux \
subversion zlib1g-dev zip git coreutils \
gcc-11 g++-11 libc6-dev
sudo -E apt -qq autoremove --purge
sudo -E apt -qq clean
sudo -E update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 60
sudo -E update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 60
sudo -E update-alternatives --set gcc /usr/bin/gcc-11
sudo -E update-alternatives --set g++ /usr/bin/g++-11
sudo -E .github/backup/install_python2.sh
sed -i 's/HOST_BUILD_PARALLEL ?=/HOST_BUILD_PARALLEL ?= 1/g' include/host-build.mk
sed -i 's/PKG_BUILD_PARALLEL ?=/PKG_BUILD_PARALLEL ?= 1/g' include/package.mk
- name: Generate toolchain cache mixkey
id: gen_toolchain_cache_mixkey
if: ${{ env.TARGET_DEVICE != 'dl' }}
working-directory: ${{ env.WORKING_DIR }}
run: |
target_device_arch="$(sed -n 's/^CONFIG_TARGET_BOARD=\"\(.*\)\"/\1/p' "conf/.config.$TARGET_DEVICE")"
gcc_hash=$(gcc --version | sha256sum | awk '{print substr($1,1,8)}')
ldd_hash=$(ldd --version | sha256sum | awk '{print substr($1,1,8)}')
toolchain_mixkey="${target_device_arch}-${gcc_hash}-${ldd_hash}"
echo "toolchain_mixkey=$toolchain_mixkey" >> $GITHUB_OUTPUT
- name: Cache toolchain
if: ${{ env.TARGET_DEVICE != 'dl' }}
uses: HiGarfield/cachewrtbuild@main
with:
ccache: 'true'
mixkey: ${{ steps.gen_toolchain_cache_mixkey.outputs.toolchain_mixkey }}
prefix: ${{ env.WORKING_DIR }}
- name: Restore cached dl
if: ${{ env.TARGET_DEVICE != 'dl' }}
id: restore_cached_dl
uses: actions/cache/restore@main
with:
path: ${{ env.WORKING_DIR }}/dl
key: ${{ github.repository_id }}-dl-${{ github.run_id }}
restore-keys: ${{ github.repository_id }}-dl-
- name: Download dl
if: ${{ env.TARGET_DEVICE == 'dl' }}
id: download_dl
working-directory: ${{ env.WORKING_DIR }}
run: |
./download_all.sh
find dl -size -1024c -exec rm -f {} \;
mkdir -p "${OUTPUT_DIR}"
zip -j "${OUTPUT_DIR}/${LEDE_OUTPUT_NAME}.zip" dl/*
sha256sum "${OUTPUT_DIR}/${LEDE_OUTPUT_NAME}.zip" | awk '{print $1}' >"${OUTPUT_DIR}/${LEDE_OUTPUT_NAME}.zip.sha256sum"
echo "status=success" >> $GITHUB_OUTPUT
- name: Load custom configuration
if: ${{ env.TARGET_DEVICE != 'dl' }}
working-directory: ${{ env.WORKING_DIR }}
run: |
cp -f "conf/.config.$TARGET_DEVICE" .config
make defconfig V=s
- name: Download package
if: ${{ env.TARGET_DEVICE != 'dl' }}
id: package
working-directory: ${{ env.WORKING_DIR }}
run: |
for i in $(seq 3); do
make download -j6 && break
done
find dl -size -1024c -exec rm -f {} \;
- name: Compile firmware
if: ${{ env.TARGET_DEVICE != 'dl' }}
id: compile
working-directory: ${{ env.WORKING_DIR }}
run: |
echo -e "$(($(nproc) + 1)) thread compile"
make -j$(($(nproc) + 1)) || make -j1 V=s
rm -rf ${OUTPUT_DIR}
mkdir -p ${OUTPUT_DIR}
cp -u -f bin/targets/*/*/${LEDE_OUTPUT_NAME}-*-sysupgrade.bin ${OUTPUT_DIR}/
cd ${OUTPUT_DIR}/
for f in *.bin; do
mv "$f" "$(echo "$f" | sed -e 's/-squashfs//g' -e 's/-sysupgrade//g')"
done
for f in *.bin; do
sha256sum "$f" | awk '{print $1}' >"${f}.sha256sum"
done
echo "status=success" >> $GITHUB_OUTPUT
- name: Save dl
if: ${{ env.TARGET_DEVICE == 'dl' }}
id: save_dl
uses: actions/cache/save@main
with:
path: ${{ env.WORKING_DIR }}/dl
key: ${{ github.repository_id }}-dl-${{ github.run_id }}
- name: Upload binaries to release
if: ${{ steps.compile.outputs.status == 'success' || steps.download_dl.outputs.status == 'success' }}
uses: HiGarfield/upload-release-action@master
with:
repo_token: ${{ env.MY_TOKEN }}
file: ${{ env.OUTPUT_DIR }}/*
tag: ${{ env.LEDE_VERSION }}
overwrite: true
file_glob: true
- name: Remove old releases
uses: HiGarfield/delete-older-releases@master
continue-on-error: true
with:
keep_latest: 1
delete_tags: true
env:
GITHUB_TOKEN: ${{ env.MY_TOKEN }}