Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge cmake+core+sophus2 #105

Merged
merged 4 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 3 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ jobs:
compiler: gcc
- os: ubuntu-20.04
compiler: clang
- os: macos-11
compiler: clang

fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -39,18 +38,11 @@ jobs:
./install_deps_ubuntu.sh
if: matrix.os == 'ubuntu-20.04'

- name: Install dependencies (Mac)
working-directory: ./infra/scripts
run: |
./install_deps_mac.sh
if: matrix.os == 'macos-11'

- name: Download dependencies (proto)
working-directory: ./infra/
working-directory: ./infra
run: |
ls -l
source ./bootstrap_venv.sh
cd scripts
./install_farm_ng_cmake.sh

- name: Compile (gcc)
working-directory: ./infra/scripts
Expand All @@ -67,11 +59,3 @@ jobs:
source ../venv/bin/activate
./compile_clang.sh
if: matrix.compiler == 'clang'

- name: clang-tidy
working-directory: ./infra/
run: |
source ./bootstrap_venv.sh
cd ..
./run_clang_tidy.sh
if: matrix.os == 'ubuntu-20.04' && matrix.compiler == 'clang'
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release

on:
push:
branches: [release-build-branch]
workflow_dispatch:

concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
# Based on https://dev.to/eugenebabichenko/automated-multi-platform-releases-with-github-actions-1abg
create_release:
name: Create Release and Provide Upload URL.
runs-on: ubuntu-latest # OS to create release, not for build
outputs:
# This job will provide URL for build jobs to use for uploading assets
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Get short SHA
id: get_sha
run: echo "sha7=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_OUTPUT

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v.${{ steps.get_sha.outputs.sha7 }}
release_name: Release v.${{ steps.get_sha.outputs.sha7 }}
draft: false
prerelease: false

build_assets:
name: Build Release Assets
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
fail-fast: false

steps:
- uses: actions/checkout@v3

- uses: hendrikmuhs/ccache-action@v1

- name: Install system dependencies (Ubuntu)
run: ./cmake/scripts/install_deps_ubuntu.sh
if: matrix.os == 'ubuntu-20.04'

- name: Install venv dependencies
run: ./cmake/bootstrap_venv.sh

- name: Create Archive For Release
run: |
tar -czvf venv-${{ matrix.os }}.tar.gz cmake/venv/prefix

- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: venv-${{ matrix.os }}.tar.gz
asset_path: venv-${{ matrix.os }}.tar.gz
asset_content_type: application/x-tar
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "infra/submodules/farm-ng-cmake"]
path = infra/ci-submodules/farm-ng-cmake
url = https://github.com/farm-ng/farm-ng-cmake.git
[submodule "third_party/expected"]
path = cpp/thirdparty/expected
url = https://github.com/TartanLlama/expected.git
Expand Down
21 changes: 17 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,28 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: thirdparty/.*$
exclude: (thirdparty|cpp/sophus2)/.*$
- id: check-yaml
- id: check-json
exclude: docs/.*$

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.13
hooks:
- id: insert-license
files: cpp/sophus2/.*\.(h|hpp|cpp|proto)$
exclude: (py|thirdparty|py/sympy/cpp_gencode)/.*$
args:
- --comment-style
- //
- --license-filepath
- sophus2_license_header.txt
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.13
hooks:
- id: insert-license
files: \.(h|cpp|proto)$
exclude: thirdparty/.*$
exclude: (thirdparty|cpp/sophus2)/.*$
args:
- --comment-style
- //
Expand All @@ -28,7 +40,7 @@ repos:
hooks:
- id: clang-format
files: \.(h|cpp)
exclude: (thirdparty)/.*$
exclude: (cpp/sophus2/py|thirdparty)/.*$
- repo: local
hooks:
- id: pragma-once
Expand Down Expand Up @@ -59,6 +71,7 @@ repos:
rev: v2.1.0
hooks:
- id: codespell
exclude: (thirdparty|cpp/sophus2)/.*$
args:
- --ignore-words-list
- "te"
Expand All @@ -68,4 +81,4 @@ repos:
rev: v0.0.284
hooks:
- id: ruff
args: [--fix]
exclude: (thirdparty|cpp/sophus2)/.*$
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ cmake_minimum_required(VERSION 3.16)
# https://semver.org/
project(farm_ng_core VERSION 0.2.0)

