From b3e9af495c79f6c8c68c0eb36df67dfa5ede4e16 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Wed, 14 Sep 2022 12:53:55 +0200 Subject: Add OpenWrt CI via Github Actions. Signed-off-by: Toni Uhlig --- .github/workflows/build-openwrt.yml | 70 ++++++++++++++++++++++ .github/workflows/build.yml | 2 + nDPId-test.c | 5 +- .../nDPId-testing/001-enable-in-source-build.patch | 17 ++++++ packages/openwrt/net/nDPId-testing/Makefile | 14 ++++- .../patches/001-enable-in-source-build.patch | 17 ------ 6 files changed, 102 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/build-openwrt.yml create mode 100644 packages/openwrt/net/nDPId-testing/001-enable-in-source-build.patch delete mode 100644 packages/openwrt/net/nDPId-testing/patches/001-enable-in-source-build.patch diff --git a/.github/workflows/build-openwrt.yml b/.github/workflows/build-openwrt.yml new file mode 100644 index 000000000..a202eefa7 --- /dev/null +++ b/.github/workflows/build-openwrt.yml @@ -0,0 +1,70 @@ +name: OpenWrt Build + +on: + push: + branches: + - main + - tmp + pull_request: + branches: + - master + types: [opened, synchronize, reopened] + release: + types: [created] + +jobs: + build: + name: ${{ matrix.arch }} build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - arch: arc_archs + target: archs38-generic + + - arch: arm_cortex-a9_vfpv3-d16 + target: mvebu-cortexa9 + + - arch: mips_24kc + target: ath79-generic + + - arch: mipsel_24kc + target: mt7621 + + - arch: powerpc_464fp + target: apm821xx-nand + + - arch: powerpc_8540 + target: mpc85xx-p1010 + + - arch: aarch64_cortex-a53 + target: mvebu-cortexa53 + + - arch: arm_cortex-a15_neon-vfpv4 + target: armvirt-32 + + - arch: i386_pentium-mmx + target: x86-geode + + - arch: x86_64 + target: x86-64 + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Build + uses: openwrt/gh-action-sdk@master + env: + ARCH: ${{ matrix.arch }} + FEED_DIR: ${{ github.workspace }}/packages/openwrt + FEEDNAME: ndpid_openwrt_packages_ci + PACKAGES: nDPId-testing + + - name: Store packages + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.arch}}-packages + path: bin/packages/${{ matrix.arch }}/packages/*.ipk diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e10d680c..af65f4c9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,5 @@ name: Build + on: push: branches: @@ -10,6 +11,7 @@ on: types: [opened, synchronize, reopened] release: types: [created] + jobs: test: name: ${{ matrix.os }} ${{ matrix.gcrypt }} diff --git a/nDPId-test.c b/nDPId-test.c index 93d3080ea..dd5b5091d 100644 --- a/nDPId-test.c +++ b/nDPId-test.c @@ -657,9 +657,9 @@ static void * distributor_client_mainloop_thread(void * const arg) break; case READ_LAST_ENUM_VALUE: case READ_ERROR: + case READ_TIMEOUT: logger(1, "Read and verify fd returned an error: %s", strerror(errno)); THREAD_ERROR_GOTO(trv); - case READ_TIMEOUT: case READ_PEER_DISCONNECT: del_event(dis_epollfd, mock_testfds[PIPE_TEST_READ]); pipe_read_finished = 1; @@ -762,9 +762,8 @@ static void * distributor_client_mainloop_thread(void * const arg) { HASH_ITER(hh, current_instance->flow_table, current_flow, ftmp) { - logger(1, "Active flow found during client distributor shutdown: %llu", current_flow->id_as_ull); + logger(1, "Active flow found during client distributor shutdown with id: %llu", current_flow->id_as_ull); THREAD_ERROR(trv); - break; } nDPIsrvd_cleanup_instance(mock_sock, current_instance, CLEANUP_REASON_APP_SHUTDOWN); diff --git a/packages/openwrt/net/nDPId-testing/001-enable-in-source-build.patch b/packages/openwrt/net/nDPId-testing/001-enable-in-source-build.patch new file mode 100644 index 000000000..86432dc57 --- /dev/null +++ b/packages/openwrt/net/nDPId-testing/001-enable-in-source-build.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9045237..83f72b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,12 +1,5 @@ + cmake_minimum_required(VERSION 3.12.4) + project(nDPId C) +-if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") +- message(FATAL_ERROR "In-source builds are not allowed.\n" +- "Please remove ${PROJECT_SOURCE_DIR}/CMakeCache.txt\n" +- "and\n" +- "${PROJECT_SOURCE_DIR}/CMakeFiles\n" +- "Create a build directory somewhere and run CMake again.") +-endif() + set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + find_package(PkgConfig REQUIRED) + diff --git a/packages/openwrt/net/nDPId-testing/Makefile b/packages/openwrt/net/nDPId-testing/Makefile index 8ab38193b..fcb0a491e 100644 --- a/packages/openwrt/net/nDPId-testing/Makefile +++ b/packages/openwrt/net/nDPId-testing/Makefile @@ -4,7 +4,11 @@ PKG_NAME:=nDPId-testing PKG_VERSION:=1.0 PKG_RELEASE:=$(AUTORELEASE) -SOURCE_DIR:=../../../.. +ifneq ($(wildcard /artifacts),) +PKG_DIRECTORY:=/artifacts +else +PKG_DIRECTORY:=../../../.. +endif PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) @@ -61,6 +65,9 @@ endef endif define Build/Prepare + @echo 'tar: $(DL_DIR)/$(PKG_SOURCE)' + @echo 'PKG_DIRECTORY=$(PKG_DIRECTORY)' + @echo 'PKG_SOURCE_SUBDIR=$(PKG_SOURCE_SUBDIR)' tar \ --exclude-tag-all='gcov.css' \ --exclude-tag-all='cmake_install.cmake' \ @@ -71,9 +78,10 @@ define Build/Prepare --exclude-vcs \ --exclude-vcs-ignores \ --transform 's,^,$(PKG_SOURCE_SUBDIR)/,' \ - -czf "$(DL_DIR)/$(PKG_SOURCE)" "$(SOURCE_DIR)" + -czf "$(DL_DIR)/$(PKG_SOURCE)" -C "$(PKG_DIRECTORY)" . + tar -tzf "$(DL_DIR)/$(PKG_SOURCE)" $(PKG_UNPACK) - $(Build/Patch) + cd '$(PKG_BUILD_DIR)' && patch -p1 < $(PKG_BUILD_DIR)/packages/openwrt/net/nDPId-testing/001-enable-in-source-build.patch env \ CC="$(TARGET_CC)" \ AR="$(TARGET_AR)" \ diff --git a/packages/openwrt/net/nDPId-testing/patches/001-enable-in-source-build.patch b/packages/openwrt/net/nDPId-testing/patches/001-enable-in-source-build.patch deleted file mode 100644 index 86432dc57..000000000 --- a/packages/openwrt/net/nDPId-testing/patches/001-enable-in-source-build.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9045237..83f72b3 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,12 +1,5 @@ - cmake_minimum_required(VERSION 3.12.4) - project(nDPId C) --if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") -- message(FATAL_ERROR "In-source builds are not allowed.\n" -- "Please remove ${PROJECT_SOURCE_DIR}/CMakeCache.txt\n" -- "and\n" -- "${PROJECT_SOURCE_DIR}/CMakeFiles\n" -- "Create a build directory somewhere and run CMake again.") --endif() - set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) - find_package(PkgConfig REQUIRED) - -- cgit v1.2.3