From a973cc911935a4a56d8bdd8c47edfa2f5d094af1 Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Wed, 3 Aug 2022 17:54:41 +0200 Subject: [PATCH 01/16] feat: add Dockerfile or vswitch images Signed-off-by: Luca Muscariello --- docker/Dockerfile.vswitch | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 docker/Dockerfile.vswitch diff --git a/docker/Dockerfile.vswitch b/docker/Dockerfile.vswitch new file mode 100644 index 0000000..06cb2e8 --- /dev/null +++ b/docker/Dockerfile.vswitch @@ -0,0 +1,29 @@ +FROM ubuntu:20.04 + +SHELL ["/bin/bash", "-c"] +ARG DEBIAN_FRONTEND= + +RUN apt-get update +RUN apt-get install -y git ssh curl wget iproute2 + +# External the repos +RUN curl -s https://packagecloud.io/install/repositories/fdio/2202/script.deb.sh | bash +RUN curl -s https://packagecloud.io/install/repositories/fdio/hicn/script.deb.sh | bash + +RUN apt-get update && apt-get install -y \ + hicn-plugin \ + vpp-plugin-core \ + vpp \ + libvppinfra \ + libssh-4 \ + openssl \ + libpcre3 \ + iproute2 \ + iptables \ + frr \ + net-tools\ + iputils-ping \ + tini \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get autoremove -y \ + && apt-get clean From 94f77ec3b01d0be34fa5fe361b832025d03a7ecf Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Thu, 4 Aug 2022 08:10:44 +0200 Subject: [PATCH 02/16] feat: add tests for vswitch Signed-off-by: Luca Muscariello --- docker/tests/Dockerfile.host | 27 ++++++++++ docker/tests/Dockerfile.router | 39 ++++++++++++++ docker/tests/daemons | 85 +++++++++++++++++++++++++++++ docker/tests/docker-compose.yml | 90 +++++++++++++++++++++++++++++++ docker/tests/frr-router1.conf | 16 ++++++ docker/tests/frr-router2.conf | 16 ++++++ docker/tests/frr-start.sh | 4 ++ docker/tests/startup.conf | 22 ++++++++ docker/tests/supervisord.conf | 22 ++++++++ docker/tests/vpp-init-router1.txt | 11 ++++ docker/tests/vpp-init-router2.txt | 11 ++++ docker/tests/vtysh.conf | 8 +++ 12 files changed, 351 insertions(+) create mode 100644 docker/tests/Dockerfile.host create mode 100644 docker/tests/Dockerfile.router create mode 100644 docker/tests/daemons create mode 100644 docker/tests/docker-compose.yml create mode 100644 docker/tests/frr-router1.conf create mode 100644 docker/tests/frr-router2.conf create mode 100755 docker/tests/frr-start.sh create mode 100644 docker/tests/startup.conf create mode 100644 docker/tests/supervisord.conf create mode 100644 docker/tests/vpp-init-router1.txt create mode 100644 docker/tests/vpp-init-router2.txt create mode 100644 docker/tests/vtysh.conf diff --git a/docker/tests/Dockerfile.host b/docker/tests/Dockerfile.host new file mode 100644 index 0000000..d7b603a --- /dev/null +++ b/docker/tests/Dockerfile.host @@ -0,0 +1,27 @@ +FROM ubuntu:20.04 + +ARG DEBIAN_FRONTEND= +RUN apt-get update +RUN apt-get install -y git ssh curl wget iproute2 +RUN curl -s https://packagecloud.io/install/repositories/fdio/2202/script.deb.sh | bash +RUN curl -s https://packagecloud.io/install/repositories/fdio/hicn/script.deb.sh | bash +RUN apt-get update && apt-get install -y \ + hicn-plugin \ + hicn-apps\ + vpp-plugin-core \ + vpp \ + libvppinfra \ + libssh-4 \ + openssl \ + libpcre3 \ + iproute2 \ + iptables \ + frr \ + net-tools\ + iputils-ping \ + tini \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get autoremove -y \ + && apt-get clean + + \ No newline at end of file diff --git a/docker/tests/Dockerfile.router b/docker/tests/Dockerfile.router new file mode 100644 index 0000000..58f8644 --- /dev/null +++ b/docker/tests/Dockerfile.router @@ -0,0 +1,39 @@ +FROM ubuntu:20.04 + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update +RUN apt-get install -y git ssh curl wget iproute2 +RUN curl -s https://packagecloud.io/install/repositories/fdio/2202/script.deb.sh | bash +RUN curl -s https://packagecloud.io/install/repositories/fdio/hicn/script.deb.sh | bash +RUN apt-get update && apt-get install -y \ + hicn-plugin \ + vpp-plugin-core \ + vpp \ + libvppinfra \ + libssh-4 \ + openssl \ + libpcre3 \ + iproute2 \ + iptables \ + frr \ + net-tools\ + iputils-ping \ + tini \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get autoremove -y \ + && apt-get clean + +RUN mkdir -p /var/run/frr +RUN chown -R frr:frr /etc/frr /var/run/frr +RUN mkdir -p /var/log/vpp +COPY daemons /etc/frr/ +COPY vtysh.conf /etc/frr/ +COPY frr-start.sh /usr/lib/frr/ +ARG ROUTER +COPY frr-router${ROUTER}.conf /etc/frr/frr.conf +COPY startup.conf /etc/vpp/ +COPY vpp-init-router${ROUTER}.txt /etc/vpp/vpp-init.txt +WORKDIR /workspace + +ENTRYPOINT ["/usr/bin/tini", "--"] +CMD ["/usr/lib/frr/frr-start.sh"] \ No newline at end of file diff --git a/docker/tests/daemons b/docker/tests/daemons new file mode 100644 index 0000000..04c21f1 --- /dev/null +++ b/docker/tests/daemons @@ -0,0 +1,85 @@ +# This file tells the frr package which daemons to start. +# +# Sample configurations for these daemons can be found in +# /usr/share/doc/frr/examples/. +# +# ATTENTION: +# +# When activating a daemon for the first time, a config file, even if it is +# empty, has to be present *and* be owned by the user and group "frr", else +# the daemon will not be started by /etc/init.d/frr. The permissions should +# be u=rw,g=r,o=. +# When using "vtysh" such a config file is also needed. It should be owned by +# group "frrvty" and set to ug=rw,o= though. Check /etc/pam.d/frr, too. +# +# The watchfrr, zebra and staticd daemons are always started. +# +bgpd=no +ospfd=yes +ospf6d=no +ripd=no +ripngd=no +isisd=no +pimd=no +ldpd=no +nhrpd=no +eigrpd=no +babeld=no +sharpd=no +pbrd=no +bfdd=no +fabricd=no +vrrpd=no + +# +# If this option is set the /etc/init.d/frr script automatically loads +# the config via "vtysh -b" when the servers are started. +# Check /etc/pam.d/frr if you intend to use "vtysh"! +# +vtysh_enable=yes +zebra_options=" -A 127.0.0.1 -s 90000000" +bgpd_options=" -A 127.0.0.1" +ospfd_options=" -A 127.0.0.1" +ospf6d_options=" -A ::1" +ripd_options=" -A 127.0.0.1" +ripngd_options=" -A ::1" +isisd_options=" -A 127.0.0.1" +pimd_options=" -A 127.0.0.1" +ldpd_options=" -A 127.0.0.1" +nhrpd_options=" -A 127.0.0.1" +eigrpd_options=" -A 127.0.0.1" +babeld_options=" -A 127.0.0.1" +sharpd_options=" -A 127.0.0.1" +pbrd_options=" -A 127.0.0.1" +staticd_options="-A 127.0.0.1" +bfdd_options=" -A 127.0.0.1" +fabricd_options="-A 127.0.0.1" +vrrpd_options=" -A 127.0.0.1" + +# configuration profile +# +#frr_profile="traditional" +#frr_profile="datacenter" + +# +# This is the maximum number of FD's that will be available. +# Upon startup this is read by the control files and ulimit +# is called. Uncomment and use a reasonable value for your +# setup if you are expecting a large number of peers in +# say BGP. +#MAX_FDS=1024 + +# The list of daemons to watch is automatically generated by the init script. +#watchfrr_options="" + +# To make watchfrr create/join the specified netns, use the following option: +#watchfrr_options="--netns" +# This only has an effect in /etc/frr//daemons, and you need to +# start FRR with "/usr/lib/frr/frrinit.sh start ". + +# for debugging purposes, you can specify a "wrap" command to start instead +# of starting the daemon directly, e.g. to use valgrind on ospfd: +# ospfd_wrap="/usr/bin/valgrind" +# or you can use "all_wrap" for all daemons, e.g. to use perf record: +# all_wrap="/usr/bin/perf record --call-graph -" +# the normal daemon command is added to this at the end. \ No newline at end of file diff --git a/docker/tests/docker-compose.yml b/docker/tests/docker-compose.yml new file mode 100644 index 0000000..81f6991 --- /dev/null +++ b/docker/tests/docker-compose.yml @@ -0,0 +1,90 @@ +version: "3" +services: + host1: + build: + context: . + dockerfile: Dockerfile.host + container_name: host1 + hostname: host1 + volumes: + - .:/workspace + networks: + - net1 + init: true + privileged: true +# entrypoint: [/bin/bash, -ex, -c] + command: + - route add default gw 10.1.0.3 + - route del default gw 10.1.0.1 + - tail -f /dev/null + host2: + build: + context: . + dockerfile: Dockerfile.host + container_name: host2 + hostname: host2 + volumes: + - .:/workspace + networks: + - net3 + init: true + privileged: true +# entrypoint: [/bin/bash, -ex, -c] + command: + - route add default gw 10.3.0.3 + - route del default gw 10.3.0.1 + - tail -f /dev/null + router1: + build: + context: . + dockerfile: Dockerfile.router + args: + ROUTER: 1 + container_name: router1 + hostname: router1 + volumes: + - .:/workspace + networks: + - net1 + - net2 + privileged: true + depends_on: + - "host1" + - "host2" + router2: + build: + context: . + dockerfile: Dockerfile.router + args: + ROUTER: 2 + container_name: router2 + hostname: router2 + volumes: + - .:/workspace + networks: + - net2 + - net3 + privileged: true + depends_on: + - "host1" + - "host2" + - "router1" +networks: + net1: + driver: bridge + ipam: + driver: default + config: + - subnet: 10.1.0.0/16 + net2: + driver: bridge + ipam: + driver: default + config: + - subnet: 10.2.0.0/16 + net3: + driver: bridge + ipam: + driver: default + config: + - subnet: 10.3.0.0/16 \ No newline at end of file diff --git a/docker/tests/frr-router1.conf b/docker/tests/frr-router1.conf new file mode 100644 index 0000000..c958a06 --- /dev/null +++ b/docker/tests/frr-router1.conf @@ -0,0 +1,16 @@ +frr version 7.5_git +frr defaults traditional +hostname router1 +no ipv6 forwarding +service integrated-vtysh-config +! +interface lo + ip address 1.1.1.1/32 +! +router ospf + network 10.1.0.0/16 area 0.0.0.0 + network 10.2.0.0/16 area 0.0.0.0 + router-info area +! +line vty +! \ No newline at end of file diff --git a/docker/tests/frr-router2.conf b/docker/tests/frr-router2.conf new file mode 100644 index 0000000..0447162 --- /dev/null +++ b/docker/tests/frr-router2.conf @@ -0,0 +1,16 @@ +frr version 7.5_git +frr defaults traditional +hostname router1 +no ipv6 forwarding +service integrated-vtysh-config +! +interface lo + ip address 2.2.2.2/32 +! +router ospf + network 10.2.0.0/16 area 0.0.0.0 + network 10.3.0.0/16 area 0.0.0.0 + router-info area +! +line vty +! \ No newline at end of file diff --git a/docker/tests/frr-start.sh b/docker/tests/frr-start.sh new file mode 100755 index 0000000..63f330c --- /dev/null +++ b/docker/tests/frr-start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +vpp -c /etc/vpp/startup.conf +source /usr/lib/frr/frrcommon.sh +/usr/lib/frr/watchfrr $(daemon_list) \ No newline at end of file diff --git a/docker/tests/startup.conf b/docker/tests/startup.conf new file mode 100644 index 0000000..58ce201 --- /dev/null +++ b/docker/tests/startup.conf @@ -0,0 +1,22 @@ +cpu { main-core 1 } +plugins { + path /usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins + plugin default { disable } + plugin acl_plugin.so { enable } + plugin dpdk_plugin.so { enable } + plugin memif_plugin.so { enable } + plugin hicn_plugin.so { enable } + plugin linux_cp_plugin.so { enable } + plugin ping_plugin.so { enable } +} + +unix { + startup-config /etc/vpp/vpp-init.txt + cli-listen /run/vpp/cli.sock + log /var/log/vpp/vpp.log +} + +linux-cp { + default netns dataplane + lcp-sync +} \ No newline at end of file diff --git a/docker/tests/supervisord.conf b/docker/tests/supervisord.conf new file mode 100644 index 0000000..7d6eb1d --- /dev/null +++ b/docker/tests/supervisord.conf @@ -0,0 +1,22 @@ +[supervisord] +nodaemon=true +logfile=/var/log/supervisord.log +loglevel=debug + +[program:vpp] +command=/usr/bin/vpp -c /etc/vpp/startup.conf +autorestart=true +redirect_stderr=true +priority=1 + +[program:watchfrr] +command=/usr/lib/frr/watchfrr -d -F traditional zebra staticd +autorestart=true +redirect_stderr=true +priority=2 + +[program:netopeer2-server] +command=/usr/bin/netopeer2-server -d +autorestart=true +redirect_stderr=true +priority=3 diff --git a/docker/tests/vpp-init-router1.txt b/docker/tests/vpp-init-router1.txt new file mode 100644 index 0000000..c63720f --- /dev/null +++ b/docker/tests/vpp-init-router1.txt @@ -0,0 +1,11 @@ +create host-interface name eth0 +create host-interface name eth1 + +set interface state host-eth0 up +set interface state host-eth1 up + +set int ip address host-eth0 10.11.0.2/16 +set int ip address host-eth1 10.22.0.2/16 + +lcp create host-eth0 host-if e0 +lcp create host-eth1 host-if e1 \ No newline at end of file diff --git a/docker/tests/vpp-init-router2.txt b/docker/tests/vpp-init-router2.txt new file mode 100644 index 0000000..dca664d --- /dev/null +++ b/docker/tests/vpp-init-router2.txt @@ -0,0 +1,11 @@ +create host-interface name eth0 +create host-interface name eth1 + +set interface state host-eth0 up +set interface state host-eth1 up + +set int ip address host-eth0 10.21.0.3/16 +set int ip address host-eth1 10.31.0.2/16 + +lcp create host-eth0 host-if e0 +lcp create host-eth1 host-if e1 diff --git a/docker/tests/vtysh.conf b/docker/tests/vtysh.conf new file mode 100644 index 0000000..955f666 --- /dev/null +++ b/docker/tests/vtysh.conf @@ -0,0 +1,8 @@ +! +! Sample configuration file for vtysh. +! +!service integrated-vtysh-config +!hostname quagga-router +!username root nopassword +! +service integrated-vtysh-config \ No newline at end of file From 94eb485d9817e48c5d4ddc88d15d8231ef48b384 Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Thu, 8 Sep 2022 21:24:25 +0200 Subject: [PATCH 03/16] feat(tests): network tesing Signed-off-by: Luca Muscariello --- docker/tests/Dockerfile.host | 9 +++++++- docker/tests/README.md | 38 +++++++++++++++++++++++++++++++ docker/tests/docker-compose.yml | 14 ++++-------- docker/tests/host-start.sh | 4 ++++ docker/tests/vpp-init-host1.txt | 4 ++++ docker/tests/vpp-init-host2.txt | 4 ++++ docker/tests/vpp-init-router1.txt | 2 +- docker/tests/vpp-init-router2.txt | 4 ++-- 8 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 docker/tests/README.md create mode 100644 docker/tests/host-start.sh create mode 100644 docker/tests/vpp-init-host1.txt create mode 100644 docker/tests/vpp-init-host2.txt diff --git a/docker/tests/Dockerfile.host b/docker/tests/Dockerfile.host index d7b603a..48b1cb2 100644 --- a/docker/tests/Dockerfile.host +++ b/docker/tests/Dockerfile.host @@ -24,4 +24,11 @@ RUN apt-get update && apt-get install -y \ && apt-get autoremove -y \ && apt-get clean - \ No newline at end of file + +ARG HOST +COPY startup.conf /etc/vpp/ +COPY vpp-init-host${HOST}.txt /etc/vpp/vpp-init.txt + +WORKDIR /workspace +ENTRYPOINT ["/usr/bin/tini", "--"] +CMD ["/usr/lib/frr/frr-start.sh"] diff --git a/docker/tests/README.md b/docker/tests/README.md new file mode 100644 index 0000000..852bc96 --- /dev/null +++ b/docker/tests/README.md @@ -0,0 +1,38 @@ +# Functional test description + + +## Network topology + +Host - H +Router - R +Linux Bridge - LB +VPP Router - VR + +LB1 - 10.1.0.0/16 +LB2 - 10.2.0.0/16 +LB3 - 10.3.0.0/16 + +### L2 Topology +H1 -- LB1 -- R1 -- LB2 - R2 -- LB3 -- H2 + +### L3 Topology +Host1 -- Router1 -- Router2 -- Host2 + +### Interfaces addressing at the linux bridge +* LB1 - 10.1.0.1/16 +* LB2 - 10.2.0.1/16 +* LB3 - 10.3.0.1/16 +* H1-1 - 10.1.0.2/16 +* R1-1 - 10.1.0.3/16 +* R1-2 - 10.2.0.2/16 +* R2-1 - 10.2.0.3/16 +* R2-2 - 10.3.0.2/16 +* H2-1 - 10.3.0.3/16 + +### VPP interfaces addresses +* H1-1 - 10.11.0.2/16 +* R1-1 - 10.11.0.3/16 +* R1-2 - 10.22.0.2/16 +* R2-1 - 10.22.0.3/16 +* R2-2 - 10.33.0.2/16 +* H2-1 - 10.33.0.3/16 diff --git a/docker/tests/docker-compose.yml b/docker/tests/docker-compose.yml index 81f6991..7f75a8e 100644 --- a/docker/tests/docker-compose.yml +++ b/docker/tests/docker-compose.yml @@ -4,6 +4,8 @@ services: build: context: . dockerfile: Dockerfile.host + args: + HOST: 1 container_name: host1 hostname: host1 volumes: @@ -12,15 +14,12 @@ services: - net1 init: true privileged: true -# entrypoint: [/bin/bash, -ex, -c] - command: - - route add default gw 10.1.0.3 - - route del default gw 10.1.0.1 - - tail -f /dev/null host2: build: context: . dockerfile: Dockerfile.host + args: + HOST: 2 container_name: host2 hostname: host2 volumes: @@ -29,11 +28,6 @@ services: - net3 init: true privileged: true -# entrypoint: [/bin/bash, -ex, -c] - command: - - route add default gw 10.3.0.3 - - route del default gw 10.3.0.1 - - tail -f /dev/null router1: build: context: . diff --git a/docker/tests/host-start.sh b/docker/tests/host-start.sh new file mode 100644 index 0000000..63f330c --- /dev/null +++ b/docker/tests/host-start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +vpp -c /etc/vpp/startup.conf +source /usr/lib/frr/frrcommon.sh +/usr/lib/frr/watchfrr $(daemon_list) \ No newline at end of file diff --git a/docker/tests/vpp-init-host1.txt b/docker/tests/vpp-init-host1.txt new file mode 100644 index 0000000..e85f5e6 --- /dev/null +++ b/docker/tests/vpp-init-host1.txt @@ -0,0 +1,4 @@ +create host-interface name eth0 +set interface state host-eth0 up +set int ip address host-eth0 10.11.0.2/16 +lcp create host-eth0 host-if e0 diff --git a/docker/tests/vpp-init-host2.txt b/docker/tests/vpp-init-host2.txt new file mode 100644 index 0000000..4eb85b4 --- /dev/null +++ b/docker/tests/vpp-init-host2.txt @@ -0,0 +1,4 @@ +create host-interface name eth0 +set interface state host-eth0 up +set int ip address host-eth0 10.33.0.3/16 +lcp create host-eth0 host-if e0 diff --git a/docker/tests/vpp-init-router1.txt b/docker/tests/vpp-init-router1.txt index c63720f..ee273e8 100644 --- a/docker/tests/vpp-init-router1.txt +++ b/docker/tests/vpp-init-router1.txt @@ -4,7 +4,7 @@ create host-interface name eth1 set interface state host-eth0 up set interface state host-eth1 up -set int ip address host-eth0 10.11.0.2/16 +set int ip address host-eth0 10.11.0.3/16 set int ip address host-eth1 10.22.0.2/16 lcp create host-eth0 host-if e0 diff --git a/docker/tests/vpp-init-router2.txt b/docker/tests/vpp-init-router2.txt index dca664d..21c1548 100644 --- a/docker/tests/vpp-init-router2.txt +++ b/docker/tests/vpp-init-router2.txt @@ -4,8 +4,8 @@ create host-interface name eth1 set interface state host-eth0 up set interface state host-eth1 up -set int ip address host-eth0 10.21.0.3/16 -set int ip address host-eth1 10.31.0.2/16 +set int ip address host-eth0 10.22.0.3/16 +set int ip address host-eth1 10.33.0.2/16 lcp create host-eth0 host-if e0 lcp create host-eth1 host-if e1 From ad1d2650e8274de95707821db9302fbfa611c42e Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Tue, 13 Sep 2022 14:55:28 +0200 Subject: [PATCH 04/16] feat(cmake): warnings old version of cmake, 3.22 needed, 3.18 installed (#20) Signed-off-by: Angelo Mantellini Signed-off-by: Angelo Mantellini --- android/.gitignore | 8 ++++++++ android/config/config.mk | 2 +- android/config/modules/002-cmake-modules.mk | 2 +- android/hICNTools/app/build.gradle | 2 +- android/hicn-aar/FaceMgrLibrary/build.gradle | 2 +- .../hicn-aar/FaceMgrLibrary/facemgrLibrary/build.gradle | 2 +- android/hicn-aar/ForwarderLibrary/build.gradle | 2 +- .../ForwarderLibrary/hicnforwarderLibrary/build.gradle | 2 +- android/scripts/compile_facemgr_aar.sh | 2 +- android/scripts/init_sdk.sh | 2 +- 10 files changed, 17 insertions(+), 9 deletions(-) diff --git a/android/.gitignore b/android/.gitignore index 58001c5..4e2b78d 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -1,2 +1,10 @@ hicn-aar/FaceMgrLibrary/facemgrLibrary/.cxx hicn-aar/ForwarderLibrary/facemgrLibrary/.cxx +.distillery.stamp +.versions +build_aarch64 +build_x86_64 +sdk +src +usr_aarch64 +usr_x86_64 diff --git a/android/config/config.mk b/android/config/config.mk index cf2fc67..c69d33e 100644 --- a/android/config/config.mk +++ b/android/config/config.mk @@ -164,7 +164,7 @@ export ANDROID_COMPILE_SDK=30 export ANDROID_BUILD_TOOLS=30.0.2 export ANDROID_SDK_TOOLS_REV=8512546 export ANDROID_CMAKE_REV=3.6.4111459 -export ANDROID_CMAKE_REV_3_18=3.18.1 +export ANDROID_CMAKE_REV_3_22=3.22.1 export VERSIONS_FILE=${DISTILLERY_ROOT_DIR}/.versions export HICN_COMMIT=master export BLACKLIST_FILE=$(shell pwd)/config/blacklistfile diff --git a/android/config/modules/002-cmake-modules.mk b/android/config/modules/002-cmake-modules.mk index 0463e52..6391a73 100644 --- a/android/config/modules/002-cmake-modules.mk +++ b/android/config/modules/002-cmake-modules.mk @@ -24,7 +24,7 @@ ${$1_BUILD_DIR}/Makefile: ${$1_SOURCE_DIR}/CMakeLists.txt ${DISTILLERY_STAMP} echo ${$1_BUILD_DIR}; cd ${$1_BUILD_DIR}; \ DEPENDENCY_HOME=${DISTILLERY_EXTERN_DIR} \ - ${SDK}/cmake/${ANDROID_CMAKE_REV_3_18}/bin/cmake \ # -DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/android.toolchain.cmake \ + ${SDK}/cmake/${ANDROID_CMAKE_REV_3_22}/bin/cmake \ # -DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/android.toolchain.cmake \ -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_static \ -DANDROID_ABI=${ANDROID_ABI} \ #ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH=${DISTILLERY_ROOT_DIR}/sdk/toolchain_${ABI} \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/android/hICNTools/app/build.gradle b/android/hICNTools/app/build.gradle index 5b7bb9a..9e46dca 100644 --- a/android/hICNTools/app/build.gradle +++ b/android/hICNTools/app/build.gradle @@ -62,7 +62,7 @@ android { externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" - version "3.18.1" + version "3.22.1" } } } diff --git a/android/hicn-aar/FaceMgrLibrary/build.gradle b/android/hicn-aar/FaceMgrLibrary/build.gradle index 646a6b2..996d1cc 100644 --- a/android/hicn-aar/FaceMgrLibrary/build.gradle +++ b/android/hicn-aar/FaceMgrLibrary/build.gradle @@ -23,7 +23,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.android.tools.build:gradle:7.2.2' } } diff --git a/android/hicn-aar/FaceMgrLibrary/facemgrLibrary/build.gradle b/android/hicn-aar/FaceMgrLibrary/facemgrLibrary/build.gradle index 23ee2c7..4996350 100644 --- a/android/hicn-aar/FaceMgrLibrary/facemgrLibrary/build.gradle +++ b/android/hicn-aar/FaceMgrLibrary/facemgrLibrary/build.gradle @@ -61,7 +61,7 @@ android { externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" - version "3.18.1" + version "3.22.1" } } diff --git a/android/hicn-aar/ForwarderLibrary/build.gradle b/android/hicn-aar/ForwarderLibrary/build.gradle index d4e5f3e..5dcc744 100644 --- a/android/hicn-aar/ForwarderLibrary/build.gradle +++ b/android/hicn-aar/ForwarderLibrary/build.gradle @@ -26,7 +26,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.android.tools.build:gradle:7.2.2' } } diff --git a/android/hicn-aar/ForwarderLibrary/hicnforwarderLibrary/build.gradle b/android/hicn-aar/ForwarderLibrary/hicnforwarderLibrary/build.gradle index cd4bc0d..68a0953 100644 --- a/android/hicn-aar/ForwarderLibrary/hicnforwarderLibrary/build.gradle +++ b/android/hicn-aar/ForwarderLibrary/hicnforwarderLibrary/build.gradle @@ -60,7 +60,7 @@ android { externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" - version "3.18.1" + version "3.22.1" } } diff --git a/android/scripts/compile_facemgr_aar.sh b/android/scripts/compile_facemgr_aar.sh index d996141..0523db5 100644 --- a/android/scripts/compile_facemgr_aar.sh +++ b/android/scripts/compile_facemgr_aar.sh @@ -24,7 +24,7 @@ done cd hicn-aar/FaceMgrLibrary if [ ! -f local.properties ]; then - echo sdk.dir=${SDK} > local.properties + echo sdk.dir=${SDK} > local.properties echo ndk.dir=${NDK} >> local.properties fi diff --git a/android/scripts/init_sdk.sh b/android/scripts/init_sdk.sh index 41c2e69..3f4b0ff 100755 --- a/android/scripts/init_sdk.sh +++ b/android/scripts/init_sdk.sh @@ -61,7 +61,7 @@ if [ -z ${NDK_PATH} ]; then echo yes | cmdline-tools/bin/sdkmanager --sdk_root=`pwd` 'platform-tools' echo yes | cmdline-tools/bin/sdkmanager --sdk_root=`pwd` 'build-tools;'$ANDROID_BUILD_TOOLS echo yes | cmdline-tools/bin/sdkmanager --sdk_root=`pwd` 'cmake;'$ANDROID_CMAKE_REV - echo yes | cmdline-tools/bin/sdkmanager --sdk_root=`pwd` --channel=3 --channel=1 'cmake;'$ANDROID_CMAKE_REV_3_18 + echo yes | cmdline-tools/bin/sdkmanager --sdk_root=`pwd` --channel=3 --channel=1 'cmake;'$ANDROID_CMAKE_REV_3_22 #echo yes | cmdline-tools/bin/sdkmanager --sdk_root=`pwd` 'ndk-bundle' echo yes | cmdline-tools/bin/sdkmanager --sdk_root=`pwd` "ndk;$ANDROID_NDK_VERSION" --channel=3 fi From 696b35a917db35b2b32d4e4a1bc1eb54c8b0ad3f Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Sun, 16 Oct 2022 14:03:44 +0200 Subject: [PATCH 05/16] feat: version if promote #promote PATCH (#21) Signed-off-by: Angelo Mantellini Signed-off-by: Angelo Mantellini --- .cz.toml | 2 +- .github/workflows/master.yml | 69 ++++++++++++++++++++++++++ .github/workflows/verify.yml | 40 +++++++-------- android/scripts/compile_facemgr_aar.sh | 12 ++--- 4 files changed, 96 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/master.yml diff --git a/.cz.toml b/.cz.toml index 92846d7..98a7d23 100644 --- a/.cz.toml +++ b/.cz.toml @@ -1,5 +1,5 @@ [tool] [tool.commitizen] name = "cz_conventional_commits" -version = "0.0.1" +version = "0.0.0" tag_format = "v$version" diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 0000000..33e780a --- /dev/null +++ b/.github/workflows/master.yml @@ -0,0 +1,69 @@ +############################################################################# +# Copyright (c) 2022 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## + +on: + push: + branches: + - main + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + Master: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: "${{ github.event.pull_request.head.ref }}" + repository: "${{ github.event.pull_request.head.repo.full_name}}" + token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" + fetch-depth: 0 + - name: run + id: run + run: | + echo $GITHUB_SHA + if git describe --exact-match $GITHUB_SHA; then + echo ::set-output name=istag::'true' + else + echo ::set-output name=istag::'false' + fi + git describe --exact-match $GITHUB_SHA | true + PROMOTE=$(echo "${{ github.event.head_commit.message }}" | \ + grep -e "#promote" | \ + awk '$0 ~ /#promote/ { print "promote" }') + PROMOTE_LEVEL=$(echo "${{ github.event.head_commit.message }}" | \ + grep -E "#promote MAJOR|MINOR|PATCH" | \ + awk -F '#promote' '{print $2}' | \ + awk -F ' ' '{print $1}') + echo ::set-output name=promote::$PROMOTE + echo ::set-output name=promote-level::$PROMOTE_LEVEL + - name: Create bump and changelog + id: cz + if: "!startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.promote == 'promote' && steps.run.outputs.promote-level != ''" + uses: commitizen-tools/commitizen-action@master + with: + github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + increment: ${{ steps.run.outputs.promote-level }} + push: true + changelog: true + - name: Print Version + if: "!startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.promote == 'promote' && steps.run.outputs.promote-level != ''" + run: echo "Bumped to version ${{ steps.cz.outputs.version }}" + - name: Build Android + if: "startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.istag == 'true'" + run: | + bash android/ci/docker-build.sh diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 36b4ab2..2f4c714 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -24,23 +24,23 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: "${{ github.event.pull_request.head.ref }}" - repository: "${{ github.event.pull_request.head.repo.full_name}}" - fetch-depth: 0 - - name: Capture commit id - id: capture - run: | - COMMIT_ID="$(git rev-parse "${{ github.head_ref }}")" - echo "The sha of the starting commit is $COMMIT_ID" - echo "::set-output name=commit::$COMMIT_ID" - - name: Check commits - uses: manang/commitizen-check@v0.0.1 - - name: compile docker - id: compile - run: | - bash android/ci/docker-build.sh + Verify: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: "${{ github.event.pull_request.head.ref }}" + repository: "${{ github.event.pull_request.head.repo.full_name}}" + fetch-depth: 0 + - name: Capture commit id + id: capture + run: | + COMMIT_ID="$(git rev-parse "${{ github.head_ref }}")" + echo "The sha of the starting commit is $COMMIT_ID" + echo "::set-output name=commit::$COMMIT_ID" + - name: Check commits + uses: manang/commitizen-check@v0.0.1 + - name: compile docker + id: compile + run: | + bash android/ci/docker-build.sh diff --git a/android/scripts/compile_facemgr_aar.sh b/android/scripts/compile_facemgr_aar.sh index 0523db5..c3f64db 100644 --- a/android/scripts/compile_facemgr_aar.sh +++ b/android/scripts/compile_facemgr_aar.sh @@ -24,20 +24,20 @@ done cd hicn-aar/FaceMgrLibrary if [ ! -f local.properties ]; then - echo sdk.dir=${SDK} > local.properties - echo ndk.dir=${NDK} >> local.properties + echo sdk.dir=${SDK} > local.properties + echo ndk.dir=${NDK} >> local.properties fi if [ "$ENABLE_DEBUG" = "DEBUG" ]; then - ASSEMBLE="compileDebugSources" + ASSEMBLE="compileDebugSources" else - ASSEMBLE="compileReleaseSources" + ASSEMBLE="compileReleaseSources" fi if [ "$MVN_REPO" = "" ]; then - gradle $ASSEMBLE -PVERSION=$VERSION_CODE + gradle $ASSEMBLE -PVERSION=$VERSION_CODE else - gradle $ASSEMBLE -PENABLE_HPROXY=$ENABLE_HPROXY + gradle $ASSEMBLE -PENABLE_HPROXY=$ENABLE_HPROXY fi cd .. From a73a2811b4b10ccc16e0645bfe85fad4e125a301 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 19 Oct 2022 12:54:20 +0000 Subject: [PATCH 06/16] =?UTF-8?q?bump:=20version=200.0.0=20=E2=86=92=200.0?= =?UTF-8?q?.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cz.toml | 2 +- CHANGELOG.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/.cz.toml b/.cz.toml index 98a7d23..92846d7 100644 --- a/.cz.toml +++ b/.cz.toml @@ -1,5 +1,5 @@ [tool] [tool.commitizen] name = "cz_conventional_commits" -version = "0.0.0" +version = "0.0.1" tag_format = "v$version" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c2f2894 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +## v0.0.1 (2022-10-19) + +### Feat + +- version if promote #promote PATCH (#21) +- **cmake**: warnings old version of cmake, 3.22 needed, 3.18 installed (#20) +- check if commit is conventional commit compliant (#17) +- upgrade dockerfiles to compile environment+dependencies+hicn libraries (#14) +- upgrade android-sdk to support arm64 (#13) From a6d5c28e7eb889a5f0e6f0d8790f0a207e1fe423 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Fri, 21 Oct 2022 12:54:38 +0200 Subject: [PATCH 07/16] fix(master.yml): remove personal token (#26) Ref: #25 #promote PATCH Signed-off-by: Angelo Mantellini --- .github/workflows/master.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 33e780a..84eadd7 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -30,9 +30,9 @@ jobs: with: ref: "${{ github.event.pull_request.head.ref }}" repository: "${{ github.event.pull_request.head.repo.full_name}}" - token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" + token: "${{ secrets.GITHUB_TOKEN }}" fetch-depth: 0 - - name: run + - name: Take version id: run run: | echo $GITHUB_SHA @@ -56,14 +56,21 @@ jobs: if: "!startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.promote == 'promote' && steps.run.outputs.promote-level != ''" uses: commitizen-tools/commitizen-action@master with: - github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} increment: ${{ steps.run.outputs.promote-level }} push: true changelog: true - - name: Print Version - if: "!startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.promote == 'promote' && steps.run.outputs.promote-level != ''" - run: echo "Bumped to version ${{ steps.cz.outputs.version }}" + - name: 'Get Previous tag' + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + with: + fallback: v0.0.0 - name: Build Android - if: "startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.istag == 'true'" run: | + echo "${{steps.previoustag.outputs.tag}}" bash android/ci/docker-build.sh + - name: Publish artifacts + id: publish + if: "startsWith(github.event.head_commit.message, 'bump:') || steps.cz.outputs.version != ''" + run: | + echo "${{steps.cz.outputs.version}} ${{steps.previoustag.outputs.tag}} ${{ github.event.head_commit.message }}" \ No newline at end of file From ba0b790d70c10435b3f2ac44695caba54b888ae4 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Fri, 21 Oct 2022 19:38:06 +0200 Subject: [PATCH 08/16] Revert "fix(master.yml): remove personal token" (#28) * Revert "fix(master.yml): remove personal token (#26)" This reverts commit 066878b23ba055c58f516143257b8ff439352adb. * feat(master.yml): change personal token Ref: #27 #promote PATCH Signed-off-by: Angelo Mantellini Signed-off-by: Angelo Mantellini --- .github/workflows/master.yml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 84eadd7..b468268 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -30,9 +30,9 @@ jobs: with: ref: "${{ github.event.pull_request.head.ref }}" repository: "${{ github.event.pull_request.head.repo.full_name}}" - token: "${{ secrets.GITHUB_TOKEN }}" + token: "${{ secrets.HICN_ACCESS_TOKEN }}" fetch-depth: 0 - - name: Take version + - name: run id: run run: | echo $GITHUB_SHA @@ -56,21 +56,14 @@ jobs: if: "!startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.promote == 'promote' && steps.run.outputs.promote-level != ''" uses: commitizen-tools/commitizen-action@master with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.HICN_ACCESS_TOKEN }} increment: ${{ steps.run.outputs.promote-level }} push: true changelog: true - - name: 'Get Previous tag' - id: previoustag - uses: "WyriHaximus/github-action-get-previous-tag@v1" - with: - fallback: v0.0.0 + - name: Print Version + if: "!startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.promote == 'promote' && steps.run.outputs.promote-level != ''" + run: echo "Bumped to version ${{ steps.cz.outputs.version }}" - name: Build Android + if: "startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.istag == 'true'" run: | - echo "${{steps.previoustag.outputs.tag}}" bash android/ci/docker-build.sh - - name: Publish artifacts - id: publish - if: "startsWith(github.event.head_commit.message, 'bump:') || steps.cz.outputs.version != ''" - run: | - echo "${{steps.cz.outputs.version}} ${{steps.previoustag.outputs.tag}} ${{ github.event.head_commit.message }}" \ No newline at end of file From 1ab8b426bba71302028d7794b41c2bf81716d542 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Fri, 21 Oct 2022 22:31:07 +0200 Subject: [PATCH 09/16] Bugfix/change token hicn (#29) --- .github/workflows/master.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index b468268..11fb14a 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -30,7 +30,7 @@ jobs: with: ref: "${{ github.event.pull_request.head.ref }}" repository: "${{ github.event.pull_request.head.repo.full_name}}" - token: "${{ secrets.HICN_ACCESS_TOKEN }}" + token: "${{ secrets.HICN_ACTIONS_TOKEN }}" fetch-depth: 0 - name: run id: run @@ -56,7 +56,7 @@ jobs: if: "!startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.promote == 'promote' && steps.run.outputs.promote-level != ''" uses: commitizen-tools/commitizen-action@master with: - github_token: ${{ secrets.HICN_ACCESS_TOKEN }} + github_token: ${{ secrets.HICN_ACTIONS_TOKEN }} increment: ${{ steps.run.outputs.promote-level }} push: true changelog: true From fa9635d606e5ac7f2d472765c264103b5a23314a Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Wed, 26 Oct 2022 16:04:42 +0200 Subject: [PATCH 10/16] feat: add multi stage docker images (#33) Ref: #32 #promote PATCH Signed-off-by: Angelo Mantellini --- .github/workflows/android-dep.yml | 47 ++++++++++++++++++++++++++++++ .github/workflows/android-env.yml | 29 ++++++++++++++---- .github/workflows/android-hicn.yml | 46 +++++++++++++++++++++++++++++ android/ci/Dockerfile_dep | 25 ++++++++++++++++ android/ci/Dockerfile_env | 2 +- android/ci/Dockerfile_hicn | 27 +++++++++++++++++ android/compileHicn.sh | 2 +- 7 files changed, 170 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/android-dep.yml create mode 100644 .github/workflows/android-hicn.yml create mode 100644 android/ci/Dockerfile_dep create mode 100644 android/ci/Dockerfile_hicn diff --git a/.github/workflows/android-dep.yml b/.github/workflows/android-dep.yml new file mode 100644 index 0000000..7bc3d1d --- /dev/null +++ b/.github/workflows/android-dep.yml @@ -0,0 +1,47 @@ + ############################################################################# + # Copyright (c) 2022 Cisco and/or its affiliates. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at: + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + ############################################################################## + +name: Docker Android Dep + +on: + schedule: + - cron: '0 3 * * *' + push: + branches: + - main + +jobs: + build: + name: 'Build' + runs-on: ubuntu-latest + steps: + - name: "Build:checkout" + uses: actions/checkout@v3 + - name: 'Get Previous tag' + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + with: + fallback: v0.0.0 + + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: ${{github.repository}}/android-dep + username: ${{ secrets.HICN_BOT }} + password: ${{ secrets.HICN_ACTIONS_TOKEN }} + registry: ghcr.io + dockerfile: android/ci/Dockerfile_dep + buildargs: BASE_IMAGE=ghcr.io/${{github.repository}}/android-env:latest + tags: latest,${{ steps.previoustag.outputs.tag }} \ No newline at end of file diff --git a/.github/workflows/android-env.yml b/.github/workflows/android-env.yml index 900d7d7..0fbed8e 100644 --- a/.github/workflows/android-env.yml +++ b/.github/workflows/android-env.yml @@ -17,7 +17,7 @@ name: Docker Android Environment on: schedule: - - cron: '0 0 1 */6 *' + - cron: '0 0 1 */1 *' push: branches: - main @@ -28,10 +28,27 @@ jobs: runs-on: ubuntu-latest steps: - name: "Build:checkout" - uses: actions/checkout@v2 - - name: Build and Publish latest Docker image - uses: VaultVulp/gp-docker-action@1.2.0 + uses: actions/checkout@v3 + - name: 'Get Previous tag' + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" with: - github-token: ${{ secrets.GITHUB_TOKEN }} - image-name: android-sdk-env + fallback: v0.0.0 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: ${{github.repository}}/android-env + username: ${{ secrets.HICN_BOT }} + password: ${{ secrets.HICN_ACTIONS_TOKEN }} + registry: ghcr.io dockerfile: android/ci/Dockerfile_env + tags: latest,${{ steps.previoustag.outputs.tag }} + # - name: Publish to Registry + # uses: jerray/publish-docker-action@master + # with: + # username: ${{ secrets.HICN_BOT }} + # password: ${{ secrets.HICN_ACTIONS_TOKEN }} + # repository: ${{github.repository}}/android-sdk + # registry: docker.pkg.github.com + # file: android/ci/Dockerfile_env + # tags: latest,${{ steps.previoustag.outputs.tag }} diff --git a/.github/workflows/android-hicn.yml b/.github/workflows/android-hicn.yml new file mode 100644 index 0000000..908a3c1 --- /dev/null +++ b/.github/workflows/android-hicn.yml @@ -0,0 +1,46 @@ + ############################################################################# + # Copyright (c) 2022 Cisco and/or its affiliates. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at: + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + ############################################################################## + +name: Docker Android Hicn + +on: + schedule: + - cron: '0 * * * *' + push: + branches: + - main + +jobs: + build: + name: 'Build' + runs-on: ubuntu-latest + steps: + - name: "Build:checkout" + uses: actions/checkout@v3 + - name: 'Get Previous tag' + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + with: + fallback: v0.0.0 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: ${{github.repository}}/android-hicn + username: ${{ secrets.HICN_BOT }} + password: ${{ secrets.HICN_ACTIONS_TOKEN }} + registry: ghcr.io + dockerfile: android/ci/Dockerfile_hicn + buildargs: BASE_IMAGE=ghcr.io/${{github.repository}}/android-dep:latest + tags: latest,${{ steps.previoustag.outputs.tag }} \ No newline at end of file diff --git a/android/ci/Dockerfile_dep b/android/ci/Dockerfile_dep new file mode 100644 index 0000000..d5cc196 --- /dev/null +++ b/android/ci/Dockerfile_dep @@ -0,0 +1,25 @@ +############################################################################# +# Copyright (c) 2022 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## + +ARG BASE_IMAGE=ubuntu:2204 +FROM $BASE_IMAGE + +MAINTAINER Angelo Mantellini + +COPY android /android-sdk + +WORKDIR /android-sdk + +RUN bash compileDep.sh &&rm -rf $(ls| grep -v 'sdk\|usr_aarch64\|usr_x86_64') \ No newline at end of file diff --git a/android/ci/Dockerfile_env b/android/ci/Dockerfile_env index 4335906..4c38fc9 100644 --- a/android/ci/Dockerfile_env +++ b/android/ci/Dockerfile_env @@ -36,4 +36,4 @@ COPY android /android-sdk WORKDIR /android-sdk -RUN bash compileDep.sh && rm -rf sdk/commandlinetools-mac-8512546_latest.zip && rm -rf usr_* src build_* && ls \ No newline at end of file +RUN make init_sdk && rm -rf sdk/commandlinetools-mac-8512546_latest.zip && rm -rf $(ls -1 | grep -v 'sdk') \ No newline at end of file diff --git a/android/ci/Dockerfile_hicn b/android/ci/Dockerfile_hicn new file mode 100644 index 0000000..aa1cf29 --- /dev/null +++ b/android/ci/Dockerfile_hicn @@ -0,0 +1,27 @@ +############################################################################# +# Copyright (c) 2022 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## + +ARG BASE_IMAGE=ubuntu:2204 +FROM $BASE_IMAGE + +MAINTAINER Angelo Mantellini + +COPY android /android-sdk + +WORKDIR /android-sdk + +RUN ls +RUN bash compileHicn.sh &&rm -rf $(ls| grep -v 'sdk\|usr_aarch64\|usr_x86_64') +RUN ls \ No newline at end of file diff --git a/android/compileHicn.sh b/android/compileHicn.sh index a09f99e..c8454a6 100755 --- a/android/compileHicn.sh +++ b/android/compileHicn.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -make download-hicn +make init_sdk download-hicn export ANDROID_ARCH="arm64" make compile-hicn export ANDROID_ARCH="x86_64" From 09a6c4683cc00b34e174b830b46a138936c37f8e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 26 Oct 2022 14:05:26 +0000 Subject: [PATCH 11/16] =?UTF-8?q?bump:=20version=200.0.1=20=E2=86=92=200.0?= =?UTF-8?q?.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cz.toml | 2 +- CHANGELOG.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.cz.toml b/.cz.toml index 92846d7..d0de0b2 100644 --- a/.cz.toml +++ b/.cz.toml @@ -1,5 +1,5 @@ [tool] [tool.commitizen] name = "cz_conventional_commits" -version = "0.0.1" +version = "0.0.2" tag_format = "v$version" diff --git a/CHANGELOG.md b/CHANGELOG.md index c2f2894..dad25cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## v0.0.2 (2022-10-26) + +### Feat + +- add multi stage docker images (#33) + +### Fix + +- **master.yml**: remove personal token (#26) + ## v0.0.1 (2022-10-19) ### Feat From 718ee4f091bdebe08afe1823de7d79f354cecee6 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Thu, 27 Oct 2022 08:54:06 +0200 Subject: [PATCH 12/16] feat: publish android aar to packages (#34) Ref: #30 #promote PATCH Signed-off-by: Angelo Mantellini --- .github/workflows/android-dep.yml | 4 +- .github/workflows/android-env.yml | 13 +- .github/workflows/android-hicn.yml | 6 +- .github/workflows/master.yml | 33 +++- .github/workflows/verify.yml | 23 ++- android/CommonLibrary/build.gradle | 5 +- android/CommonLibrary/common/build.gradle | 83 +++++----- android/CommonLibrary/gradle.properties | 3 + android/ci/Dockerfile | 38 +++-- android/ci/Dockerfile_dep | 2 +- android/ci/Dockerfile_env | 12 +- android/ci/Dockerfile_hicn | 2 +- android/ci/Dockerfile_verify | 37 +++++ android/ci/docker-build.sh | 15 +- android/ci/docker-publish.sh | 37 +++++ android/hicn-aar/FaceMgrLibrary/aar/common | 1 + .../FaceMgrLibrary/aar/common/.gitignore | 1 - .../FaceMgrLibrary/aar/common/build.gradle | 124 --------------- .../aar/common/consumer-rules.pro | 0 .../aar/common/proguard-rules.pro | 21 --- .../cisco/common/ExampleInstrumentedTest.java | 26 ---- .../aar/common/src/main/AndroidManifest.xml | 5 - .../com/cisco/hicn/common/CommonUtility.java | 7 - .../hicn/common/NetworkServiceHelper.java | 144 ------------------ .../com/cisco/hicn/common/SocketBinder.java | 80 ---------- .../hicn/cisco/common/ExampleUnitTest.java | 17 --- android/hicn-aar/FaceMgrLibrary/build.gradle | 7 +- .../facemgrLibrary/build.gradle | 83 ++++++---- .../hicn-aar/FaceMgrLibrary/settings.gradle | 5 +- .../ForwarderLibrary/aar/common/build.gradle | 65 ++++---- .../hicn-aar/ForwarderLibrary/build.gradle | 4 +- .../ForwarderLibrary/gradle.properties | 1 + .../hicnforwarderLibrary/build.gradle | 73 ++++----- .../hicn-aar/ForwarderLibrary/settings.gradle | 5 +- android/scripts/compile_facemgr_aar.sh | 4 +- android/scripts/compile_hicnforwarder_aar.sh | 4 +- android/scripts/publish_common_aar.sh | 39 ++--- 37 files changed, 370 insertions(+), 659 deletions(-) create mode 100644 android/ci/Dockerfile_verify create mode 100755 android/ci/docker-publish.sh create mode 120000 android/hicn-aar/FaceMgrLibrary/aar/common delete mode 100644 android/hicn-aar/FaceMgrLibrary/aar/common/.gitignore delete mode 100644 android/hicn-aar/FaceMgrLibrary/aar/common/build.gradle delete mode 100644 android/hicn-aar/FaceMgrLibrary/aar/common/consumer-rules.pro delete mode 100644 android/hicn-aar/FaceMgrLibrary/aar/common/proguard-rules.pro delete mode 100644 android/hicn-aar/FaceMgrLibrary/aar/common/src/androidTest/java/hicn/cisco/common/ExampleInstrumentedTest.java delete mode 100644 android/hicn-aar/FaceMgrLibrary/aar/common/src/main/AndroidManifest.xml delete mode 100644 android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/CommonUtility.java delete mode 100644 android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/NetworkServiceHelper.java delete mode 100644 android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/SocketBinder.java delete mode 100644 android/hicn-aar/FaceMgrLibrary/aar/common/src/test/java/hicn/cisco/common/ExampleUnitTest.java diff --git a/.github/workflows/android-dep.yml b/.github/workflows/android-dep.yml index 7bc3d1d..53c3da0 100644 --- a/.github/workflows/android-dep.yml +++ b/.github/workflows/android-dep.yml @@ -29,6 +29,8 @@ jobs: steps: - name: "Build:checkout" uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: 'Get Previous tag' id: previoustag uses: "WyriHaximus/github-action-get-previous-tag@v1" @@ -36,7 +38,7 @@ jobs: fallback: v0.0.0 - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master + uses: elgohr/Publish-Docker-Github-Action@v4 with: name: ${{github.repository}}/android-dep username: ${{ secrets.HICN_BOT }} diff --git a/.github/workflows/android-env.yml b/.github/workflows/android-env.yml index 0fbed8e..e4f61ab 100644 --- a/.github/workflows/android-env.yml +++ b/.github/workflows/android-env.yml @@ -29,13 +29,15 @@ jobs: steps: - name: "Build:checkout" uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: 'Get Previous tag' id: previoustag uses: "WyriHaximus/github-action-get-previous-tag@v1" with: fallback: v0.0.0 - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master + uses: elgohr/Publish-Docker-Github-Action@v4 with: name: ${{github.repository}}/android-env username: ${{ secrets.HICN_BOT }} @@ -43,12 +45,3 @@ jobs: registry: ghcr.io dockerfile: android/ci/Dockerfile_env tags: latest,${{ steps.previoustag.outputs.tag }} - # - name: Publish to Registry - # uses: jerray/publish-docker-action@master - # with: - # username: ${{ secrets.HICN_BOT }} - # password: ${{ secrets.HICN_ACTIONS_TOKEN }} - # repository: ${{github.repository}}/android-sdk - # registry: docker.pkg.github.com - # file: android/ci/Dockerfile_env - # tags: latest,${{ steps.previoustag.outputs.tag }} diff --git a/.github/workflows/android-hicn.yml b/.github/workflows/android-hicn.yml index 908a3c1..55f857d 100644 --- a/.github/workflows/android-hicn.yml +++ b/.github/workflows/android-hicn.yml @@ -1,4 +1,4 @@ - ############################################################################# +############################################################################# # Copyright (c) 2022 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,11 +35,11 @@ jobs: with: fallback: v0.0.0 - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master + uses: elgohr/Publish-Docker-Github-Action@v4 with: name: ${{github.repository}}/android-hicn - username: ${{ secrets.HICN_BOT }} password: ${{ secrets.HICN_ACTIONS_TOKEN }} + username: ${{ secrets.HICN_BOT }} registry: ghcr.io dockerfile: android/ci/Dockerfile_hicn buildargs: BASE_IMAGE=ghcr.io/${{github.repository}}/android-dep:latest diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 11fb14a..94ad85f 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -13,6 +13,8 @@ # limitations under the License. ############################################################################## +name: Master Branch Job + on: push: branches: @@ -26,7 +28,7 @@ jobs: Master: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: "${{ github.event.pull_request.head.ref }}" repository: "${{ github.event.pull_request.head.repo.full_name}}" @@ -36,12 +38,12 @@ jobs: id: run run: | echo $GITHUB_SHA - if git describe --exact-match $GITHUB_SHA; then + if git describe --tags --exact-match $GITHUB_SHA; then echo ::set-output name=istag::'true' else echo ::set-output name=istag::'false' fi - git describe --exact-match $GITHUB_SHA | true + git describe --tags --exact-match $GITHUB_SHA | true PROMOTE=$(echo "${{ github.event.head_commit.message }}" | \ grep -e "#promote" | \ awk '$0 ~ /#promote/ { print "promote" }') @@ -51,6 +53,11 @@ jobs: awk -F ' ' '{print $1}') echo ::set-output name=promote::$PROMOTE echo ::set-output name=promote-level::$PROMOTE_LEVEL + - name: 'Get Previous tag' + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + with: + fallback: v0.0.0 - name: Create bump and changelog id: cz if: "!startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.promote == 'promote' && steps.run.outputs.promote-level != ''" @@ -63,7 +70,21 @@ jobs: - name: Print Version if: "!startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.promote == 'promote' && steps.run.outputs.promote-level != ''" run: echo "Bumped to version ${{ steps.cz.outputs.version }}" - - name: Build Android + - name: Build and push aar libraries if: "startsWith(github.event.head_commit.message, 'bump:') && steps.run.outputs.istag == 'true'" - run: | - bash android/ci/docker-build.sh + uses: elgohr/Publish-Docker-Github-Action@v4 + env: + BASE_IMAGE: ghcr.io/${{github.repository}}/android-hicn:latest + GITHUB_USERNAME: ${{ secrets.HICN_BOT }} + GITHUB_PASSWORD: ${{ secrets.HICN_ACTIONS_TOKEN }} + GITHUB_MVN_REPO: 'https://maven.pkg.github.com/${{github.repository}}' + VERSION: ${{ steps.previoustag.outputs.tag }} + with: + name: ${{github.repository}}/android-build-aar + username: ${{ env.GITHUB_USERNAME }} + password: ${{ env.GITHUB_PASSWORD }} + registry: ghcr.io + dockerfile: android/ci/Dockerfile + buildargs: BASE_IMAGE,GITHUB_USERNAME,GITHUB_PASSWORD,GITHUB_MVN_REPO,VERSION + no_push: true + context: android diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 2f4c714..0c2429c 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -13,6 +13,8 @@ # limitations under the License. ############################################################################## +name: Very job for Android + on: pull_request: types: @@ -27,7 +29,7 @@ jobs: Verify: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: "${{ github.event.pull_request.head.ref }}" repository: "${{ github.event.pull_request.head.repo.full_name}}" @@ -40,7 +42,18 @@ jobs: echo "::set-output name=commit::$COMMIT_ID" - name: Check commits uses: manang/commitizen-check@v0.0.1 - - name: compile docker - id: compile - run: | - bash android/ci/docker-build.sh + - name: Verify + uses: elgohr/Publish-Docker-Github-Action@v4 + env: + BASE_IMAGE: ghcr.io/${{github.repository}}/android-hicn:latest + GITHUB_USERNAME: ${{ github.actor }} + GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + with: + name: ${{github.repository}}/android-verify + username: ${{ env.GITHUB_USERNAME }} + password: ${{ env.GITHUB_PASSWORD }} + registry: ghcr.io + dockerfile: android/ci/Dockerfile_verify + buildargs: BASE_IMAGE + no_push: true + context: android diff --git a/android/CommonLibrary/build.gradle b/android/CommonLibrary/build.gradle index 62418d9..f719677 100644 --- a/android/CommonLibrary/build.gradle +++ b/android/CommonLibrary/build.gradle @@ -15,7 +15,10 @@ buildscript { ext { - VERSION = '1' + MVN_REPO = '' + A_USER = '' + A_PASSWORD = '' + VERSION_NUMBER = 'v0.0.10' } repositories { diff --git a/android/CommonLibrary/common/build.gradle b/android/CommonLibrary/common/build.gradle index 5763dd0..b6cb0d8 100644 --- a/android/CommonLibrary/common/build.gradle +++ b/android/CommonLibrary/common/build.gradle @@ -6,14 +6,13 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:4.2.2' - //classpath 'com.android.tools.build:gradle:3.0.0' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' } } plugins { id 'com.android.library' - id 'maven-publish' + id("maven-publish") } @@ -25,11 +24,11 @@ android { minSdkVersion 28 targetSdkVersion 30 versionCode 1 - versionName "1.0" + versionName getProjectProperty('VERSION_NUMBER') testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" - buildConfigField "String", "VERSION", "\"" + this.properties['VERSION']?.trim() + "\"" + buildConfigField "String", "VERSION", "\"" + this.properties['VERSION_NUMBER']?.trim() + "\"" } buildTypes { @@ -46,22 +45,13 @@ android { libraryVariants.all { variant -> variant.outputs.each { output -> - output.outputFileName = "common-${variant.name}-${defaultConfig.versionName}-${defaultConfig.versionCode}.aar" + output.outputFileName = "hicn-common-${variant.name}-${defaultConfig.versionName}-${defaultConfig.versionCode}.aar" } } } -def getVersionCode_() { - - if ("${getProjectProperty('VERSION_CODE')}".isEmpty()) - return 5 - else { - return "${getProjectProperty('VERSION_CODE')}".toInteger() - } -} - def getVersion() { if ("${getProjectProperty('VERSION')}".isEmpty()) @@ -73,7 +63,7 @@ def getVersion() { def String getProjectProperty(String propertyName) { - String value = "1" + String value = "v0.0.0" if (hasProperty(propertyName)) { value = this.properties[propertyName] @@ -81,38 +71,37 @@ def String getProjectProperty(String propertyName) return value } -// publishing { -// repositories { -// maven { -// name = 'GitHubPackages' -// url = uri(project.findProperty('MVN_REPO')) -// credentials { -// username = project.findProperty('A_USER') -// password = project.findProperty('A_PASSWORD') -// } -// } - -// } - -// afterEvaluate { -// publications { -// release(MavenPublication) { -// from components.release - -// groupId = 'com.cisco.hicn' -// version = project.findProperty('VERSION') -// artifactId 'common' -// } -// debug(MavenPublication) { -// from components.debug - -// groupId = 'com.cisco.hicn' -// version = project.findProperty('VERSION') -// artifactId 'common-debug' -// } -// } -// } -// } +publishing { + repositories { + maven { + name = 'GitHubPackages' + url = project.findProperty('MVN_REPO') + credentials { + username = project.findProperty('A_USER') + password = project.findProperty('A_PASSWORD') + } + } + + } + + afterEvaluate { + publications { + release(MavenPublication) { + from components.release + + groupId = 'com.cisco.hicn' + version = getProjectProperty('VERSION_NUMBER') + artifactId 'hicn-common' + } + debug(MavenPublication) { + from components.debug + groupId = 'com.cisco.hicn' + version = getProjectProperty('VERSION_NUMBER') + artifactId 'hicn-common-debug' + } + } + } +} dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' diff --git a/android/CommonLibrary/gradle.properties b/android/CommonLibrary/gradle.properties index 6dd0218..f728266 100644 --- a/android/CommonLibrary/gradle.properties +++ b/android/CommonLibrary/gradle.properties @@ -16,3 +16,6 @@ android.useAndroidX=true # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + +GITHUB_ACTOR=manang +GITHUB_TOKEN=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 \ No newline at end of file diff --git a/android/ci/Dockerfile b/android/ci/Dockerfile index bd014dd..cbe3111 100644 --- a/android/ci/Dockerfile +++ b/android/ci/Dockerfile @@ -13,29 +13,27 @@ # limitations under the License. ############################################################################## -FROM ubuntu:22.04 as android-sdk-dep +ARG BASE_IMAGE=ubuntu:22.04 +FROM $BASE_IMAGE -ENV TZ=Europe/Paris -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -RUN apt update && apt install -y build-essential openjdk-11-jdk git autoconf libtool wget unzip python3 -RUN wget -c https://services.gradle.org/distributions/gradle-7.4.2-bin.zip -P /tmp \ - && unzip -d /opt/gradle /tmp/gradle-7.4.2-bin.zip \ - && rm /tmp/gradle-7.4.2-bin.zip \ - && echo export GRADLE_HOME=/opt/gradle/gradle-7.4.2 >> /etc/profile.d/gradle.sh \ - && echo export PATH=/opt/gradle/gradle-7.4.2/bin:${PATH} >> /etc/profile.d/gradle.sh \ - && cat /etc/profile.d/gradle.sh \ - && chmod +x /etc/profile.d/gradle.sh \ - && . /etc/profile.d/gradle.sh \ - && gradle --version -ENV PATH=/opt/gradle/gradle-7.4.2/bin:${PATH} +MAINTAINER Angelo Mantellini + +ARG GITHUB_USERNAME +ARG GITHUB_PASSWORD +ARG GITHUB_MVN_REPO +ARG VERSION +ENV A_USERNAME=$GITHUB_USERNAME +ENV A_PASSWORD=$GITHUB_PASSWORD +ENV GITHUB_MVN_REPO=$GITHUB_MVN_REPO +ENV VERSION=$VERSION COPY . /android-sdk WORKDIR /android-sdk -RUN make init_sdk && ./compileAll.sh && rm -rf sdk/commandlinetools*.zip && bash compileDep.sh && rm -rf src build* -FROM android-sdk-dep as android-sdk-build -RUN gradle --version -RUN echo sdk.dir=`pwd`/sdk > CommonLibrary/local.properties && cd CommonLibrary && gradle compileReleaseSources -RUN make android_facemgrlibraryaar -RUN make android_forwarderlibraryaar +RUN echo sdk.dir=`pwd`/sdk > CommonLibrary/local.properties && cd CommonLibrary \ + && gradle publish -PA_USER=${A_USERNAME} -PA_PASSWORD=${A_PASSWORD} -PVERSION_NUMBER=${VERSION} -PMODULE_SRC='0' -PMVN_REPO=${GITHUB_MVN_REPO} +RUN echo sdk.dir=`pwd`/sdk > hicn-aar/FaceMgrLibrary/local.properties && cd hicn-aar && cd FaceMgrLibrary \ + && gradle publish -PA_USER=${A_USERNAME} -PA_PASSWORD=${A_PASSWORD} -PVERSION_NUMBER=${VERSION} -PMODULE_SRC='0' -PMVN_REPO=${GITHUB_MVN_REPO} +RUN echo sdk.dir=`pwd`/sdk > hicn-aar/ForwarderLibrary/local.properties && cd hicn-aar && cd ForwarderLibrary \ + && gradle publish -PA_USER=${A_USERNAME} -PA_PASSWORD=${A_PASSWORD} -PVERSION_NUMBER=${VERSION} -PMODULE_SRC='0' -PMVN_REPO=${GITHUB_MVN_REPO} diff --git a/android/ci/Dockerfile_dep b/android/ci/Dockerfile_dep index d5cc196..d6565be 100644 --- a/android/ci/Dockerfile_dep +++ b/android/ci/Dockerfile_dep @@ -13,7 +13,7 @@ # limitations under the License. ############################################################################## -ARG BASE_IMAGE=ubuntu:2204 +ARG BASE_IMAGE=ubuntu:22.04 FROM $BASE_IMAGE MAINTAINER Angelo Mantellini diff --git a/android/ci/Dockerfile_env b/android/ci/Dockerfile_env index 4c38fc9..6002f03 100644 --- a/android/ci/Dockerfile_env +++ b/android/ci/Dockerfile_env @@ -20,17 +20,17 @@ MAINTAINER Angelo Mantellini ENV VERBOSE=1 RUN apt update && apt install -y build-essential openjdk-11-jdk git autoconf libtool wget unzip python3 && apt clean -RUN wget -c https://services.gradle.org/distributions/gradle-7.4.2-bin.zip -P /tmp \ - && unzip -d /opt/gradle /tmp/gradle-7.4.2-bin.zip \ - && rm /tmp/gradle-7.4.2-bin.zip \ - && echo export GRADLE_HOME=/opt/gradle/gradle-7.4.2 >> /etc/profile.d/gradle.sh \ - && echo export PATH=/opt/gradle/gradle-7.4.2/bin:${PATH} >> /etc/profile.d/gradle.sh \ +RUN wget -c https://services.gradle.org/distributions/gradle-7.5.1-bin.zip -P /tmp \ + && unzip -d /opt/gradle /tmp/gradle-7.5.1-bin.zip \ + && rm /tmp/gradle-7.5.1-bin.zip \ + && echo export GRADLE_HOME=/opt/gradle/gradle-7.5.1 >> /etc/profile.d/gradle.sh \ + && echo export PATH=/opt/gradle/gradle-7.5.1/bin:${PATH} >> /etc/profile.d/gradle.sh \ && cat /etc/profile.d/gradle.sh \ && chmod +x /etc/profile.d/gradle.sh \ && . /etc/profile.d/gradle.sh \ && gradle --version -ENV PATH=/opt/gradle/gradle-7.4.2/bin:${PATH} +ENV PATH=/opt/gradle/gradle-7.5.1/bin:${PATH} COPY android /android-sdk diff --git a/android/ci/Dockerfile_hicn b/android/ci/Dockerfile_hicn index aa1cf29..b9d0e64 100644 --- a/android/ci/Dockerfile_hicn +++ b/android/ci/Dockerfile_hicn @@ -13,7 +13,7 @@ # limitations under the License. ############################################################################## -ARG BASE_IMAGE=ubuntu:2204 +ARG BASE_IMAGE=ubuntu:22.04 FROM $BASE_IMAGE MAINTAINER Angelo Mantellini diff --git a/android/ci/Dockerfile_verify b/android/ci/Dockerfile_verify new file mode 100644 index 0000000..154af95 --- /dev/null +++ b/android/ci/Dockerfile_verify @@ -0,0 +1,37 @@ + ############################################################################# + # Copyright (c) 2022 Cisco and/or its affiliates. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at: + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + ############################################################################## + +ARG BASE_IMAGE=ubuntu:22.04 +FROM $BASE_IMAGE + +MAINTAINER Angelo Mantellini + +ARG GITHUB_USERNAME +ARG GITHUB_PASSWORD +ARG GITHUB_MVN_REPO +ARG VERSION +ENV A_USERNAME=$GITHUB_USERNAME +ENV A_PASSWORD=$GITHUB_PASSWORD +ENV GITHUB_MVN_REPO=$GITHUB_MVN_REPO +ENV VERSION=$VERSION + +COPY . /android-sdk + +WORKDIR /android-sdk + +RUN gradle --version +RUN echo sdk.dir=`pwd`/sdk > CommonLibrary/local.properties && cd CommonLibrary && gradle compileReleaseSources +RUN make android_facemgrlibraryaar +RUN make android_forwarderlibraryaar \ No newline at end of file diff --git a/android/ci/docker-build.sh b/android/ci/docker-build.sh index e998bb9..f042fbc 100755 --- a/android/ci/docker-build.sh +++ b/android/ci/docker-build.sh @@ -23,18 +23,13 @@ echo "**********************************************************" echo "******************* Compilation *************************" echo "***********************************************************" -ANDRODI_SDK_DEP=android-sdk-dep -ANDRODI_SDK_BUILD=android-sdk-build - -docker build --no-cache --progress=plain \ - --target ${ANDRODI_SDK_DEP} \ - -t ${ANDRODI_SDK_DEP} \ - -f android/ci/Dockerfile \ - android +ANDROID_SDK_DEP=android-sdk-dep +ANDROID_SDK_BUILD=android-sdk-build docker build \ --progress=plain \ - --target ${ANDRODI_SDK_BUILD} \ - -t ${ANDRODI_SDK_BUILD} \ + --target ${ANDROID_SDK_BUILD} \ + -t ${ANDROID_SDK_BUILD} \ + --build-arg BASE_IMAGE \ -f android/ci/Dockerfile \ android diff --git a/android/ci/docker-publish.sh b/android/ci/docker-publish.sh new file mode 100755 index 0000000..82baf15 --- /dev/null +++ b/android/ci/docker-publish.sh @@ -0,0 +1,37 @@ + ############################################################################# + # Copyright (c) 2022 Cisco and/or its affiliates. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at: + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + ############################################################################## + +#!/bin/bash + +set -e +set -x +set -o pipefail + +echo "**********************************************************" +echo "******************* Compilation *************************" +echo "***********************************************************" + +ANDROID_SDK_DEP=android-sdk-dep +ANDROID_SDK_PUBLISH=android-sdk-build +HICN_AAR_PUBLISH=android-sdk-publish + +docker build \ + -t ${HICN_AAR_PUBLISH} \ + --target ${HICN_AAR_PUBLISH} \ + --build-arg GITHUB_USERNAME \ + --build-arg GITHUB_PASSWORD \ + --build-arg GITHUB_MVN_REPO \ + -f android/ci/Dockerfile \ + android diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common b/android/hicn-aar/FaceMgrLibrary/aar/common new file mode 120000 index 0000000..996d802 --- /dev/null +++ b/android/hicn-aar/FaceMgrLibrary/aar/common @@ -0,0 +1 @@ +../../../CommonLibrary/common \ No newline at end of file diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common/.gitignore b/android/hicn-aar/FaceMgrLibrary/aar/common/.gitignore deleted file mode 100644 index 42afabf..0000000 --- a/android/hicn-aar/FaceMgrLibrary/aar/common/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common/build.gradle b/android/hicn-aar/FaceMgrLibrary/aar/common/build.gradle deleted file mode 100644 index 5763dd0..0000000 --- a/android/hicn-aar/FaceMgrLibrary/aar/common/build.gradle +++ /dev/null @@ -1,124 +0,0 @@ - -buildscript { - repositories { - mavenCentral() - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' - //classpath 'com.android.tools.build:gradle:3.0.0' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' - } -} - -plugins { - id 'com.android.library' - id 'maven-publish' -} - - - -android { - compileSdkVersion 30 - - defaultConfig { - minSdkVersion 28 - targetSdkVersion 30 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - buildConfigField "String", "VERSION", "\"" + this.properties['VERSION']?.trim() + "\"" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - libraryVariants.all { variant -> - variant.outputs.each { output -> - output.outputFileName = "common-${variant.name}-${defaultConfig.versionName}-${defaultConfig.versionCode}.aar" - } - } - -} - - -def getVersionCode_() { - - if ("${getProjectProperty('VERSION_CODE')}".isEmpty()) - return 5 - else { - return "${getProjectProperty('VERSION_CODE')}".toInteger() - } -} - -def getVersion() { - - if ("${getProjectProperty('VERSION')}".isEmpty()) - return "1.0" - else { - return "${getProjectProperty('VERSION')}" - } -} - -def String getProjectProperty(String propertyName) -{ - String value = "1" - if (hasProperty(propertyName)) - { - value = this.properties[propertyName] - } - return value -} - -// publishing { -// repositories { -// maven { -// name = 'GitHubPackages' -// url = uri(project.findProperty('MVN_REPO')) -// credentials { -// username = project.findProperty('A_USER') -// password = project.findProperty('A_PASSWORD') -// } -// } - -// } - -// afterEvaluate { -// publications { -// release(MavenPublication) { -// from components.release - -// groupId = 'com.cisco.hicn' -// version = project.findProperty('VERSION') -// artifactId 'common' -// } -// debug(MavenPublication) { -// from components.debug - -// groupId = 'com.cisco.hicn' -// version = project.findProperty('VERSION') -// artifactId 'common-debug' -// } -// } -// } -// } - -dependencies { - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'com.google.android.material:material:1.2.1' - testImplementation 'junit:junit:4.+' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' - -} diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common/consumer-rules.pro b/android/hicn-aar/FaceMgrLibrary/aar/common/consumer-rules.pro deleted file mode 100644 index e69de29..0000000 diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common/proguard-rules.pro b/android/hicn-aar/FaceMgrLibrary/aar/common/proguard-rules.pro deleted file mode 100644 index 481bb43..0000000 --- a/android/hicn-aar/FaceMgrLibrary/aar/common/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common/src/androidTest/java/hicn/cisco/common/ExampleInstrumentedTest.java b/android/hicn-aar/FaceMgrLibrary/aar/common/src/androidTest/java/hicn/cisco/common/ExampleInstrumentedTest.java deleted file mode 100644 index d867bcd..0000000 --- a/android/hicn-aar/FaceMgrLibrary/aar/common/src/androidTest/java/hicn/cisco/common/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package hicn.cisco.common; - -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - assertEquals("hicn.cisco.common.test", appContext.getPackageName()); - } -} \ No newline at end of file diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/AndroidManifest.xml b/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/AndroidManifest.xml deleted file mode 100644 index 75fb830..0000000 --- a/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/CommonUtility.java b/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/CommonUtility.java deleted file mode 100644 index 6ee65cf..0000000 --- a/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/CommonUtility.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.cisco.hicn.common; - -public class CommonUtility { - public static String getAndroidSdkVersion() { - return BuildConfig.VERSION; - } -} diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/NetworkServiceHelper.java b/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/NetworkServiceHelper.java deleted file mode 100644 index bd3c08d..0000000 --- a/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/NetworkServiceHelper.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2019 Cisco and/or its affiliates. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cisco.hicn.common; -import android.content.Context; -import android.net.ConnectivityManager; -import android.net.LinkAddress; -import android.net.LinkProperties; -import android.net.Network; -import android.net.NetworkCapabilities; -import android.net.NetworkRequest; -import android.util.Log; -import androidx.annotation.NonNull; -import java.net.Inet4Address; - -public class NetworkServiceHelper { - private static final String TAG = "Hicn." + NetworkServiceHelper.class.getSimpleName(); - - private ConnectivityManager mConMan; - private SocketBinder mSocketBinder; - private ConnectivityManager.NetworkCallback mMobileNetworkCallback; - private ConnectivityManager.NetworkCallback mWifiNetworkCallback; - - public void init(Context ctx, SocketBinder socketBinder) { - mConMan = (ConnectivityManager) ctx.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); - mSocketBinder = socketBinder; - - requestMobileNetwork(); - requestWifiNetwork(); - } - - public void clear() { - if (mConMan != null) { - if (mMobileNetworkCallback != null) { - mConMan.unregisterNetworkCallback(mMobileNetworkCallback); - mMobileNetworkCallback = null; - Log.i(TAG, "Mobile network released"); - } - if (mWifiNetworkCallback != null) { - mConMan.unregisterNetworkCallback(mWifiNetworkCallback); - mWifiNetworkCallback = null; - Log.i(TAG, "Wi-Fi network released"); - } - } - } - - private void requestMobileNetwork() { - final int[] transportTypes = new int[]{NetworkCapabilities.TRANSPORT_CELLULAR}; - final int[] capabilities = new int[]{NetworkCapabilities.NET_CAPABILITY_INTERNET, NetworkCapabilities.NET_CAPABILITY_NOT_VPN}; - - if (mMobileNetworkCallback != null) { - Log.d(TAG, "Already mobile network requested"); - return; - } - mMobileNetworkCallback = new ConnectivityManager.NetworkCallback() { - @Override - public void onAvailable(Network network) { - mSocketBinder.addNetwork(getIfname(transportTypes, capabilities), network); - } - }; - - Log.i(TAG, "Request mobile network"); - requestPreferredNetworksWith(transportTypes, capabilities, mMobileNetworkCallback); - } - - private void requestWifiNetwork() { - final int[] transportTypes = new int[]{NetworkCapabilities.TRANSPORT_WIFI}; - final int[] capabilities = new int[]{NetworkCapabilities.NET_CAPABILITY_INTERNET, NetworkCapabilities.NET_CAPABILITY_NOT_VPN}; - - - if (mWifiNetworkCallback != null) { - Log.d(TAG, "Already Wi-Fi network requested"); - return; - } - mWifiNetworkCallback = new ConnectivityManager.NetworkCallback() { - @Override - public void onAvailable(Network network) { - mSocketBinder.addNetwork(getIfname(transportTypes, capabilities), network); - } - }; - - Log.i(TAG, "Request Wi-Fi network"); - requestPreferredNetworksWith(transportTypes, capabilities, mWifiNetworkCallback); - } - - private void requestPreferredNetworksWith(@NonNull int[] transportTypes, @NonNull int[] capabilities, - @NonNull ConnectivityManager.NetworkCallback callback) { - NetworkRequest.Builder builder = new NetworkRequest.Builder(); - - for (int trans : transportTypes) - builder.addTransportType(trans); - - for (int cap : capabilities) - builder.addCapability(cap); - - NetworkRequest request = builder.build(); - mConMan.requestNetwork(request, callback); - } - - private boolean hasAllFlags(NetworkCapabilities nc, - @NonNull int[] transportTypes, @NonNull int[] capabilities) { - for (int t : transportTypes) { - if (!nc.hasTransport(t)) - return false; - } - for (int c : capabilities) { - if (!nc.hasCapability(c)) - return false; - } - return true; - } - - private String getIfname(@NonNull int[] transportTypes, @NonNull int[] capabilities) { - String ifname = ""; - - final Network[] networks = mConMan.getAllNetworks(); - for (final Network nw : networks) { - NetworkCapabilities nc = mConMan.getNetworkCapabilities(nw); - if (hasAllFlags(nc, transportTypes, capabilities)) { - LinkProperties lp = mConMan.getLinkProperties(nw); - Log.d(TAG, "iface: " + lp.toString()); - for (LinkAddress addr : lp.getLinkAddresses()) { - if (addr.getAddress() instanceof Inet4Address) { - ifname = lp.getInterfaceName(); - break; - } - } - } - } - return ifname; - } -} diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/SocketBinder.java b/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/SocketBinder.java deleted file mode 100644 index d13b286..0000000 --- a/android/hicn-aar/FaceMgrLibrary/aar/common/src/main/java/com/cisco/hicn/common/SocketBinder.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2019 Cisco and/or its affiliates. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cisco.hicn.common; - -import android.net.Network; -import android.util.Log; - -import java.io.FileDescriptor; -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Hashtable; - -public class SocketBinder { - private static final String TAG = "Hicn." + SocketBinder.class.getSimpleName(); - private Hashtable mNetworks = new Hashtable<>(); - - public void addNetwork(String ifname, Network network) { - Log.i(TAG, "Network added: " + ifname); - mNetworks.put(ifname, network); - } - - public int getNumberOfNetworks() { - return mNetworks.size(); - } - - public ArrayList getAllNetworkNames() { - return Collections.list(mNetworks.keys()); - } - - public Network getNetwork(String ifname) { - return mNetworks.get(ifname); - } - - public boolean bindSocket(int sock, String ifname) { - boolean ret = false; - - Network network = mNetworks.get(ifname); - if (network != null) - ret = bindSocket(sock, network); - - Log.i(TAG, "bindSocket(" + sock + ", " + ifname + ")=" + ret); - return ret; - } - - private boolean bindSocket(int sock, Network network) { - try { - FileDescriptor fd = new FileDescriptor(); - Field field = FileDescriptor.class.getDeclaredField("descriptor"); - field.setAccessible(true); - field.setInt(fd, sock); - field.setAccessible(false); - - network.bindSocket(fd); - return true; - } catch (SecurityException | IllegalArgumentException - | NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - Log.e(TAG, e.toString()); - } catch (IOException e) { - e.printStackTrace(); - Log.e(TAG, e.toString()); - } - return false; - } -} diff --git a/android/hicn-aar/FaceMgrLibrary/aar/common/src/test/java/hicn/cisco/common/ExampleUnitTest.java b/android/hicn-aar/FaceMgrLibrary/aar/common/src/test/java/hicn/cisco/common/ExampleUnitTest.java deleted file mode 100644 index 7697a6c..0000000 --- a/android/hicn-aar/FaceMgrLibrary/aar/common/src/test/java/hicn/cisco/common/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package hicn.cisco.common; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/android/hicn-aar/FaceMgrLibrary/build.gradle b/android/hicn-aar/FaceMgrLibrary/build.gradle index 996d1cc..dfbfac8 100644 --- a/android/hicn-aar/FaceMgrLibrary/build.gradle +++ b/android/hicn-aar/FaceMgrLibrary/build.gradle @@ -13,10 +13,15 @@ * limitations under the License. */ + + buildscript { ext { MODULE_SRC = '1' - VERSION = '1' + A_USER = '' + A_PASSWORD = '' + MVN_REPO = '' + VERSION_NUMBER = 'v0.0.10' } repositories { google() diff --git a/android/hicn-aar/FaceMgrLibrary/facemgrLibrary/build.gradle b/android/hicn-aar/FaceMgrLibrary/facemgrLibrary/build.gradle index 4996350..a8568f0 100644 --- a/android/hicn-aar/FaceMgrLibrary/facemgrLibrary/build.gradle +++ b/android/hicn-aar/FaceMgrLibrary/facemgrLibrary/build.gradle @@ -1,8 +1,7 @@ - buildscript { repositories { - mavenCentral() google() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.0.4' @@ -17,7 +16,6 @@ plugins { apply from: '../../properties.gradle' - android { compileSdkVersion 30 @@ -43,7 +41,8 @@ android { include 'arm64-v8a', 'x86_64' } } - buildConfigField "String", "VERSION", "\"" + this.properties['VERSION']?.trim() + "\"" + + buildConfigField "String", "VERSION", "\"" + this.properties['VERSION_NUMBER']?.trim() + "\"" } buildTypes { @@ -67,7 +66,7 @@ android { libraryVariants.all { variant -> variant.outputs.each { output -> - output.outputFileName = "facemgrlibrary-${getVersion()}.aar" + output.outputFileName = "hicnfacemgrlibrary-${getVersion()}.aar" } } @@ -85,10 +84,10 @@ def getVersionCode_() { def getVersion() { - if ("${getProjectProperty('VERSION')}".isEmpty()) + if ("${getProjectProperty('VERSION_NUMBER')}".isEmpty()) return "1.0" else { - return "${getProjectProperty('VERSION')}" + return "${getProjectProperty('VERSION_NUMBER')}" } } @@ -102,34 +101,64 @@ def String getProjectProperty(String propertyName) return value } -// publishing { +publishing { + if (Integer.parseInt(this.properties['MODULE_SRC']) == 0) { + repositories { + maven { + name = 'GitHubPackages' + url = project.findProperty('MVN_REPO') + credentials { + username = project.findProperty('A_USER') + password = project.findProperty('A_PASSWORD') + } + } + } -// afterEvaluate { -// publications { -// release(MavenPublication) { -// from components.release -// groupId = 'com.cisco.hicn' -// version = project.findProperty('VERSION') -// artifactId 'facemgr' -// } -// debug(MavenPublication) { -// from components.debug + afterEvaluate { + publications { + release(MavenPublication) { + from components.release -// groupId = 'com.cisco.hicn' -// version = project.findProperty('VERSION') -// artifactId 'facemgr-debug' -// } -// } -// } -// } + groupId = 'com.cisco.hicn' + version = project.findProperty('VERSION_NUMBER') + artifactId 'hicnfacemgr' + } + debug(MavenPublication) { + from components.debug + + groupId = 'com.cisco.hicn' + version = project.findProperty('VERSION_NUMBER') + artifactId 'hicnfacemgr-debug' + } + } + } + } +} + +repositories { + if (Integer.parseInt(this.properties['MODULE_SRC']) == 0) { + maven { + name = 'Artifactory' + url = uri(this.properties['MVN_REPO']) + credentials { + username = this.properties["A_USER"] + password = this.properties["A_PASSWORD"] + } + } + } +} dependencies { - implementation project(":aar:common") + if (Integer.parseInt(this.properties['MODULE_SRC']) == 0) { + implementation 'com.cisco.hicn:hicn-common:' + project.findProperty('VERSION_NUMBER') + } else { + implementation project(":aar:common") + } implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'com.google.android.material:material:1.2.1' testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' -} +} \ No newline at end of file diff --git a/android/hicn-aar/FaceMgrLibrary/settings.gradle b/android/hicn-aar/FaceMgrLibrary/settings.gradle index 5f52e5d..fcf8fcf 100644 --- a/android/hicn-aar/FaceMgrLibrary/settings.gradle +++ b/android/hicn-aar/FaceMgrLibrary/settings.gradle @@ -1,3 +1,4 @@ -include ':aar:common' +if(Integer.parseInt(getProperties().get("MODULE_SRC")) == 1) { + include ':aar:common' +} include ':facemgrLibrary' - diff --git a/android/hicn-aar/ForwarderLibrary/aar/common/build.gradle b/android/hicn-aar/ForwarderLibrary/aar/common/build.gradle index 5763dd0..c5ea46d 100644 --- a/android/hicn-aar/ForwarderLibrary/aar/common/build.gradle +++ b/android/hicn-aar/ForwarderLibrary/aar/common/build.gradle @@ -81,38 +81,38 @@ def String getProjectProperty(String propertyName) return value } -// publishing { -// repositories { -// maven { -// name = 'GitHubPackages' -// url = uri(project.findProperty('MVN_REPO')) -// credentials { -// username = project.findProperty('A_USER') -// password = project.findProperty('A_PASSWORD') -// } -// } - -// } - -// afterEvaluate { -// publications { -// release(MavenPublication) { -// from components.release - -// groupId = 'com.cisco.hicn' -// version = project.findProperty('VERSION') -// artifactId 'common' -// } -// debug(MavenPublication) { -// from components.debug - -// groupId = 'com.cisco.hicn' -// version = project.findProperty('VERSION') -// artifactId 'common-debug' -// } -// } -// } -// } +publishing { + repositories { + maven { + name = 'GitHubPackages' + url = uri(project.findProperty('MVN_REPO')) + credentials { + username = project.findProperty('A_USER') + password = project.findProperty('A_PASSWORD') + } + } + + } + + afterEvaluate { + publications { + release(MavenPublication) { + from components.release + + groupId = 'com.cisco.hicn' + version = project.findProperty('VERSION_NUMBER') + artifactId 'common' + } + debug(MavenPublication) { + from components.debug + + groupId = 'com.cisco.hicn' + version = project.findProperty('VERSION_NUMBER') + artifactId 'common-debug' + } + } + } +} dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' @@ -120,5 +120,4 @@ dependencies { testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' - } diff --git a/android/hicn-aar/ForwarderLibrary/build.gradle b/android/hicn-aar/ForwarderLibrary/build.gradle index 5dcc744..9240722 100644 --- a/android/hicn-aar/ForwarderLibrary/build.gradle +++ b/android/hicn-aar/ForwarderLibrary/build.gradle @@ -18,8 +18,8 @@ buildscript { MODULE_SRC = '1' A_USER = '' A_PASSWORD = '' - MVN_REPO = 'https://engci-maven-master.cisco.com/artifactory/maqy-maven-release' - VERSION = '1' + MVN_REPO = '' + VERSION_NUMBER = 'v0.0.10' } repositories { google() diff --git a/android/hicn-aar/ForwarderLibrary/gradle.properties b/android/hicn-aar/ForwarderLibrary/gradle.properties index 6dd0218..7873815 100644 --- a/android/hicn-aar/ForwarderLibrary/gradle.properties +++ b/android/hicn-aar/ForwarderLibrary/gradle.properties @@ -16,3 +16,4 @@ android.useAndroidX=true # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + diff --git a/android/hicn-aar/ForwarderLibrary/hicnforwarderLibrary/build.gradle b/android/hicn-aar/ForwarderLibrary/hicnforwarderLibrary/build.gradle index 68a0953..f5c70dc 100644 --- a/android/hicn-aar/ForwarderLibrary/hicnforwarderLibrary/build.gradle +++ b/android/hicn-aar/ForwarderLibrary/hicnforwarderLibrary/build.gradle @@ -42,7 +42,7 @@ android { } } - buildConfigField "String", "VERSION", "\"" + this.properties['VERSION']?.trim() + "\"" + buildConfigField "String", "VERSION", "\"" + this.properties['VERSION_NUMBER']?.trim() + "\"" } buildTypes { @@ -84,10 +84,10 @@ def getVersionCode_() { def getVersion() { - if ("${getProjectProperty('VERSION')}".isEmpty()) + if ("${getProjectProperty('VERSION_NUMBER')}".isEmpty()) return "1.0" else { - return "${getProjectProperty('VERSION')}" + return "${getProjectProperty('VERSION_NUMBER')}" } } @@ -102,54 +102,59 @@ def String getProjectProperty(String propertyName) } publishing { - repositories { - maven { - name = 'Artifactory' - url = uri(project.findProperty('MVN_REPO')) - credentials { - username = project.findProperty('A_USER') - password = project.findProperty('A_PASSWORD') + if (Integer.parseInt(this.properties['MODULE_SRC']) == 0) { + repositories { + maven { + name = 'Artifactory' + url = uri(project.findProperty('MVN_REPO')) + credentials { + username = project.findProperty('A_USER') + password = project.findProperty('A_PASSWORD') + } } - } - - } - afterEvaluate { - publications { - release(MavenPublication) { - from components.release - - groupId = 'com.cisco.hicn' - version = project.findProperty('VERSION') - artifactId 'hicnforwarder' - } - debug(MavenPublication) { - from components.debug + } - groupId = 'com.cisco.hicn' - version = project.findProperty('VERSION') - artifactId 'hicnforwarder-debug' + afterEvaluate { + publications { + release(MavenPublication) { + from components.release + + groupId = 'com.cisco.hicn' + version = project.findProperty('VERSION_NUMBER') + artifactId 'hicnforwarder' + } + debug(MavenPublication) { + from components.debug + + groupId = 'com.cisco.hicn' + version = project.findProperty('VERSION_NUMBER') + artifactId 'hicnforwarder-debug' + } } } } } repositories { - maven { - name = 'Artifactory' - url = uri(this.properties['MVN_REPO']) - credentials { - username = this.properties["A_USER"] - password = this.properties["A_PASSWORD"] + if (Integer.parseInt(this.properties['MODULE_SRC']) == 0) { + maven { + name = 'Artifactory' + url = uri(this.properties['MVN_REPO']) + credentials { + username = this.properties["A_USER"] + password = this.properties["A_PASSWORD"] + } } } } dependencies { if (Integer.parseInt(this.properties['MODULE_SRC']) == 0) { - implementation 'com.cisco.hicn:common:' + common + implementation 'com.cisco.hicn:hicn-common:' + project.findProperty('VERSION_NUMBER') } else { implementation project(":aar:common") + } implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'com.google.android.material:material:1.2.1' diff --git a/android/hicn-aar/ForwarderLibrary/settings.gradle b/android/hicn-aar/ForwarderLibrary/settings.gradle index e5cb39a..e172694 100644 --- a/android/hicn-aar/ForwarderLibrary/settings.gradle +++ b/android/hicn-aar/ForwarderLibrary/settings.gradle @@ -1,2 +1,5 @@ -include ':aar:common' +if(Integer.parseInt(getProperties().get("MODULE_SRC")) == 1) { + include ':aar:common' +} + include ':hicnforwarderLibrary' \ No newline at end of file diff --git a/android/scripts/compile_facemgr_aar.sh b/android/scripts/compile_facemgr_aar.sh index c3f64db..c42590b 100644 --- a/android/scripts/compile_facemgr_aar.sh +++ b/android/scripts/compile_facemgr_aar.sh @@ -35,9 +35,9 @@ else fi if [ "$MVN_REPO" = "" ]; then - gradle $ASSEMBLE -PVERSION=$VERSION_CODE + gradle $ASSEMBLE -PVERSION=$VERSION_CODE -PMODULE_SRC=1 else - gradle $ASSEMBLE -PENABLE_HPROXY=$ENABLE_HPROXY + gradle $ASSEMBLE -PMODULE_SRC=1 fi cd .. diff --git a/android/scripts/compile_hicnforwarder_aar.sh b/android/scripts/compile_hicnforwarder_aar.sh index 918aeff..22308ca 100644 --- a/android/scripts/compile_hicnforwarder_aar.sh +++ b/android/scripts/compile_hicnforwarder_aar.sh @@ -36,9 +36,9 @@ else fi if [ "$MVN_REPO" = "" ]; then - gradle $ASSEMBLE -PVERSION=$VERSION_CODE + gradle $ASSEMBLE -PVERSION=$VERSION_CODE -PMODULE_SRC=1 else - gradle $ASSEMBLE -PENABLE_HPROXY=$ENABLE_HPROXY + gradle $ASSEMBLE -PMODULE_SRC=1 fi diff --git a/android/scripts/publish_common_aar.sh b/android/scripts/publish_common_aar.sh index 22c11be..de435c0 100755 --- a/android/scripts/publish_common_aar.sh +++ b/android/scripts/publish_common_aar.sh @@ -4,32 +4,33 @@ VERSION_CODE=1 GITHUB_USER="" GITHUB_TOKEN="" MVN_REPO="" -while getopts ":v:u:t:r:" opt; do - case $opt in - v) VERSION_CODE="$OPTARG" - ;; - u) GITHUB_USER="$OPTARG" - ;; - t) GITHUB_TOKEN="$OPTARG" - ;; - r) MVN_REPO="$OPTARG" - ;; - \?) echo "Invalid option -$OPTARG" >&2 - ;; - esac -done +# while getopts ":v:u:t:r:" opt; do +# case $opt in +# v) VERSION_CODE="$OPTARG" +# ;; +# u) GITHUB_USER="$OPTARG" +# ;; +# t) GITHUB_TOKEN="$OPTARG" +# ;; +# r) MVN_REPO="$OPTARG" +# ;; +# \?) echo "Invalid option -$OPTARG" >&2 +# ;; +# esac +# done -cd aar_modules/CommonLibrary +cd CommonLibrary if [ ! -f local.properties ]; then echo sdk.dir=${SDK} > local.properties fi -if [ "$MVN_REPO" = "" ]; then - ./gradlew publish -PVERSION=$VERSION_CODE -PGITHUB_USER=$GITHUB_USER -PGITHUB_TOKEN=$GITHUB_TOKEN -else - ./gradlew publish -PVERSION=$VERSION_CODE -PGITHUB_USER=$GITHUB_USER -PGITHUB_TOKEN=$GITHUB_TOKEN -PMVN_REPO=$MVN_REPO +#if [ "$MVN_REPO" = "" ]; then +# ./gradlew publish -PVERSION=$VERSION_CODE -PGITHUB_USER=$GITHUB_USER -PGITHUB_TOKEN=$GITHUB_TOKEN +#else + gradle publish -PVERSION=$VERSION_CODE + #-PGITHUB_USER=$GITHUB_USER -PGITHUB_TOKEN=$GITHUB_TOKEN -PMVN_REPO=$MVN_REPO fi echo "aar published" From 2fde322ffac636b05f0fbc8a1056c31cb068e540 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 27 Oct 2022 06:54:49 +0000 Subject: [PATCH 13/16] =?UTF-8?q?bump:=20version=200.0.2=20=E2=86=92=200.0?= =?UTF-8?q?.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cz.toml | 2 +- CHANGELOG.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.cz.toml b/.cz.toml index d0de0b2..a6a1749 100644 --- a/.cz.toml +++ b/.cz.toml @@ -1,5 +1,5 @@ [tool] [tool.commitizen] name = "cz_conventional_commits" -version = "0.0.2" +version = "0.0.3" tag_format = "v$version" diff --git a/CHANGELOG.md b/CHANGELOG.md index dad25cd..81b77b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.0.3 (2022-10-27) + +### Feat + +- publish android aar to packages (#34) + ## v0.0.2 (2022-10-26) ### Feat From 29860cdeacb9d39c65859f8f5a1695c18f227831 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Thu, 27 Oct 2022 14:11:02 +0200 Subject: [PATCH 14/16] feat: change credentials github registry to push public docker images (#36) Ref: #35 #promote PATCH Signed-off-by: Angelo Mantellini --- .github/workflows/android-dep.yml | 4 ++-- .github/workflows/android-env.yml | 4 ++-- .github/workflows/android-hicn.yml | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/android-dep.yml b/.github/workflows/android-dep.yml index 53c3da0..c3c45eb 100644 --- a/.github/workflows/android-dep.yml +++ b/.github/workflows/android-dep.yml @@ -41,8 +41,8 @@ jobs: uses: elgohr/Publish-Docker-Github-Action@v4 with: name: ${{github.repository}}/android-dep - username: ${{ secrets.HICN_BOT }} - password: ${{ secrets.HICN_ACTIONS_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ github.actor }} registry: ghcr.io dockerfile: android/ci/Dockerfile_dep buildargs: BASE_IMAGE=ghcr.io/${{github.repository}}/android-env:latest diff --git a/.github/workflows/android-env.yml b/.github/workflows/android-env.yml index e4f61ab..8988ce7 100644 --- a/.github/workflows/android-env.yml +++ b/.github/workflows/android-env.yml @@ -40,8 +40,8 @@ jobs: uses: elgohr/Publish-Docker-Github-Action@v4 with: name: ${{github.repository}}/android-env - username: ${{ secrets.HICN_BOT }} - password: ${{ secrets.HICN_ACTIONS_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ github.actor }} registry: ghcr.io dockerfile: android/ci/Dockerfile_env tags: latest,${{ steps.previoustag.outputs.tag }} diff --git a/.github/workflows/android-hicn.yml b/.github/workflows/android-hicn.yml index 55f857d..fe079fc 100644 --- a/.github/workflows/android-hicn.yml +++ b/.github/workflows/android-hicn.yml @@ -29,6 +29,8 @@ jobs: steps: - name: "Build:checkout" uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: 'Get Previous tag' id: previoustag uses: "WyriHaximus/github-action-get-previous-tag@v1" @@ -38,8 +40,8 @@ jobs: uses: elgohr/Publish-Docker-Github-Action@v4 with: name: ${{github.repository}}/android-hicn - password: ${{ secrets.HICN_ACTIONS_TOKEN }} - username: ${{ secrets.HICN_BOT }} + password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ github.actor }} registry: ghcr.io dockerfile: android/ci/Dockerfile_hicn buildargs: BASE_IMAGE=ghcr.io/${{github.repository}}/android-dep:latest From 74d639696153b1a144ec7fc87cb5ee4a2490109a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 27 Oct 2022 12:11:41 +0000 Subject: [PATCH 15/16] =?UTF-8?q?bump:=20version=200.0.3=20=E2=86=92=200.0?= =?UTF-8?q?.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cz.toml | 2 +- CHANGELOG.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.cz.toml b/.cz.toml index a6a1749..2f09d4f 100644 --- a/.cz.toml +++ b/.cz.toml @@ -1,5 +1,5 @@ [tool] [tool.commitizen] name = "cz_conventional_commits" -version = "0.0.3" +version = "0.0.4" tag_format = "v$version" diff --git a/CHANGELOG.md b/CHANGELOG.md index 81b77b7..31ee23a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.0.4 (2022-10-27) + +### Feat + +- change credentials github registry to push public docker images (#36) + ## v0.0.3 (2022-10-27) ### Feat From e2938ba2c223c0abdd9b8ef1ae0bc217c18add79 Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Wed, 1 Feb 2023 19:46:29 +0000 Subject: [PATCH 16/16] fix: doc update Signed-off-by: Luca Muscariello --- docker/tests/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker/tests/README.md b/docker/tests/README.md index 852bc96..417a3ae 100644 --- a/docker/tests/README.md +++ b/docker/tests/README.md @@ -1,8 +1,6 @@ # Functional test description - ## Network topology - Host - H Router - R Linux Bridge - LB