Skip to content

update webvirtcloud (#438) #360

update webvirtcloud (#438)

update webvirtcloud (#438) #360

Workflow file for this run

name: Build Meta
on:
workflow_dispatch:
inputs:
test:
description: 'Just test build, skip push'
required: false
type: boolean
push:
branches:
- main
paths:
- 'applications/**'
env:
SDK_NAME: openwrt-sdk-21.02.2-armvirt-64_gcc-8.4.0_musl.Linux-x86_64
SDK_URL: https://downloads.openwrt.org/releases/21.02.2/targets/armvirt/64/
TZ: Asia/Shanghai
jobs:
build:
runs-on: ubuntu-latest
name: Build Meta
steps:
- name: Checkout
uses: actions/checkout@main
with:
path: 'meta'
fetch-depth: 5
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo swapoff /swapfile || true
sudo rm -rf /swapfile
sudo -E apt-get -qq install build-essential git rsync
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo ln -s /usr/bin/python3 /usr/bin/python3.10 || true
sudo timedatectl set-timezone "$TZ"
# curl -fsSL https://raw.githubusercontent.com/P3TERX/dotfiles/master/.bashrc >> ~/.bashrc
- name: 'Restore SDK from cache'
id: sdk-cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.sdk
key: ${{ env.SDK_NAME }}
- name: Download SDK
run: |
[ -d "${{ github.workspace }}/.sdk" ] || mkdir -p "${{ github.workspace }}/.sdk"
[ -s ${{ github.workspace }}/.sdk/${SDK_NAME}.tar.xz ] || wget ${SDK_URL}${SDK_NAME}.tar.xz -O ${{ github.workspace }}/.sdk/${SDK_NAME}.tar.xz
- name: Unpack SDK
run: tar -xJf ${{ github.workspace }}/.sdk/${SDK_NAME}.tar.xz
- name: Write build key
if: env.BUILD_KEY != ''
env:
BUILD_KEY: ${{ secrets.BUILD_KEY }}
run: |
echo "untrusted comment: istore key" > ${SDK_NAME}/key-build
echo "$BUILD_KEY" >> ${SDK_NAME}/key-build
cat meta/.github/workflows/key-build.pub > ${SDK_NAME}/key-build.pub
- name: Clean Code
run: |
rm -f ${SDK_NAME}/package/linux/modules/*
rm -f ${SDK_NAME}/package/kernel/linux/modules/*
grep -lFr '$(call KernelPackage,' ${SDK_NAME}/package/linux | xargs -rn1 sed -i 's/ FILES:=/ XFILES:=/g' || true
grep -lFr '$(call KernelPackage,' ${SDK_NAME}/package/kernel | xargs -rn1 sed -i 's/ FILES:=/ XFILES:=/g' || true
find ${SDK_NAME}/target/linux -name 'modules.mk' | xargs -rn1 sed -i 's/ FILES:=/ XFILES:=/g' || true
- name: Write Config
run: |
cat <<EOF >${SDK_NAME}/.config
# CONFIG_ALL_NONSHARED is not set
# CONFIG_ALL_KMODS is not set
CONFIG_ALL=y
CONFIG_SIGNED_PACKAGES=y
EOF
- name: Prepare Build dir
run: |
cp -a meta build
cp -a meta/dummy build/applications/
- name: Load custom feeds
run: |
echo "src-git compat https://github.com/jjm2473/openwrt-compat.git;main" > ${SDK_NAME}/feeds.conf.default
echo "src-link meta `pwd`/build/applications" >> ${SDK_NAME}/feeds.conf.default
- name: Update feeds
run: |
cd ${SDK_NAME} && ./scripts/feeds update compat meta
./scripts/feeds install -a -p compat -d y
./scripts/feeds install -a -p meta -d y
- name: Compile Meta
id: compile
run: |
cd ${SDK_NAME}
bash -c 'set -o pipefail ; make -j1 V=s defconfig package/{compile,index} 2>&1 | tee /tmp/openwrt-sdk-build.log'
echo "status=success" >> $GITHUB_OUTPUT
- name: Last fail log
if: failure()
run: tail -n 200 /tmp/openwrt-sdk-build.log
- name: Upload meta ipks
id: upload
if: steps.compile.outputs.status == 'success' && !cancelled() && !inputs.test
env:
RSYNC_PASSWORD: ${{ secrets.RSYNC_PASSWORD }}
REPO_DEST: ${{ secrets.RSYNC_DEST }}
run: |
rsync --exclude='Packages' --exclude='Packages.*' -a ${SDK_NAME}/bin/packages/aarch64_cortex-a53/compat $REPO_DEST
rsync --exclude='Packages' --exclude='Packages.*' -a ${SDK_NAME}/bin/packages/aarch64_cortex-a53/meta $REPO_DEST
rsync -a --del ${SDK_NAME}/bin/packages/aarch64_cortex-a53/compat $REPO_DEST
rsync -a --del ${SDK_NAME}/bin/packages/aarch64_cortex-a53/meta $REPO_DEST
echo "status=success" >> $GITHUB_OUTPUT
- name: Push to gitee
id: gitee
if: steps.upload.outputs.status == 'success' && !cancelled() && !inputs.test
env:
PUSH_TARGET: ${{ secrets.PUSH_TARGET_PREFIX }}/linkease/openwrt-app-meta.git
run: |
git -C meta remote add gitee "$PUSH_TARGET"
git -C meta push --all gitee
echo "status=success" >> $GITHUB_OUTPUT
- name: Retry Unshallow
id: retry
if: failure() && !cancelled() && steps.upload.outputs.status == 'success' && !inputs.test
run: |
git -C meta fetch --unshallow origin || exit 1
git -C meta gc
git -C meta count-objects -vH
git -C meta push --all gitee
echo "status=success" >> $GITHUB_OUTPUT
- name: Notify DB index
if: (steps.gitee.outputs.status == 'success' || steps.retry.outputs.status == 'success') && !cancelled() && !inputs.test
env:
DB_WEBHOOK_X_TOKEN: ${{ secrets.DB_WEBHOOK_X_TOKEN }}
DB_WEBHOOK_URL: ${{ secrets.DB_WEBHOOK_URL }}
DB_WEBHOOK_FLAGS: ${{ secrets.DB_WEBHOOK_FLAGS }}
run: |
curl -H "x-token: ${DB_WEBHOOK_X_TOKEN}" -XPOST ${DB_WEBHOOK_URL} ${DB_WEBHOOK_FLAGS}
- name: Upload test ipks
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success' && !cancelled() && inputs.test
with:
name: ipks
path: |
${{ env.SDK_NAME }}/bin/packages/aarch64_cortex-a53/compat
${{ env.SDK_NAME }}/bin/packages/aarch64_cortex-a53/meta