From bd5fc328bf9a939800ffb80cc8abff22f380f04a Mon Sep 17 00:00:00 2001 From: Kam0ss Date: Sat, 30 Apr 2022 02:50:14 -0400 Subject: [PATCH] added action schedule --- .github/pull_request_template.md | 2 +- .../docker-image-perception-develop.yml | 2 + .../docker-image-perception-feature.yml | 2 + .../workflows/docker-image-perception-fix.yml | 105 ++++++++++++++++++ .../docker-image-perception-master.yml | 2 + Dockerfile | 1 - 6 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker-image-perception-fix.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 247a7e8..be1a595 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,7 +5,7 @@ Give a brief description of the modifications ## Fixes Link all the related issues from the issue tracker -- Closes: # +- Closes # ## How has this been tested ? (If possible) describe the steps to test these modifications. diff --git a/.github/workflows/docker-image-perception-develop.yml b/.github/workflows/docker-image-perception-develop.yml index c6c2328..c5f1060 100644 --- a/.github/workflows/docker-image-perception-develop.yml +++ b/.github/workflows/docker-image-perception-develop.yml @@ -3,6 +3,8 @@ name: Docker Image CI - Develop Branch on: push: branches: [develop] + schedule: + - cron: "12 0 * * *" jobs: build-ros-perception-x86-64: diff --git a/.github/workflows/docker-image-perception-feature.yml b/.github/workflows/docker-image-perception-feature.yml index b29c9da..58388f2 100644 --- a/.github/workflows/docker-image-perception-feature.yml +++ b/.github/workflows/docker-image-perception-feature.yml @@ -3,6 +3,8 @@ name: Docker Image CI - Feature Branch on: push: branches: [feature/**] + schedule: + - cron: "12 0 * * *" jobs: build-ros-perception-x86-64: diff --git a/.github/workflows/docker-image-perception-fix.yml b/.github/workflows/docker-image-perception-fix.yml new file mode 100644 index 0000000..7314d91 --- /dev/null +++ b/.github/workflows/docker-image-perception-fix.yml @@ -0,0 +1,105 @@ +name: Docker Image CI - Fix Branch + +on: + push: + branches: [fix/**] + schedule: + - cron: "12 0 * * *" + +jobs: + build-ros-perception-x86-64: + name: "Build ROS perception X86/64" + runs-on: ubuntu-latest + env: + BASE_IMAGE: "docker.pkg.github.com/sonia-auv/sonia_common/sonia_common:x86-perception-latest" + ARCH: x86 + TARGET_TYPE: perception + TARGET_VERSION: fix + IMAGE_NAME: sonia-ros-tcp-endpoint + GITHUB_REMOTE_URL: docker.pkg.github.com/${{ github.repository }} + steps: + - uses: actions/checkout@v2 + - name: Login to Github Package Registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin + - name: Build the docker image (perception based) + run: | + docker build . --tag build-fix-${GITHUB_REF##*/}-${GITHUB_RUN_NUMBER} --build-arg BUILD_DATE=$(date '+%Y-%m-%d_%H:%M:%S') --build-arg VERSION=${GITHUB_REF##*/}-$(date ' +%Y-%m-%d_%H:%M:%S') --build-arg BASE_IMAGE=${BASE_IMAGE} + + - name: Create Docker Image Tag + run: | + docker tag build-fix-${GITHUB_REF##*/}-${GITHUB_RUN_NUMBER} ${GITHUB_REMOTE_URL}/${IMAGE_NAME}:${ARCH}-${TARGET_TYPE}-${TARGET_VERSION}-${GITHUB_REF##*/} + + - name: Push Image to Github Packages Registry + run: | + docker push --all-tags ${GITHUB_REMOTE_URL}/${IMAGE_NAME} + + build-ros-perception-arm64: + name: "Build ROS perception ARM64" + runs-on: ubuntu-latest + env: + BASE_IMAGE: "docker.pkg.github.com/sonia-auv/sonia_common/sonia_common:arm64-perception-latest" + ARCH: arm64 + TARGET_TYPE: perception + TARGET_VERSION: fix + IMAGE_NAME: sonia-ros-tcp-endpoint + GITHUB_REMOTE_URL: docker.pkg.github.com/${{ github.repository }} + steps: + - uses: actions/checkout@v2 + - name: Login to Github Package Registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin + - name: Enable Docker Daemon Experimental Features + run: | + sudo rm /etc/docker/daemon.json + echo '{"experimental": true , "cgroup-parent": "/actions_job" }' | sudo tee -a /etc/docker/daemon.json + sudo service docker restart + docker version + + - name: Install QEMU to be able to compile on X86 into ARM64 + run: | + sudo apt-get update + sudo apt-get install qemu binfmt-support qemu-user-static + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + + - name: Build the docker image (perception based) + run: | + docker build . --tag build-fix-${GITHUB_REF##*/}-${GITHUB_RUN_NUMBER} --build-arg BUILD_DATE=$(date '+%Y-%m-%d_%H:%M:%S') --build-arg VERSION=${GITHUB_REF##*/}-$(date ' +%Y-%m-%d_%H:%M:%S') --build-arg BASE_IMAGE=${BASE_IMAGE} + + - name: Create Docker Image Tag + run: | + docker tag build-fix-${GITHUB_REF##*/}-${GITHUB_RUN_NUMBER} ${GITHUB_REMOTE_URL}/${IMAGE_NAME}:${ARCH}-${TARGET_TYPE}-${TARGET_VERSION}-${GITHUB_REF##*/} + + - name: Push Image to Github Packages Registry + run: | + docker push --all-tags ${GITHUB_REMOTE_URL}/${IMAGE_NAME} + + notify-success: + name: "Notify Slack - Success" + runs-on: ubuntu-latest + needs: [build-ros-perception-x86-64, build-ros-perception-arm64] + if: success() + steps: + - name: Notify Slack Success + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel: github-ci-notifications + status: SUCCESS + color: good + + notify-fail: + name: "Notify Slack - Failure" + runs-on: ubuntu-latest + needs: [build-ros-perception-x86-64, build-ros-perception-arm64] + if: failure() + steps: + - name: Notify Slack Fail + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel: github-ci-notifications + status: FAILED + color: danger diff --git a/.github/workflows/docker-image-perception-master.yml b/.github/workflows/docker-image-perception-master.yml index 91a6cd9..c9f78d6 100644 --- a/.github/workflows/docker-image-perception-master.yml +++ b/.github/workflows/docker-image-perception-master.yml @@ -3,6 +3,8 @@ name: Docker Image CI - Master Branch on: push: branches: [master] + schedule: + - cron: "12 0 * * *" jobs: build-ros-perception-x86-64: diff --git a/Dockerfile b/Dockerfile index eeb8c1d..54673dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,6 @@ ENV SONIA_WS_SETUP=${SONIA_WS}/devel/setup.bash WORKDIR ${SONIA_WS}/src RUN bash -c "git clone https://github.com/Unity-Technologies/ROS-TCP-Endpoint.git" -RUN bash -c "rosparam set ROS_IP 0.0.0.0" WORKDIR ${SONIA_WS}