From 797ad16f5ac20ca929871ed3d43875d7f9bb44a1 Mon Sep 17 00:00:00 2001 From: Vince Jerald Villamora Date: Sun, 15 Oct 2023 05:22:35 +0800 Subject: [PATCH] manual CI --- .github/workflows/Dockerfile.tools | 4 - .github/workflows/build-tools.yml | 72 --- .github/workflows/build.yml | 529 ++++-------------- .github/workflows/check-kernel-patches.yml | 155 ----- .github/workflows/coverity.yml | 65 --- .github/workflows/formal.yml | 73 --- .github/workflows/kernel.yml | 131 ----- .github/workflows/label-kernel.yml | 50 -- .github/workflows/label-target.yml | 41 -- .github/workflows/labeler.yml | 33 -- .github/workflows/packages.yml | 52 -- .github/workflows/push-containers.yml | 98 ---- .github/workflows/scripts/ci_helpers.sh | 26 - .../workflows/scripts/show_build_failures.sh | 15 - .github/workflows/toolchain.yml | 70 --- .github/workflows/tools.yml | 93 --- 16 files changed, 94 insertions(+), 1413 deletions(-) delete mode 100644 .github/workflows/Dockerfile.tools delete mode 100644 .github/workflows/build-tools.yml delete mode 100644 .github/workflows/check-kernel-patches.yml delete mode 100644 .github/workflows/coverity.yml delete mode 100644 .github/workflows/formal.yml delete mode 100644 .github/workflows/kernel.yml delete mode 100644 .github/workflows/label-kernel.yml delete mode 100644 .github/workflows/label-target.yml delete mode 100644 .github/workflows/labeler.yml delete mode 100644 .github/workflows/packages.yml delete mode 100644 .github/workflows/push-containers.yml delete mode 100644 .github/workflows/scripts/ci_helpers.sh delete mode 100755 .github/workflows/scripts/show_build_failures.sh delete mode 100644 .github/workflows/toolchain.yml delete mode 100644 .github/workflows/tools.yml diff --git a/.github/workflows/Dockerfile.tools b/.github/workflows/Dockerfile.tools deleted file mode 100644 index df5892618a7820..00000000000000 --- a/.github/workflows/Dockerfile.tools +++ /dev/null @@ -1,4 +0,0 @@ -FROM ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v2 - -COPY --chown=buildbot staging_dir/host /prebuilt_tools/staging_dir/host -COPY --chown=buildbot build_dir/host /prebuilt_tools/build_dir/host diff --git a/.github/workflows/build-tools.yml b/.github/workflows/build-tools.yml deleted file mode 100644 index 9b865f2608f9bd..00000000000000 --- a/.github/workflows/build-tools.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Build host tools - -on: - workflow_call: - inputs: - generate_prebuilt_artifacts: - type: boolean - -permissions: - contents: read - -jobs: - build: - name: Build tools - runs-on: ubuntu-latest - container: ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v2 - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Fix permission - run: chown -R buildbot:buildbot openwrt - - - name: Set configs for tools container - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - touch .config - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - - - name: Make prereq - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make defconfig - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: linux-buildbot-logs - path: openwrt/logs - - - name: Upload config - if: always() - uses: actions/upload-artifact@v3 - with: - name: linux-buildbot-config - path: openwrt/.config - - - name: Archive prebuilt tools - if: inputs.generate_prebuilt_artifacts == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: tar -cf tools.tar staging_dir/host build_dir/host - - - name: Upload prebuilt tools - if: inputs.generate_prebuilt_artifacts == true - uses: actions/upload-artifact@v3 - with: - name: linux-buildbot-prebuilt-tools - path: openwrt/tools.tar - retention-days: 1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 816ef6ab3cafbf..3dbc324f2648e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,435 +1,94 @@ -name: Build sub target - -on: - workflow_call: - secrets: - coverity_api_token: - inputs: - target: - required: true - type: string - subtarget: - required: true - type: string - testing: - type: boolean - build_toolchain: - type: boolean - include_feeds: - type: boolean - build_full: - type: boolean - build_kernel: - type: boolean - build_all_modules: - type: boolean - build_all_kmods: - type: boolean - build_all_boards: - type: boolean - use_openwrt_container: - type: boolean - default: true - coverity_project_name: - type: string - default: OpenWrt - coverity_check_packages: - type: string - coverity_compiler_template_list: - type: string - default: >- - arm-openwrt-linux-gcc - coverity_force_compile_packages: - type: string - default: >- - curl - libnl - mbedtls - wolfssl - openssl - -permissions: - contents: read - -jobs: - setup_build: - name: Setup build ${{ inputs.target }}/${{ inputs.subtarget }} - runs-on: ubuntu-latest - outputs: - owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} - ccache_hash: ${{ steps.ccache_hash.outputs.ccache_hash }} - container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set lower case owner name - id: lower_owner - run: | - OWNER_LC=$(echo "${{ github.repository_owner }}" \ - | tr '[:upper:]' '[:lower:]') - - if [ ${{ inputs.use_openwrt_container }} == "true" ]; then - OWNER_LC=openwrt - fi - - echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - - - name: Generate ccache hash - id: ccache_hash - run: | - CCACHE_HASH=$(md5sum include/kernel-* | awk '{ print $1 }' \ - | md5sum | awk '{ print $1 }') - echo "ccache_hash=$CCACHE_HASH" >> $GITHUB_OUTPUT - - # Per branch tools container tag - # By default stick to latest - # For official test targetting openwrt stable branch - # Get the branch or parse the tag and push dedicated tools containers - # For local test to use the correct container for stable release testing - # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]- - - name: Determine tools container tag - id: determine_tools_container - run: | - CONTAINER_TAG=latest - if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG="${{ github.base_ref }}" - fi - elif [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG=${{ github.ref_name }} - elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then - CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" - fi - elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - echo "Tools container to use tools:$CONTAINER_TAG" - echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT - - build: - name: Build ${{ inputs.target }}/${{ inputs.subtarget }} - needs: setup_build - runs-on: ubuntu-latest - - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }} - - permissions: - contents: read - packages: read - - steps: - - name: Checkout master directory - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Checkout packages feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/packages - path: openwrt/feeds/packages - - - name: Checkout luci feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/luci - path: openwrt/feeds/luci - - - name: Checkout routing feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/routing - path: openwrt/feeds/routing - - - name: Checkout telephony feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/telephony - path: openwrt/feeds/telephony - - - name: Parse toolchain file - if: inputs.build_toolchain == false - id: parse-toolchain - working-directory: openwrt - run: | - TOOLCHAIN_PATH=snapshots - - if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - major_ver="$(echo ${{ github.base_ref }} | sed 's/^openwrt-/v/')" - fi - elif [ "${{ github.ref_type }}" = "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-/v/')" - elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then - major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-\([0-9][0-9]\.[0-9][0-9]\)-.*/v\1/')" - fi - elif [ "${{ github.ref_type }}" = "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then - major_ver="$(echo ${{ github.ref_name }} | sed 's/^\(v[0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - - if [ -n "$major_ver" ]; then - git fetch --tags -f - latest_tag="$(git tag --sort=-creatordate -l $major_ver* | head -n1)" - if [ -n "$latest_tag" ]; then - TOOLCHAIN_PATH=releases/$(echo $latest_tag | sed 's/^v//') - fi - fi - - SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums" - if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then - TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")" - TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') - - echo "toolchain-type=external_toolchain" >> $GITHUB_OUTPUT - elif curl $SUMS_FILE | grep -q ".*openwrt-sdk.*tar.xz"; then - TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-sdk.*tar.xz")" - TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-sdk.*\).tar.xz/\1/p') - - echo "toolchain-type=external_sdk" >> $GITHUB_OUTPUT - else - echo "toolchain-type=internal" >> $GITHUB_OUTPUT - fi - - echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" - echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV" - - - name: Fix permission - run: | - chown -R buildbot:buildbot openwrt - - - name: Prepare prebuilt tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - 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: Update & Install feeds - if: inputs.include_feeds == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - ./scripts/feeds update -a - ./scripts/feeds install -a - - - name: Cache ccache - uses: actions/cache@v3 - with: - path: openwrt/.ccache - key: ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-${{ needs.setup_build.outputs.ccache_hash }} - restore-keys: | - ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}- - - - name: Download external toolchain/sdk - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \ - | tar --xz -xf - - - - name: Configure testing kernel - if: inputs.testing == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_TESTING_KERNEL=y >> .config - - - name: Configure all kernel modules - if: inputs.build_all_kmods == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL_KMODS=y >> .config - - - name: Configure all modules - if: inputs.build_all_modules == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL=y >> .config - - - name: Configure all boards - if: inputs.build_all_boards == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_TARGET_MULTI_PROFILE=y >> .config - echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config - echo CONFIG_TARGET_ALL_PROFILES=y >> .config - - - name: Configure external toolchain - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_toolchain' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - - ./scripts/ext-toolchain.sh \ - --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ - --overwrite-config \ - --config ${{ inputs.target }}/${{ inputs.subtarget }} - - - name: Adapt external sdk to external toolchain format - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - TOOLCHAIN_DIR=${{ env.TOOLCHAIN_FILE }}/staging_dir/$(ls ${{ env.TOOLCHAIN_FILE }}/staging_dir | grep toolchain) - TOOLCHAIN_BIN=$TOOLCHAIN_DIR/bin - OPENWRT_DIR=$(pwd) - - # Find target name from toolchain info.mk - GNU_TARGET_NAME=$(cat $TOOLCHAIN_DIR/info.mk | grep TARGET_CROSS | sed 's/^TARGET_CROSS=\(.*\)-$/\1/') - - cd $TOOLCHAIN_BIN - - # Revert sdk wrapper scripts applied to all the bins - for app in $(find . -name "*.bin"); do - TARGET_APP=$(echo $app | sed 's/\.\/\.\(.*\)\.bin/\1/') - rm $TARGET_APP - mv .$TARGET_APP.bin $TARGET_APP - done - - # Setup the wrapper script in the sdk toolchain dir simulating an external toolchain build - cp $OPENWRT_DIR/target/toolchain/files/wrapper.sh $GNU_TARGET_NAME-wrapper.sh - for app in cc gcc g++ c++ cpp ld as ; do - [ -f $GNU_TARGET_NAME-$app ] && mv $GNU_TARGET_NAME-$app $GNU_TARGET_NAME-$app.bin - ln -sf $GNU_TARGET_NAME-wrapper.sh $GNU_TARGET_NAME-$app - done - - - name: Configure external toolchain with sdk - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - - ./scripts/ext-toolchain.sh \ - --toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \ - --overwrite-config \ - --config ${{ inputs.target }}/${{ inputs.subtarget }} - - - name: Configure internal toolchain - if: inputs.build_toolchain == true || steps.parse-toolchain.outputs.toolchain-type == 'internal' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - - echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config - echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config - - make defconfig - - - name: Show configuration - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: ./scripts/diffconfig.sh - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build toolchain - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build Kernel - if: inputs.build_kernel == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build Kernel Kmods - if: inputs.build_kernel == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make package/linux/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build everything - if: inputs.build_full == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Coverity prepare toolchain - if: inputs.coverity_check_packages != '' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}" -O coverity.tar.gz - wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}&md5=1" -O coverity.tar.gz.md5 - echo ' coverity.tar.gz' >> coverity.tar.gz.md5 - md5sum -c coverity.tar.gz.md5 - - mkdir cov-analysis-linux64 - tar xzf coverity.tar.gz --strip 1 -C cov-analysis-linux64 - export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH - - for template in ${{ inputs.coverity_compiler_template_list }}; do - cov-configure --template --comptype gcc --compiler "$template" - done - - - name: Clean and recompile packages with Coverity toolchain - if: inputs.coverity_check_packages != '' - shell: su buildbot -c "bash {0}" - working-directory: openwrt - run: | - set -o pipefail -o errexit - - coverity_check_packages=(${{ inputs.coverity_check_packages }}) - printf -v clean_packages "package/%s/clean " "${coverity_check_packages[@]}" - make -j$(nproc) BUILD_LOG=1 $clean_packages || ret=$? .github/workflows/scripts/show_build_failures.sh - - coverity_force_compile_packages=(${{ inputs.coverity_force_compile_packages }}) - printf -v force_compile_packages "package/%s/compile " "${coverity_force_compile_packages[@]}" - make -j$(nproc) BUILD_LOG=1 $force_compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh - - printf -v compile_packages "package/%s/compile " "${coverity_check_packages[@]}" - export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH - cov-build --dir cov-int make -j $(nproc) BUILD_LOG=1 $compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload build to Coverity for analysis - if: inputs.coverity_check_packages != '' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - tar czf cov-int.tar.gz ./cov-int - curl \ - --form token="${{ secrets.coverity_api_token }}" \ - --form email="contact@openwrt.org" \ - --form file=@cov-int.tar.gz \ - --form version="${{ github.ref_name }}-${{ github.sha }}" \ - --form description="OpenWrt ${{ github.ref_name }}-${{ github.sha }}" \ - "https://scan.coverity.com/builds?project=${{ inputs.coverity_project_name }}" - - - name: Upload logs - if: failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs - path: "openwrt/logs" +# +# +# +# Copyright (C) 2019 P3TERX +# +# Copyright (C) 2020 KFERMercer +# +name: OpenWrt-CI + +on: + schedule: + - cron: 0 0 1 * * + workflow_dispatch: + +permissions: + contents: read + +jobs: + + build_openwrt: + + name: Build OpenWrt Firmware + + runs-on: ubuntu-latest + + steps: + - name: Space cleanup and Initialization environment + env: + DEBIAN_FRONTEND: noninteractive + run: | + docker rmi `docker images -q` + sudo -E rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android + sudo -E apt-mark hold grub-efi-amd64-signed + sudo -E apt update + sudo -E apt -y purge azure-cli* docker* ghc* zulu* llvm* firefox google* dotnet* powershell* openjdk* mysql* php* mongodb* dotnet* snap* + sudo -E apt -y full-upgrade + sudo -E apt -y install ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python3 python3-pip libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev + sudo -E systemctl daemon-reload + sudo -E apt -y autoremove --purge + sudo -E apt clean + sudo -E timedatectl set-timezone "Asia/Shanghai" + + - name: Checkout OpenWrt + uses: actions/checkout@v3 + + - name: Update feeds + run: | + sed -i 's/#src-git helloworld/src-git helloworld/g' ./feeds.conf.default + ./scripts/feeds update -a + ./scripts/feeds install -a + + - name: Generate configuration file + run: make defconfig + + - name: Download packages + run: make download -j16 + + - name: Compile firmware + run: | + make -j$(nproc) || make -j1 V=s + echo "=======================" + echo "Space usage:" + echo "=======================" + df -h + echo "=======================" + du -h --max-depth=1 ./ --exclude=build_dir --exclude=bin + du -h --max-depth=1 ./build_dir + du -h --max-depth=1 ./bin + + - name: Prepare artifact + run: | + mkdir -p ./artifact/package + mkdir -p ./artifact/buildinfo + rm -rf $(find ./bin/targets/ -type d -name "packages") + cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/ + cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/ + + - name: Upload buildinfo + uses: actions/upload-artifact@v3 + with: + name: OpenWrt_buildinfo + path: ./artifact/buildinfo/ + + - name: Upload package + uses: actions/upload-artifact@v3 + with: + name: OpenWrt_package + path: ./artifact/package/ + + - name: Upload firmware + uses: actions/upload-artifact@v3 + with: + name: OpenWrt_firmware + path: ./bin/targets/ \ No newline at end of file diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml deleted file mode 100644 index 1ab4a361f5355e..00000000000000 --- a/.github/workflows/check-kernel-patches.yml +++ /dev/null @@ -1,155 +0,0 @@ -name: Refresh kernel for target - -on: - workflow_call: - inputs: - target: - required: true - type: string - subtarget: - required: true - type: string - testing: - type: boolean - use_openwrt_container: - type: boolean - default: true - -permissions: - contents: read - -jobs: - setup_build: - name: Setup build - runs-on: ubuntu-latest - outputs: - owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} - container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} - - steps: - - name: Set lower case owner name - id: lower_owner - run: | - OWNER_LC=$(echo "${{ github.repository_owner }}" \ - | tr '[:upper:]' '[:lower:]') - - if [ ${{ inputs.use_openwrt_container }} == "true" ]; then - OWNER_LC=openwrt - fi - - echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - - # Per branch tools container tag - # By default stick to latest - # For official test targetting openwrt stable branch - # Get the branch or parse the tag and push dedicated tools containers - # For local test to use the correct container for stable release testing - # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]- - - name: Determine tools container tag - id: determine_tools_container - run: | - CONTAINER_TAG=latest - if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG="${{ github.base_ref }}" - fi - elif [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG=${{ github.ref_name }} - elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then - CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" - fi - elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - echo "Tools container to use tools:$CONTAINER_TAG" - echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT - - check-patch: - name: Check Kernel patches - needs: setup_build - runs-on: ubuntu-latest - - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }} - - permissions: - contents: read - packages: read - - steps: - - name: Checkout master directory - uses: actions/checkout@v3 - with: - 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: | - mkdir -p staging_dir build_dir - ln -sf /prebuilt_tools/staging_dir/host staging_dir/host - ln -sf /prebuilt_tools/build_dir/host build_dir/host - - ./scripts/ext-tools.sh --refresh - - - name: Configure testing kernel - if: inputs.testing == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_TESTING_KERNEL=y >> .config - - - name: Configure system - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL_KMODS=y >> .config - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - - echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config - echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config - - make defconfig - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/quilt/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Refresh Kernel patches - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make target/linux/refresh V=s - - - name: Validate Refreshed Kernel Patches - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - . .github/workflows/scripts/ci_helpers.sh - - if git diff --name-only --exit-code; then - success "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} seems ok" - else - err "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} require refresh. (run 'make target/linux/refresh' and force push this pr)" - err "You can also check the provided artifacts with the refreshed patch from this CI run." - mkdir ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed - for f in $(git diff --name-only); do - cp --parents $f ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed/ - done - exit 1 - fi - - - name: Upload Refreshed Patches - if: failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed - path: openwrt/${{ inputs.target }}-${{ inputs.subtarget }}-refreshed diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml deleted file mode 100644 index db59ef8ca68e86..00000000000000 --- a/.github/workflows/coverity.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Coverity scan build - -on: - schedule: - - cron: '30 2 * * 6' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - -jobs: - coverity_build: - name: Coverity x86/64 build - secrets: - coverity_api_token: ${{ secrets.COVERITY_API_TOKEN }} - permissions: - contents: read - packages: read - uses: ./.github/workflows/build.yml - with: - target: x86 - subtarget: 64 - build_full: true - include_feeds: true - coverity_compiler_template_list: >- - x86_64-openwrt-linux-gcc - x86_64-openwrt-linux-musl-gcc - # qosify fails to build with cov-build - coverity_check_packages: >- - cgi-io - dnsmasq - dropbear - firewall - fstools - fwtool - iwinfo - jsonfilter - libnl-tiny - libubox - mtd - netifd - odhcp6c - odhcpd - opkg - procd - relayd - rpcd - swconfig - ubox - ubus - ucert - uci - uclient - ucode - ugps - uhttpd - umbim - umdns - unetd - uqmi - urngd - usbmode - usign - usteer - ustp - ustream-ssl diff --git a/.github/workflows/formal.yml b/.github/workflows/formal.yml deleted file mode 100644 index 8083c5832ca4d4..00000000000000 --- a/.github/workflows/formal.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Test Formalities - -on: - pull_request: - -permissions: - contents: read - -jobs: - build: - name: Test Formalities - runs-on: ubuntu-latest - strategy: - fail-fast: false - - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Determine branch name - run: | - BRANCH="${GITHUB_BASE_REF#refs/heads/}" - echo "Building for $BRANCH" - echo "BRANCH=$BRANCH" >> $GITHUB_ENV - - - name: Test formalities - run: | - source .github/workflows/scripts/ci_helpers.sh - - RET=0 - for commit in $(git rev-list HEAD ^origin/$BRANCH); do - info "=== Checking commit '$commit'" - if git show --format='%P' -s $commit | grep -qF ' '; then - err "Pull request should not include merge commits" - RET=1 - fi - - author="$(git show -s --format=%aN $commit)" - if echo $author | grep -q '\S\+\s\+\S\+'; then - success "Author name ($author) seems ok" - else - err "Author name ($author) need to be your real name 'firstname lastname'" - RET=1 - fi - - subject="$(git show -s --format=%s $commit)" - if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_\.-]\+: ' -e '^Revert '; then - success "Commit subject line seems ok ($subject)" - else - err "Commit subject line MUST start with ': ' ($subject)" - RET=1 - fi - - body="$(git show -s --format=%b $commit)" - sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)" - if echo "$body" | grep -qF "$sob"; then - success "Signed-off-by match author" - else - err "Signed-off-by is missing or doesn't match author (should be '$sob')" - RET=1 - fi - - if echo "$body" | grep -v "Signed-off-by:"; then - success "A commit message exists" - else - err "Missing commit message. Please describe your changes" - RET=1 - fi - done - - exit $RET diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml deleted file mode 100644 index 02aee8b27cc8ad..00000000000000 --- a/.github/workflows/kernel.yml +++ /dev/null @@ -1,131 +0,0 @@ -name: Build Kernel - -on: - pull_request: - paths: - - '.github/workflows/check-kernel-patches.yml' - - '.github/workflows/build.yml' - - '.github/workflows/kernel.yml' - - 'include/kernel*' - - 'package/kernel/**' - - 'target/linux/**' - push: - paths: - - '.github/workflows/check-kernel-patches.yml' - - '.github/workflows/build.yml' - - '.github/workflows/kernel.yml' - - 'include/kernel*' - - 'package/kernel/**' - - 'target/linux/**' - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -jobs: - determine_targets: - name: Set targets - runs-on: ubuntu-latest - outputs: - targets_subtargets: ${{ steps.find_targets.outputs.targets_subtargets }} - targets: ${{ steps.find_targets.outputs.targets }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35 - - - name: Set targets - id: find_targets - run: | - ALL_TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null)" - CHANGED_FILES="$(echo ${{ steps.changed-files.outputs.all_changed_files }} | tr ' ' '\n')" - - TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1 | awk '{ print $1 }')" - TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1 | awk '{ print $1 }')" - - # On testing non-specific target, skip testing each subtarget - if echo "$CHANGED_FILES" | grep -v -q target/linux || - echo "$CHANGED_FILES" | grep -q target/linux/generic; then - TARGETS_SUBTARGETS=$TARGETS - fi - - JSON_TARGETS_SUBTARGETS='[' - FIRST=1 - for TARGET in $TARGETS_SUBTARGETS; do - if echo "$CHANGED_FILES" | grep -v -q target/linux || - echo "$CHANGED_FILES" | grep -q target/linux/generic || - echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"',' - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE" - FIRST=0 - fi - done - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']' - - JSON_TARGETS='[' - FIRST=1 - for TARGET in $TARGETS; do - if echo "$CHANGED_FILES" | grep -v -q target/linux || - echo "$CHANGED_FILES" | grep -q target/linux/generic || - echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"',' - JSON_TARGETS="$JSON_TARGETS""$TUPLE" - FIRST=0 - fi - done - JSON_TARGETS="$JSON_TARGETS"']' - - echo -e "\n---- targets to build ----\n" - echo "$JSON_TARGETS_SUBTARGETS" - echo -e "\n---- targets to build ----\n" - - echo -e "\n---- targets to check patch ----\n" - echo "$JSON_TARGETS" - echo -e "\n---- targets to check patch ----\n" - - echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT - echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT - - build: - name: Build Kernel with external toolchain - needs: determine_targets - permissions: - contents: read - packages: read - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}} - uses: ./.github/workflows/build.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_kernel: true - build_all_kmods: true - - check-kernel-patches: - name: Check Kernel patches - needs: determine_targets - permissions: - contents: read - packages: read - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.targets)}} - uses: ./.github/workflows/check-kernel-patches.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml deleted file mode 100644 index 67faaddfcdfce4..00000000000000 --- a/.github/workflows/label-kernel.yml +++ /dev/null @@ -1,50 +0,0 @@ -# ci:kernel:x86:64 is going to trigger CI kernel check jobs for x86/64 target - -name: Build kernel and check patches for target specified in labels -on: - pull_request: - types: - - labeled - -jobs: - set_target: - if: startsWith(github.event.label.name, 'ci:kernel:') - name: Set target - runs-on: ubuntu-latest - outputs: - target: ${{ steps.set_target.outputs.target }} - subtarget: ${{ steps.set_target.outputs.subtarget }} - - steps: - - name: Set target - id: set_target - env: - CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} - run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT - - build_kernel: - name: Build Kernel with external toolchain - needs: set_target - permissions: - contents: read - packages: read - uses: ./.github/workflows/build.yml - with: - container_name: toolchain - target: ${{ needs.set_target.outputs.target }} - subtarget: ${{ needs.set_target.outputs.subtarget }} - build_kernel: true - build_all_kmods: true - - check-kernel-patches: - name: Check Kernel patches - needs: set_target - permissions: - contents: read - packages: read - uses: ./.github/workflows/check-kernel-patches.yml - with: - target: ${{ needs.set_target.outputs.target }} - subtarget: ${{ needs.set_target.outputs.subtarget }} diff --git a/.github/workflows/label-target.yml b/.github/workflows/label-target.yml deleted file mode 100644 index 78aea28b106b80..00000000000000 --- a/.github/workflows/label-target.yml +++ /dev/null @@ -1,41 +0,0 @@ -# ci:target:x86:64 is going to trigger CI target check jobs for x86/64 target - -name: Build check target specified in labels -on: - pull_request: - types: - - labeled - -jobs: - set_target: - if: startsWith(github.event.label.name, 'ci:target:') - name: Set target - runs-on: ubuntu-latest - outputs: - target: ${{ steps.set_target.outputs.target }} - subtarget: ${{ steps.set_target.outputs.subtarget }} - - steps: - - name: Set target - id: set_target - env: - CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} - run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT - - build_target: - name: Build target - needs: set_target - permissions: - contents: read - packages: read - uses: ./.github/workflows/build.yml - with: - container_name: toolchain - target: ${{ needs.set_target.outputs.target }} - subtarget: ${{ needs.set_target.outputs.subtarget }} - build_full: true - build_all_kmods: true - build_all_boards: true - build_all_modules: true diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index 5f82b88a50a7dc..00000000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: 'Pull Request Labeler' -on: - - pull_request_target - -permissions: - contents: read - -jobs: - labeler: - permissions: - contents: read # to determine modified files (actions/labeler) - pull-requests: write # to add labels to PRs (actions/labeler) - - name: Pull Request Labeler - runs-on: ubuntu-latest - steps: - - uses: actions/labeler@v4 - with: - repo-token: '${{ secrets.GITHUB_TOKEN }}' - - - name: Check Branch - id: check-branch - run: | - if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then - echo "release-tag=$(echo ${{ github.base_ref }} | sed 's/openwrt-/release\//')" >> $GITHUB_OUTPUT - fi - - - uses: buildsville/add-remove-label@v2.0.0 - if: ${{ steps.check-branch.outputs.release-tag }} - with: - token: ${{secrets.GITHUB_TOKEN}} - labels: ${{ steps.check-branch.outputs.release-tag }} - type: add diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml deleted file mode 100644 index e2f932b1ba3d42..00000000000000 --- a/.github/workflows/packages.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Build all core packages - -on: - pull_request: - paths: - - '.github/workflows/build.yml' - - '.github/workflows/packages.yml' - - 'config/**' - - 'include/**' - - 'package/**' - - 'target/linux/generic/**' - - 'toolchain/**' - push: - paths: - - '.github/workflows/build.yml' - - '.github/workflows/packages.yml' - - 'config/**' - - 'include/**' - - 'package/**' - - 'target/linux/generic/**' - - 'toolchain/**' - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -jobs: - build: - name: Build Packages with external toolchain - permissions: - contents: read - packages: read - strategy: - fail-fast: False - matrix: - include: - - target: malta - subtarget: be - - target: x86 - subtarget: 64 - uses: ./.github/workflows/build.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_kernel: true - build_all_kmods: true - build_all_modules: true - build_full: true - diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml deleted file mode 100644 index e74e7c22167833..00000000000000 --- a/.github/workflows/push-containers.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Build and Push prebuilt tools container - -on: - push: - paths: - - 'include/version.mk' - - 'include/cmake.mk' - - 'tools/**' - - '.github/workflows/build-tools.yml' - - '.github/workflows/push-containers.yml' - - '.github/workflows/Dockerfile.tools' - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build-linux-buildbot: - name: Build tools with buildbot container - if: ${{ github.repository_owner == 'openwrt' }} - uses: ./.github/workflows/build-tools.yml - with: - generate_prebuilt_artifacts: true - - push-tools-container: - needs: build-linux-buildbot - name: Push prebuilt tools container - if: ${{ github.repository_owner == 'openwrt' }} - runs-on: ubuntu-latest - - permissions: - contents: read - packages: write - - steps: - - name: Set lower case owner name - env: - OWNER: ${{ github.repository_owner }} - run: | - echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV" - - # Per branch tools container tag - # By default stick to latest - # For official test targetting openwrt stable branch - # Get the branch or parse the tag and push dedicated tools containers - # Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9] - # will refresh the tools container with the matching tag. - # (example branch openwrt-22.03 -> tools:openwrt-22.03) - # (example branch openwrt-22.03-test -> tools:openwrt-22.03) - - name: Determine tools container tag - run: | - CONTAINER_TAG=latest - - if [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then - CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\).*/\1/')" - fi - elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - - echo "Tools container to push tools:$CONTAINER_TAG" - echo "CONTAINER_TAG=$CONTAINER_TAG" >> "$GITHUB_ENV" - - - name: Checkout - uses: actions/checkout@v3 - with: - path: 'openwrt' - - - name: Download prebuilt tools from build job - uses: actions/download-artifact@v3 - with: - name: linux-buildbot-prebuilt-tools - path: openwrt - - - name: Extract prebuild tools - working-directory: openwrt - run: tar -xf tools.tar - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: openwrt - push: true - tags: ghcr.io/${{ env.OWNER_LC }}/tools:${{ env.CONTAINER_TAG }} - file: openwrt/.github/workflows/Dockerfile.tools diff --git a/.github/workflows/scripts/ci_helpers.sh b/.github/workflows/scripts/ci_helpers.sh deleted file mode 100644 index 2f9daf81e2bad6..00000000000000 --- a/.github/workflows/scripts/ci_helpers.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -color_out() { - printf "\e[0;$1m%s\e[0;0m\n" "$2" -} - -success() { - color_out 32 "$1" -} - -info() { - color_out 36 "$1" -} - -err() { - color_out 31 "$1" -} - -warn() { - color_out 33 "$1" -} - -err_die() { - err "$1" - exit 1 -} diff --git a/.github/workflows/scripts/show_build_failures.sh b/.github/workflows/scripts/show_build_failures.sh deleted file mode 100755 index 7b1a021155bdc1..00000000000000 --- a/.github/workflows/scripts/show_build_failures.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -original_exit_code="${ret:-1}" -log_dir_path="${1:-logs}" -context="${2:-10}" - -show_make_build_errors() { - grep -slr 'make\[[[:digit:]]\+\].*Error [[:digit:]]\+$' "$log_dir_path" | while IFS= read -r log_file; do - printf "====== Make errors from %s ======\n" "$log_file"; - grep -r -C"$context" 'make\[[[:digit:]]\+\].*Error [[:digit:]]\+$' "$log_file" ; - done -} - -show_make_build_errors -exit "$original_exit_code" diff --git a/.github/workflows/toolchain.yml b/.github/workflows/toolchain.yml deleted file mode 100644 index 5755ca25b9db4a..00000000000000 --- a/.github/workflows/toolchain.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Build Toolchains - -on: - pull_request: - paths: - - '.github/workflows/build.yml' - - '.github/workflows/toolchain.yml' - - 'toolchain/**' - push: - paths: - - '.github/workflows/build.yml' - - '.github/workflows/toolchain.yml' - - 'toolchain/**' - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -jobs: - determine_targets: - name: Set targets - runs-on: ubuntu-latest - outputs: - target: ${{ steps.find_targets.outputs.target }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set targets - id: find_targets - run: | - export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null \ - | sort -u -t '/' -k1,1 \ - | awk '{ print $1 }')" - - JSON='[' - FIRST=1 - for TARGET in $TARGETS; do - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $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 Target Toolchain - needs: determine_targets - permissions: - contents: read - packages: read - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.target)}} - uses: ./.github/workflows/build.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_toolchain: true diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml deleted file mode 100644 index 76ebdc664b89ae..00000000000000 --- a/.github/workflows/tools.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Build host tools - -on: - pull_request: - paths: - - 'include/**' - - 'tools/**' - - '.github/workflows/build-tools.yml' - - '.github/workflows/tools.yml' - push: - paths: - - 'include/**' - - 'tools/**' - - '.github/workflows/build-tools.yml' - - '.github/workflows/tools.yml' - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -jobs: - build-macos-latest: - name: Build tools with macos latest - runs-on: macos-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Setup MacOS - run: | - echo "WORKPATH=/Volumes/OpenWrt" >> "$GITHUB_ENV" - hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage - hdiutil attach OpenWrt.sparseimage - mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/ - - - name: Install required prereq on MacOS - working-directory: ${{ env.WORKPATH }}/openwrt - run: | - brew install \ - automake \ - coreutils \ - diffutils \ - findutils \ - gawk \ - git-extras \ - gnu-getopt \ - gnu-sed \ - grep \ - make - - echo "/bin" >> "$GITHUB_PATH" - echo "/sbin/Library/Apple/usr/bin" >> "$GITHUB_PATH" - echo "/usr/bin" >> "$GITHUB_PATH" - echo "/usr/local/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/coreutils/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/findutils/libexec/gnubin" >> "$GITHUB_PATH" - echo "/usr/local/opt/gettext/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/gnu-getopt/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH" - echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH" - echo "/usr/sbin" >> "$GITHUB_PATH" - - - name: Make prereq - working-directory: ${{ env.WORKPATH }}/openwrt - run: make defconfig - - - name: Build tools MacOS - working-directory: ${{ env.WORKPATH }}/openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: macos-latest-logs - path: ${{ env.WORKPATH }}/openwrt/logs - - - name: Upload config - if: always() - uses: actions/upload-artifact@v3 - with: - name: macos-latest-config - path: ${{ env.WORKPATH }}/openwrt/.config - - build-linux-buildbot: - name: Build tools with buildbot container - uses: ./.github/workflows/build-tools.yml