auto_compile_AX6 #65
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: auto_compile_AX6 | |
on: | |
repository_dispatch: | |
workflow_dispatch: | |
inputs: | |
ssh: | |
description: 'SSH connection to Actions' | |
required: false | |
default: 'false' | |
schedule: | |
- cron: 15 21 2,7,12,17,22,27 * * | |
# push: | |
# watch: | |
# types: started | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
if: github.event.repository.owner.id == github.event.sender.id | |
steps: | |
- name: Show system | |
run: | | |
echo -e "Total CPU cores\t: $(nproc)" | |
cat /proc/cpuinfo | grep 'model name' | |
ulimit -a | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
swap-size-mb: 512 | |
temp-reserve-mb: 100 | |
root-reserve-mb: 1280 | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Check disk space | |
run: df -h | |
- name: Init build dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo swapoff -a | |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
sudo -E apt-get -qq update | |
sudo -E apt-get -qq install aria2 | |
sudo -E wget -P /usr/local/sbin/ https://github.com/HiGarfield/lede-17.01.4-Mod/raw/master/.github/backup/apt-fast | |
sudo -E chmod -R 755 /usr/local/sbin/apt-fast | |
sudo -E apt-fast -y -qq install zstd dwarves llvm clang lldb lld build-essential rsync asciidoc binutils bzip2 gawk gettext git libncurses5-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc-s1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libreadline-dev libglib2.0-dev xmlto qemu-utils upx-ucl libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget ccache curl swig coreutils vim nano python3 python3-pip python3-ply haveged lrzsz scons libpython3-dev | |
sudo -E pip3 install pyelftools pylibfdt | |
sudo -E apt-get -qq autoremove --purge | |
sudo -E apt-get -qq clean | |
sudo -E git config --global user.name 'GitHub Actions' && git config --global user.email 'noreply@github.com' | |
sudo -E git config --global core.abbrev auto | |
df -h | |
- name: prepare | |
run: | | |
bash ./scripts/prepare.sh | |
- name: Get Architecture | |
working-directory: ${{ github.workspace }}/openwrt | |
run: | | |
LAST_COMMIT_HASH=$(curl -s "https://api.github.com/repos/AgustinLorenzo/openwrt/commits/main" | grep -m 1 '"sha":' | cut -d '"' -f 4 | cut -c 1-7) | |
echo "LAST_COMMIT_HASH=${LAST_COMMIT_HASH}" >> $GITHUB_ENV | |
tag_name=$(date +%Y%m%d-%H%M) | |
echo "tag_name=${tag_name}" >>$GITHUB_ENV | |
- name: Make Download | |
run: | | |
cd openwrt | |
make download -j50 | |
- name: Compile Openwrt | |
id: compileopenwrt | |
continue-on-error: true | |
run: | | |
cd openwrt | |
#echo | make kernel_oldconfig -j$(($(nproc) + 1)) | |
IGNORE_ERRORS=1 make -j$(($(nproc) + 1)) | |
echo $? | |
- name: If Error | |
if: steps.compileopenwrt.outcome == 'failure' | |
run: | | |
cat openwrt/.config | |
echo '================================================================' | |
cd openwrt && make -j1 V=s | |
- name: Print Disk Space After | |
run: df -h | |
- name: Organize files | |
id: organize | |
run: | | |
rm -rf ./artifact/ | |
mkdir -p ./artifact/ | |
# mv openwrt/bin/targets/qualcommax/ipq807x/*squashfs-factory.* ./artifact/ | |
# mv openwrt/bin/targets/qualcommax/ipq807x/*squashfs* ./artifact/ | |
# mv openwrt/bin/targets/qualcommax/ipq807x/config.buildinfo ./artifact/ | |
mv openwrt/bin/targets/qualcommax/ipq807x/* ./artifact/ | |
cd ./artifact/ | |
ls -Ahl | |
- name: Upload artifact | |
uses: actions/upload-artifact@main | |
with: | |
name: OpenWRT_${{ env.tag_name }} | |
path: ./artifact/ | |
- name: Create release | |
id: create_release | |
uses: ncipollo/release-action@v1.12.0 | |
with: | |
name: ax6-${{ env.tag_name }}-${{ env.LAST_COMMIT_HASH }} | |
allowUpdates: true | |
tag: ${{ env.tag_name }}-${{ env.LAST_COMMIT_HASH }} | |
replacesArtifacts: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: ./artifact/* | |
- name: Delete workflow runs | |
uses: GitRML/delete-workflow-runs@main | |
with: | |
retain_days: 21 | |
keep_minimum_runs: 7 | |
- name: Remove old Releases | |
uses: dev-drprasad/delete-older-releases@v0.1.0 | |
if: env.UPLOAD_RELEASE == 'true' && !cancelled() | |
with: | |
keep_latest: 7 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |