Skip to content

Commit

Permalink
Update ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
td43 authored and codebydant committed Aug 1, 2022
1 parent 83f0330 commit 7e63c23
Show file tree
Hide file tree
Showing 7 changed files with 632 additions and 373 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CD (continuous delivery)

on:
push:
tags:
- "*"
env:
IMAGE_NAME: pcdtomesh

jobs:
ci:
uses: ./.github/workflows/lint_and_test.yml
deploy:
runs-on: ubuntu-22.04
needs: [ci]
name: cd / Deploy

steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
submodules: recursive

- name: Download artifact
uses: actions/download-artifact@master
with:
name: build
path: ${{github.workspace}}/install

- name: Install PCL
run: sudo apt-get -o Dpkg::Use-Pty=0 install libpcl-dev

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to registry
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile.release
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/danieltobon43/${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
28 changes: 12 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
name: build
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-20.04
steps:

- name: Install PCL
run: sudo apt-get install libpcl-dev
name: CI (continuous integration)

- name: Configure CMake
run: cmake -B ${{dir}}/build -DCMAKE_BUILD_TYPE=Release
on:
# pull_request:
# branches: [main]
push:
# branches: [main]
paths-ignore: ["**.md"]
branches-ignore: ["master"]
workflow_call:

- name: Build
run: cmake --build ${{dir}}/build --config Release

- name: Test
run: build/pointcloudToMESH
jobs:
ci:
uses: ./.github/workflows/lint_and_test.yml
60 changes: 60 additions & 0 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Lint & Test

on:
workflow_call:

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: ubuntu-22.04
name: Build Check
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
submodules: recursive

- name: Install PCL
run: sudo apt-get -o Dpkg::Use-Pty=0 install libpcl-dev

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=install

- name: Build app
run: cmake --build ${{github.workspace}}/build --config $BUILD_TYPE

- name: Install app
run: cmake --install build

- name: Test app
run: ${{github.workspace}}/build/pointcloudToMESH

- name: Store artifact
uses: actions/upload-artifact@master
with:
name: build
path: ${{github.workspace}}/install

lint:
needs: [build]
name: Formatting Check
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
clang-format-version: "10"
check-path: "."
exclude-regex: "external"

test:
needs: [build]
name: Tests Check
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: echo "🍏 This job's status is ${{ job.status }}."
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Folders
build/
build-vscode/
PCL-Build-Action/
.vscode

# nektos/act secrets
.secrets

run_dev.sh
54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
##############################################################################
# CMAKE CONFIGURATION
##############################################################################
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)

set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
project(pointcloudToMESH VERSION 1.0.0)

message("\n" "=========================================")
message("Project: ${PROJECT_NAME} ")
message("=========================================")

##############################################################################
# PACKAGES
##############################################################################
message("***********************")
message("PCL PACKAGE")
message("***********************")

find_package(PCL 1.8 REQUIRED QUIET)

if(PCL_FOUND)
message(STATUS "PCL status:")
message(STATUS " version: ${PCL_VERSION}")
message(STATUS " directory: ${PCL_DIR}")
else()
message(FATAL_ERROR " ERROR: PCL minimum required version 1.8. Not found")
endif()

##############################################################################
# SOURCE CODE
##############################################################################
set(MAIN_SOURCE "src/main.cpp")

##############################################################################
# EXECUTABLES
##############################################################################
add_executable(${PROJECT_NAME} ${MAIN_SOURCE})

##############################################################################
# TARGET LIBRARIES
##############################################################################
target_link_libraries(${PROJECT_NAME} PRIVATE ${PCL_LIBRARIES})
target_include_directories(${PROJECT_NAME} PRIVATE ${PCL_INCLUDE_DIRS})

message("=========================================")
message("Project: ${PROJECT_NAME} COMPILED WITH CMAKE " ${CMAKE_VERSION})
message("=========================================")

install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
9 changes: 9 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ubuntu:20.04 AS runtime
RUN apt-get -qq -o=Dpkg::Use-Pty=0 update && DEBIAN_FRONTEND=noninteractive apt-get -y -qq -o=Dpkg::Use-Pty=0 install \
libpcl-dev \
&& rm -rf /var/lib/apt/lists/*
COPY install /usr
ENV MESA_LOADER_DRIVER_OVERRIDE i965

# ======== Run binary file ========
ENTRYPOINT ["pointcloudToMESH"]
Loading

0 comments on commit 7e63c23

Please sign in to comment.