summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Schlehofer <pepe.schlehofer@gmail.com>2023-07-05 20:03:49 +0200
committerGitHub <noreply@github.com>2023-07-05 20:03:49 +0200
commit1b720129f7928d7a22ac9e7d27a700789dc851b1 (patch)
tree6943e01851b98ad10d96569bfacccde223cccb50
parent4918a57b0efa171f0c058f19417cf58f28f30ca1 (diff)
parentea8de65fb7095d77e40863fb1f75f667b98b2018 (diff)
Merge pull request #982 from PolynomialDivision/23-05-ci-backports
[23.05] CI - GitHub actions sync with the latest changes from OpenWrt packages repository
-rw-r--r--.github/workflows/check-autorelease-deprecation.yml91
-rwxr-xr-x.github/workflows/entrypoint.sh29
-rw-r--r--.github/workflows/multi-arch-test-build.yml79
3 files changed, 171 insertions, 28 deletions
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 b88a6c1..a0fdae3 100755
--- a/.github/workflows/entrypoint.sh
+++ b/.github/workflows/entrypoint.sh
@@ -2,7 +2,12 @@
# 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
+set -o nounset # undefined variables causes script to fail
+
+echo "src/gz packages_ci file:///ci" >> /etc/opkg/distfeeds.conf
+
+FINGERPRINT="$(usign -F -p /ci/packages_ci.pub)"
+cp /ci/packages_ci.pub "/etc/opkg/keys/$FINGERPRINT"
mkdir -p /var/lock/
@@ -11,7 +16,7 @@ opkg update
[ -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
+ tar -xzOf "$PKG" ./control.tar.gz | tar xzf - ./control
# package name including variant
PKG_NAME=$(sed -ne 's#^Package: \(.*\)$#\1#p' ./control)
# package version without release
@@ -21,10 +26,24 @@ for PKG in /ci/*.ipk; do
echo "Testing package $PKG_NAME in version $PKG_VERSION from $PKG_SOURCE"
- opkg install "$PKG"
-
export PKG_NAME PKG_VERSION CI_HELPER
+ PRE_TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/pre-test.sh
+
+ if [ -f "$PRE_TEST_SCRIPT" ]; then
+ echo "Use package specific pre-test.sh"
+ if sh "$PRE_TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
+ echo "Pre-test successful"
+ else
+ echo "Pre-test failed"
+ exit 1
+ fi
+ else
+ echo "No pre-test.sh script available"
+ fi
+
+ opkg install "$PKG"
+
TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/test.sh
if [ -f "$TEST_SCRIPT" ]; then
@@ -39,5 +58,5 @@ for PKG in /ci/*.ipk; do
echo "No test.sh script available"
fi
- opkg remove "$PKG_NAME" --force-removal-of-dependent-packages --force-remove
+ opkg remove "$PKG_NAME" --force-removal-of-dependent-packages --force-remove --autoremove || true
done
diff --git a/.github/workflows/multi-arch-test-build.yml b/.github/workflows/multi-arch-test-build.yml
index c6ae0c0..0fb6c60 100644
--- a/.github/workflows/multi-arch-test-build.yml
+++ b/.github/workflows/multi-arch-test-build.yml
@@ -3,6 +3,10 @@ name: Test Build
on:
pull_request:
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+
jobs:
build:
name: Test ${{ matrix.arch }}
@@ -11,37 +15,37 @@ jobs:
fail-fast: false
matrix:
include:
- - arch: arc_archs
- target: archs38-generic
- runtime_test: false
+ - arch: aarch64_generic
+ target: armsr-armv8
+ runtime_test: true
+
+ - arch: arm_cortex-a15_neon-vfpv4
+ target: armsr-armv7
+ runtime_test: true
- arch: arm_cortex-a9_vfpv3-d16
target: mvebu-cortexa9
runtime_test: false
+ - arch: i386_pentium-mmx
+ target: x86-geode
+ runtime_test: true
+
- arch: mips_24kc
target: ath79-generic
- runtime_test: false
+ runtime_test: true
- arch: powerpc_464fp
target: apm821xx-nand
runtime_test: false
- - arch: powerpc_8540
+ - arch: powerpc_8548
target: mpc85xx-p1010
runtime_test: false
- - arch: aarch64_cortex-a53
- target: mvebu-cortexa53
- runtime_test: true
-
- - arch: arm_cortex-a15_neon-vfpv4
- target: armvirt-32
- runtime_test: true
-
- - arch: i386_pentium-mmx
- target: x86-geode
- runtime_test: true
+ - arch: riscv64_riscv64
+ target: sifiveu-generic
+ runtime_test: false
- arch: x86_64
target: x86-64
@@ -82,20 +86,36 @@ jobs:
echo "Building $PACKAGES"
echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
+ - name: Generate build keys
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y signify-openbsd
+ signify-openbsd -G -n -c 'DO NOT USE - OpenWrt packages feed CI' -p packages_ci.pub -s packages_ci.sec
+ EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
+ echo "KEY_BUILD<<$EOF" >> $GITHUB_ENV
+ cat packages_ci.sec >> $GITHUB_ENV
+ echo "$EOF" >> $GITHUB_ENV
+
- name: Build
uses: openwrt/gh-action-sdk@v5
env:
ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
FEEDNAME: packages_ci
+ INDEX: 1
+ KEY_BUILD: ${{ env.KEY_BUILD }}
- name: Move created packages to project dir
- run: cp bin/packages/${{ matrix.arch }}/packages_ci/*.ipk . || true
+ run: cp bin/packages/${{ matrix.arch }}/packages_ci/* . || true
- name: Store packages
uses: actions/upload-artifact@v3
with:
- name: ${{ matrix.arch}}-packages
- path: "*.ipk"
+ name: ${{env.ARCHIVE_NAME}}-packages
+ path: |
+ Packages
+ Packages.*
+ *.ipk
+ PKG-INFO
- name: Store logs
uses: actions/upload-artifact@v3
@@ -106,19 +126,32 @@ jobs:
- name: Remove logs
run: sudo rm -rf logs/ || true
+ - name: Check if any packages were built
+ run: |
+ if [ -n "$(find . -maxdepth 1 -type f -name '*.ipk' -print -quit)" ]; then
+ echo "Found *.ipk files"
+ HAVE_IPKS=true
+ else
+ echo "No *.ipk files found"
+ HAVE_IPKS=false
+ fi
+ echo "HAVE_IPKS=$HAVE_IPKS" >> $GITHUB_ENV
+
- name: Register QEMU
- if: ${{ matrix.runtime_test }}
+ if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
run: |
- sudo docker run --rm --privileged aptman/qus -s -- -p
+ sudo apt-get update
+ sudo apt-get install -y qemu-user-static binfmt-support
+ sudo update-binfmts --import
- name: Build Docker container
- if: ${{ matrix.runtime_test }}
+ if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
run: |
docker build -t test-container --build-arg ARCH .github/workflows/
env:
ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
- name: Test via Docker container
- if: ${{ matrix.runtime_test }}
+ if: ${{ matrix.runtime_test && fromJSON(env.HAVE_IPKS) }}
run: |
docker run --rm -v $GITHUB_WORKSPACE:/ci test-container