diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 74e94119..892c45c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: exit 1 fi echo "Tag is $TAG" - echo "::set-output name=tag::$TAG" + echo "tag=$TAG" >> $GITHUB_OUTPUT - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Login to DockerHub @@ -46,11 +46,22 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and push Docker image to registry + - name: Build Docker image + uses: docker/build-push-action@v7 + with: + context: . + load: true + tags: p4lang/pi:${{ steps.get-tag.outputs.tag }} + cache-from: type=gha + # A cache write must not fail the build. + cache-to: type=gha,mode=max,ignore-error=true + - name: Smoke test Docker image + run: | + docker run --rm p4lang/pi:${{ steps.get-tag.outputs.tag }} pi_convert_p4info -h + - name: Push Docker image to registry uses: docker/build-push-action@v7 with: context: . push: true tags: p4lang/pi:${{ steps.get-tag.outputs.tag }} cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 98ac9188..f1fb6e52 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,10 +36,8 @@ jobs: include: - cxx: g++ cc: gcc - - cxx: clang++-8 - cc: clang-8 - - cxx: clang++-10 - cc: clang-10 + - cxx: clang++ + cc: clang steps: - uses: actions/checkout@v7 with: @@ -54,7 +52,7 @@ jobs: run: | docker run -w /PI pi bash -c \ 'apt-get update && apt-get install -y python3-pip && \ - python3 -m pip install ptf scapy grpcio googleapis-common-protos protobuf==3.20 && \ + python3 -m pip install --break-system-packages ptf scapy grpcio googleapis-common-protos protobuf==3.20 && \ python3 ./proto/ptf/base_test.py' - name: Run tests run: | diff --git a/Dockerfile b/Dockerfile index f91ed242..2b4f37aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,8 +40,8 @@ ENV PI_DEPS automake \ libboost-thread-dev \ libtool \ pkg-config -ENV PI_RUNTIME_DEPS libboost-system1.74.0 \ - libboost-thread1.74.0 \ +ENV PI_RUNTIME_DEPS libboost-system1.83.0 \ + libboost-thread1.83.0 \ python3 \ python-is-python3 diff --git a/Dockerfile.bmv2 b/Dockerfile.bmv2 index 44a033e0..718c358e 100644 --- a/Dockerfile.bmv2 +++ b/Dockerfile.bmv2 @@ -33,15 +33,14 @@ ARG MAKEFLAGS=-j2 ARG IMAGE_TYPE=build # Select the compiler to use. -# We install the default version of GCC (GCC 9), as well as clang 8 and clang 10. +# We install the default versions of GCC and clang. ARG CC=gcc ARG CXX=g++ ENV PI_DEPS automake \ build-essential \ - clang-8 \ - clang-10 \ - clang-format-8 \ + clang \ + clang-format \ g++ \ libboost-dev \ libboost-system-dev \ @@ -54,8 +53,8 @@ ENV PI_DEPS automake \ libmicrohttpd-dev \ doxygen \ valgrind -ENV PI_RUNTIME_DEPS libboost-system1.71.0 \ - libboost-thread1.71.0 \ +ENV PI_RUNTIME_DEPS libboost-system1.83.0 \ + libboost-thread1.83.0 \ libpcap0.8 \ python3 \ python-is-python3 @@ -70,13 +69,16 @@ RUN apt-get update && \ ./proto/sysrepo/install_yangs.sh && \ make && \ make install-strip && \ - (test "$IMAGE_TYPE" = "build" && \ + if test "$IMAGE_TYPE" = "build"; then \ apt-get purge -y $PI_DEPS && \ apt-get autoremove --purge -y && \ rm -rf /PI /var/cache/apt/* /var/lib/apt/lists/* && \ - echo 'Build image ready') || \ - (test "$IMAGE_TYPE" = "test" && \ - echo 'Test image ready') + echo 'Build image ready'; \ + elif test "$IMAGE_TYPE" = "test"; then \ + echo 'Test image ready'; \ + else \ + echo "Unknown IMAGE_TYPE: $IMAGE_TYPE" && exit 1; \ + fi # start sysrepo daemon (sysrepod) ENTRYPOINT ["/docker_entry_point.sh"] diff --git a/proto/demo_grpc/web_server.cpp b/proto/demo_grpc/web_server.cpp index 1d9403ff..0290fade 100644 --- a/proto/demo_grpc/web_server.cpp +++ b/proto/demo_grpc/web_server.cpp @@ -34,6 +34,12 @@ namespace { +#if MHD_VERSION >= 0x00097002 +using mhd_result = MHD_Result; +#else +using mhd_result = int; +#endif + struct connection_info_struct { int connectiontype; WebServer *web_server; @@ -90,8 +96,8 @@ char *generate_page(WebServer *web_server, return answerstring; } -int send_page(struct MHD_Connection *connection, const char *page) { - int ret; +mhd_result send_page(struct MHD_Connection *connection, const char *page) { + mhd_result ret; struct MHD_Response *response; response = MHD_create_response_from_buffer(strlen(page), (void *)page, MHD_RESPMEM_PERSISTENT); @@ -101,10 +107,11 @@ int send_page(struct MHD_Connection *connection, const char *page) { return ret; } -int iterate_post(void *coninfo_cls, enum MHD_ValueKind kind, const char *key, - const char *filename, const char *content_type, - const char *transfer_encoding, const char *data, uint64_t off, - size_t size) { +mhd_result iterate_post(void *coninfo_cls, enum MHD_ValueKind kind, + const char *key, const char *filename, + const char *content_type, + const char *transfer_encoding, const char *data, + uint64_t off, size_t size) { connection_info_struct *con_info = static_cast( coninfo_cls); if (!strncmp(key, "counter_name", sizeof "counter_name")) { @@ -145,8 +152,8 @@ void request_completed(void *cls, struct MHD_Connection *connection, *con_cls = NULL; } -int perform_requested_ops_and_respond(struct MHD_Connection *connection, - connection_info_struct *con_info) { +mhd_result perform_requested_ops_and_respond( + struct MHD_Connection *connection, connection_info_struct *con_info) { WebServer *server = con_info->web_server; if (con_info->new_json_name != "") { std::string *p4info_buffer_ = nullptr; @@ -177,10 +184,10 @@ int perform_requested_ops_and_respond(struct MHD_Connection *connection, return send_page(connection, generate_page(con_info->web_server, con_info)); } -int answer_to_connection(void *cls, struct MHD_Connection *connection, - const char *url, const char *method, - const char *version, const char *upload_data, - size_t *upload_data_size, void **con_cls) { +mhd_result answer_to_connection(void *cls, struct MHD_Connection *connection, + const char *url, const char *method, + const char *version, const char *upload_data, + size_t *upload_data_size, void **con_cls) { WebServer *server = static_cast(cls); if (!*con_cls) { struct connection_info_struct *con_info;