Skip to content

ci: test commit to build everything #1

ci: test commit to build everything

ci: test commit to build everything #1

Workflow file for this run

name: Build ApkWrt snapshot
on:
push:
workflow_dispatch:
inputs:
target:
description: "Targets to build (x86/64 ath79/genric mediatek/mt7622)"
required: false
default: "x86/64 ath79/generic mediatek/mt7622"
config:
description: "Extra lines to append to the config"
required: false
default: ""
jobs:
determine_targets:
name: Set targets
runs-on: ubuntu-latest
outputs:
target: ${{ steps.find_targets.outputs.target }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set targets
id: find_targets
run: |
if [ "${{ github.event.inputs.target }}" = "all" ]; then
export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null | awk '{ print $1 }')"
else
if [ -n "${{ github.event.inputs.target }}" ]; then
export TARGETS="${{ github.event.inputs.target }}"
else
export TARGETS="x86/64 ath79/generic mediatek/mt7622"
fi
fi
JSON='['
FIRST=1
for TARGET_SUBTARGET in $TARGETS; do
TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1)
SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2)
TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","os":"ubuntu-latest"}'
[[ $FIRST -ne 1 ]] && JSON="$JSON"','
JSON="$JSON""$TUPLE"
FIRST=0
done
JSON="$JSON"']'
echo -e "\n---- targets ----\n"
echo "$JSON"
echo -e "\n---- targets ----\n"
echo "target=$JSON" >> $GITHUB_OUTPUT
build:
name: Build ${{ matrix.os }}/${{ matrix.target }}/${{ matrix.subtarget }}
needs: determine_targets
runs-on: ${{ matrix.os }}
strategy:
fail-fast: False
matrix:
include: ${{fromJson(needs.determine_targets.outputs.target)}}
container: ghcr.io/openwrt/toolchain:${{ matrix.target }}-${{ matrix.subtarget }}-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: openwrt
- name: Fix permission
run: |
chown -R buildbot:buildbot openwrt
- name: Prepare prebuilt tools
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
cd "$WORKPATH"
mkdir -p staging_dir build_dir
ln -s /prebuilt_tools/staging_dir/host staging_dir/host
ln -s /prebuilt_tools/build_dir/host build_dir/host
./scripts/ext-tools.sh --refresh
- name: Initialization environment
run: |
echo "TARGET=${{ matrix.target }}" >> "$GITHUB_ENV"
echo "SUBTARGET=${{ matrix.subtarget }}" >> "$GITHUB_ENV"
- name: Update & Install feeds
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
./scripts/feeds update -a
./scripts/feeds install -a -p base -d m
./scripts/feeds install -a
- name: Set configuration
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
curl "https://downloads.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/config.buildinfo" > .config
for CONFIG in ${{ github.event.inputs.config }}; do
echo "CONFIG_$CONFIG" >> .config
done
echo "CONFIG_USE_APK=y" >> .config
echo "CONFIG_BPF_TOOLCHAIN_HOST=y" >> .config
echo "CONFIG_PACKAGE_uxc=m" >> .config
echo "CONFIG_PACKAGE_uvol=m" >> .config
echo "CONFIG_PACKAGE_strace=m" >> .config
echo "CONFIG_PACKAGE_tmate=m" >> .config
echo "CONFIG_PACKAGE_luci=m" >> .config
echo "CONFIG_PACKAGE_freeswitch=m" >> .config
echo -e "\n---- config input ----\n"
cat .config
echo -e "\n---- config input ----\n"
make defconfig
echo -e "\n---- config post-defconfig ----\n"
cat .config
echo -e "\n---- config post-defconfig ----\n"
echo "${{ secrets.PUBLIC_KEY_PEM }}" > public-key.pem
echo "${{ secrets.PRIVATE_KEY_PEM }}" > private-key.pem
- name: Setup reusable
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
echo CONFIG_DEVEL=y >> .config
echo CONFIG_AUTOREMOVE=y >> .config
make defconfig
- name: Configure external toolchain in container
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
./scripts/ext-toolchain.sh \
--toolchain /external-toolchain/$(ls /external-toolchain/ | grep openwrt-toolchain)/toolchain-* \
--overwrite-config \
--config ${{ env.TARGET }}/${{ env.SUBTARGET }}
- name: Build tools
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
make tools/install -j$(nproc) || \
make tools/install V=s
- name: Build toolchain
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
make toolchain/install -j$(nproc) || \
make toolchain/install V=s
- name: Build target
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
make target/compile -j$(nproc) IGNORE_ERRORS='n m' || \
make target/compile IGNORE_ERRORS='n m' V=s
- name: Build packages
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
make package/apk/host/compile -j$(nproc) || \
make package/apk/host/compile V=s
make package/compile -j$(nproc) IGNORE_ERRORS='n m' || \
make package/compile IGNORE_ERRORS='n m' V=s
make package/index V=s
- name: Determine Kernel version
working-directory: openwrt
run: |
export TOPDIR=$(pwd)
KERNEL_VERSION="$(make --no-print-directory -C target/linux \
val.LINUX_VERSION val.LINUX_RELEASE val.LINUX_VERMAGIC | \
tr '\n' '-' | head -c -1)"
echo "KERNEL_VERSION=$KERNEL_VERSION" >> "$GITHUB_ENV"
- name: Determine architecutre
working-directory: openwrt
run: |
echo "ARCH=$(make val.ARCH_PACKAGES)" >> "$GITHUB_ENV"
- name: Upload packages
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: apk
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_ENDPOINT: ${{ secrets.AWS_S3_ENDPOINT }}
AWS_REGION: auto
SOURCE_DIR: openwrt/bin/packages/${{ env.ARCH }}/
DEST_DIR: packages/${{ env.ARCH }}/
- name: Prepare upload of kmods
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
continue-on-error: true
run: |
KMOD_DIR="bin/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/kmods/${{ env.KERNEL_VERSION }}/"
mkdir -p "$KMOD_DIR"
cp bin/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}//packages/kmod-*.apk "$KMOD_DIR"
make package/index V=s PACKAGE_SUBDIRS="$KMOD_DIR"
- name: Upload kmods
continue-on-error: true
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: apk
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_ENDPOINT: ${{ secrets.AWS_S3_ENDPOINT }}
AWS_REGION: auto
SOURCE_DIR: openwrt/bin/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/kmods/${{ env.KERNEL_VERSION }}/
DEST_DIR: targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/kmods/${{ env.KERNEL_VERSION }}/
- name: Install packages
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
make package/install -j$(nproc) || \
make package/install V=s
- name: Build firmware
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
make target/install -j$(nproc) || \
make target/install V=s
- name: Buildinfo
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
make buildinfo V=s
- name: JSON overview
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
make json_overview_image_info V=s
- name: Checksum
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
make checksum V=s
- name: Clean build
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
rm -rf staging_dir/ build_dir
- name: Upload target
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: apk
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_ENDPOINT: ${{ secrets.AWS_S3_ENDPOINT }}
AWS_REGION: auto
SOURCE_DIR: openwrt/bin/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/
DEST_DIR: targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/