From a4b6dfaffbb2a486403576d9f16c38b1f56b911e Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Fri, 24 Mar 2023 10:29:18 +0100 Subject: [PATCH] CI: sync up with changes in packages repo Catch up with the changes in the packages repository. All changes are manual cherry picks from the packages repo and listed below. ci: update github actions to v3 Update checkout and upload-artifact action to v3 to mute nodejs deprecation warning. Signed-off-by: Christian Marangi (cherry picked from commit 52570d4242822e3db678f5484c2ca3e72f485d52) CI: deprecate $(AUTORELEASE) via comments Autorelease causes some issues like heavy bandwidth usage as well as non-deterministic package releases whenever someone doesn't use the full git log. With this comment all modified packages are checked and if they use the autorelease feature, kindly comment to the user to change that. Signed-off-by: Paul Spooren [ move check to separate workflow to handle ci limitation ] Signed-off-by: Christian Marangi (cherry picked from commit 61d59fd54254b97218aa4e861b1f933d5c5e0bc4) ci: only comment AUTORELEASE deprecation if exists If it doesn't exists, don't confuse the contributors. Signed-off-by: Paul Spooren (cherry picked from commit 75ff4ba358aa0357f0af62cb980568bdc8d390a1) github-ci: error on any shell errors Enable `errexit` and `nounset` [POSIX shell options][1] in `.github/workflows/entrypoint.sh` so that the script fails if any command within the script fails. [1]: https://pubs.opengroup.org/onlinepubs/9699919799//utilities/V3_chap02.html#set Reported-by: Marius Dinu Fixes: https://github.com/openwrt/packages/issues/19953 Signed-off-by: Alois Klink (cherry picked from commit 18d3c529fa4ab8dafcf6c147cf3cb55792d8ca10) CI: update build architectures Removed arc_archs - archs38 was marked as source-only [1]. Renamed powerpc_8540 to powerpc_8548 [2]. 1. https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=c01641bcc7236d2e2de3ea65444b0cf2898df351 2. https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=2cad88b99fdae9766de84e6c1cb56f111eb53748 Signed-off-by: Tianling Shen (cherry picked from commit 29041e8f8eb42dcd8eee03602348b39dbf9d0c70) Signed-off-by: Sebastian Kemper --- .../check-autorelease-deprecation.yml | 91 +++++++++++++++++++ .github/workflows/entrypoint.sh | 6 +- .github/workflows/formal.yml | 2 +- .github/workflows/multi-arch-test-build.yml | 12 +-- 4 files changed, 101 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/check-autorelease-deprecation.yml diff --git a/.github/workflows/check-autorelease-deprecation.yml b/.github/workflows/check-autorelease-deprecation.yml new file mode 100644 index 0000000..b85b324 --- /dev/null +++ b/.github/workflows/check-autorelease-deprecation.yml @@ -0,0 +1,91 @@ +name: Check autorelease deprecation + +on: + pull_request_target: + types: [opened, synchronize, converted_to_draft, ready_for_review, edited] + +jobs: + build: + name: Check autorelease deprecation + runs-on: ubuntu-latest + strategy: + fail-fast: false + + permissions: + pull-requests: write + + 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: Determine changed packages + run: | + RET=0 + + # only detect packages with changes + PKG_ROOTS=$(find . -name Makefile | \ + grep -v ".*/src/Makefile" | \ + sed -e 's@./\(.*\)/Makefile@\1/@') + CHANGES=$(git diff --diff-filter=d --name-only origin/$BRANCH...) + + for ROOT in $PKG_ROOTS; do + for CHANGE in $CHANGES; do + if [[ "$CHANGE" == "$ROOT"* ]]; then + if grep -q '$(AUTORELEASE)' "$ROOT/Makefile"; then + CONTAINS_AUTORELEASE+="$ROOT" + fi + break + fi + done + done + + if [ -n "$CONTAINS_AUTORELEASE" ]; then + RET=1 + cat > "$GITHUB_WORKSPACE/pr_comment.md" << EOF + Please do no longer set *PKG_RELEASE* to *AUTORELEASE* as the + feature is deprecated. Please use an integer instead. Below is a + list of affected packages including correct *PKG_RELEASE*: + + EOF + fi + + for ROOT in $CONTAINS_AUTORELEASE; do + echo -n " - ${ROOT}Makefile: PKG_RELEASE:=" >> "$GITHUB_WORKSPACE/pr_comment.md" + last_bump="$(git log --pretty=format:'%h %s' "$ROOT" | + grep --max-count=1 -e ': [uU]pdate to ' -e ': [bB]ump to ' | + cut -f 1 -d ' ')" + + if [ -n "$last_bump" ]; then + echo -n $(($(git rev-list --count "$last_bump..HEAD" "$ROOT") + 2)) >> "$GITHUB_WORKSPACE/pr_comment.md" + else + echo -n $(($(git rev-list --count HEAD "$ROOT") + 2)) >> "$GITHUB_WORKSPACE/pr_comment.md" + fi + echo >> "$GITHUB_WORKSPACE/pr_comment.md" + done + + exit $RET + + - name: Find Comment + uses: peter-evans/find-comment@v2 + if: ${{ failure() }} + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v2 + if: ${{ failure() }} + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body-file: 'pr_comment.md' + edit-mode: replace diff --git a/.github/workflows/entrypoint.sh b/.github/workflows/entrypoint.sh index 7604105..6af84b8 100755 --- a/.github/workflows/entrypoint.sh +++ b/.github/workflows/entrypoint.sh @@ -1,10 +1,14 @@ #!/bin/sh +# not enabling `errtrace` and `pipefail` since those are bash specific +set -o errexit # failing commands causes script to fail +set -o nounset # undefined variables causes script to fail + mkdir -p /var/lock/ opkg update -[ -n "$CI_HELPER" ] || CI_HELPER="/ci/.github/workflows/ci_helpers.sh" +[ -n "${CI_HELPER:=''}" ] || CI_HELPER="/ci/.github/workflows/ci_helpers.sh" for PKG in /ci/*.ipk; do tar -xzOf "$PKG" ./control.tar.gz | tar xzf - ./control diff --git a/.github/workflows/formal.yml b/.github/workflows/formal.yml index 2560917..b3f824c 100644 --- a/.github/workflows/formal.yml +++ b/.github/workflows/formal.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 diff --git a/.github/workflows/multi-arch-test-build.yml b/.github/workflows/multi-arch-test-build.yml index f8a907b..514c276 100644 --- a/.github/workflows/multi-arch-test-build.yml +++ b/.github/workflows/multi-arch-test-build.yml @@ -11,10 +11,6 @@ jobs: fail-fast: false matrix: include: - - arch: arc_archs - target: archs38-generic - runtime_test: false - - arch: arm_cortex-a9_vfpv3-d16 target: mvebu-cortexa9 runtime_test: false @@ -31,7 +27,7 @@ jobs: target: apm821xx-nand runtime_test: false - - arch: powerpc_8540 + - arch: powerpc_8548 target: mpc85xx-p1010 runtime_test: false @@ -52,7 +48,7 @@ jobs: runtime_test: true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -132,7 +128,7 @@ jobs: cat PKG-INFO - name: Store packages - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{env.ARCHIVE_NAME}}-packages path: | @@ -140,7 +136,7 @@ jobs: PKG-INFO - name: Store logs - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{env.ARCHIVE_NAME}}-logs path: | -- 2.30.2