find_package(farm_ng_cmake REQUIRED)
set(farm_ng_cmake_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake)
include(${farm_ng_cmake_DIR}/farm_ng_cmakeConfig.cmake)
farm_ng_module(farm_ng_core)

farm_ng_module()
farm_ng_enable_testing()

set(CMAKE_CXX_CLANG_TIDY "")
Expand All @@ -13,7 +14,3 @@ find_package(fmt REQUIRED)

add_subdirectory(protos)
add_subdirectory(cpp)

farm_ng_export_module(
NAME farm_ng_core
REQUIRED_DEPS fmt)
73 changes: 73 additions & 0 deletions cmake/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Release

on:
push:
branches: [main,release-test]
workflow_dispatch:

concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
# Based on https://dev.to/eugenebabichenko/automated-multi-platform-releases-with-github-actions-1abg
create_release:
name: Create Release and Provide Upload URL.
runs-on: ubuntu-latest # OS to create release, not for build
outputs:
# This job will provide URL for build jobs to use for uploading assets
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Get short SHA
id: get_sha
run: echo "sha7=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_OUTPUT

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v.${{ steps.get_sha.outputs.sha7 }}
release_name: Release v.${{ steps.get_sha.outputs.sha7 }}
draft: false
prerelease: false

build_assets:
name: Build Release Assets
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-11, macos-arm64] # TODO: ubuntu18.04-arm
fail-fast: false

steps:
- uses: actions/checkout@v3

- uses: hendrikmuhs/ccache-action@v1

- name: Install system dependencies (Ubuntu)
run: ./scripts/install_deps_ubuntu.sh
if: matrix.os == 'ubuntu-20.04'

- name: Install system dependencies (Mac)
run: ./scripts/install_deps_mac.sh
if: matrix.os == 'macos-11' || matrix.os == 'macos-arm64'

- name: Install venv dependencies
run: ./bootstrap_venv.sh

- name: Create Archive For Release
run: |
tar -czvf venv-${{ matrix.os }}.tar.gz venv/prefix

- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: venv-${{ matrix.os }}.tar.gz
asset_path: venv-${{ matrix.os }}.tar.gz
asset_content_type: application/x-tar
40 changes: 40 additions & 0 deletions cmake/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
*~

# venv-related
venv.tar.gz
build.venv
venv
venv.tar.gz

# 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
62 changes: 62 additions & 0 deletions cmake/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: local
hooks:
- id: pylint
name: pylint
entry: bash -c 'pylint "$@" || true' --
verbose: true
language: system
exclude: rst-dir
types: [python]
args: ["--good-names-rgxs=^[_a-z][_a-z0-9]?$",
"--max-args=10",
"--min-similarity-lines=30"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: thirdparty/.*$
- id: check-yaml
- id: check-json
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.13
hooks:
- id: insert-license
files: \.(h|cpp|proto)$
exclude: thirdparty/.*$
args:
- --comment-style
- //
- --license-filepath
- license_header.txt
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.0
hooks:
- id: clang-format
files: \.(h|cpp)
exclude: (thirdparty)/.*$
- repo: local
hooks:
- id: pragma-once
name: pragma once check
entry: "#pragma once"
language: pygrep
exclude: thirdparty/.*$
files: \.h$
args: [--negate]
- id: no-c-std-lib
name: c standard library check
exclude: thirdparty/.*$
entry: |
(?x)<(
assert|complex|ctype|errno|fenv|float|inttypes|iso646|limits|locale|math|setjmp|signal|
stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|tgmath|
threads|time|uchar|wchar|wctype
).h>
language: pygrep
files: \.(h|cpp)$