Skip to content

Commit

Permalink
added workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
xanthospap committed Oct 12, 2023
1 parent a28ad4c commit 4792141
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 57 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: clang-format Check
on:
push:
branches: [ "main", "cleanup" ]
pull_request:
branches: [ "main" ]

jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
strategy:
matrix:
path:
- 'src'
- 'test'
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
clang-format-version: '16'
check-path: ${{ matrix.path }}
fallback-style: 'LLVM' # optional
42 changes: 42 additions & 0 deletions .github/workflows/cpp-linux-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Linux CI build

on:
push:
branches: [ "main", "cleanup" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: install scons
run: sudo apt-get install -y scons

- name: install (latest) eigen
run: sudo apt install libeigen3-dev

- name: build (production), gcc
run: scons

- name: build (production, c++20), gcc
run: scons --std=20

- name: build (debug), gcc
run: scons debug=1

- name: build (debug & tests), gcc
run: scons debug=1 test=1

- name: build (production), clang
run: scons --cxx=clang++

- name: build (debug & tests), clang
run: scons debug=1 test=1 --cxx=clang++

- name: build (production, C++20), clang
run: scons --cxx=clang++ --std=20
82 changes: 27 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# C++ Datetime library

[![Build Status](https://app.travis-ci.com/xanthospap/ggdatetime.svg?branch=master)](https://app.travis-ci.com/xanthospap/ggdatetime)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/xanthospap/ggdatetime.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/xanthospap/ggdatetime/alerts/)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/xanthospap/ggdatetime.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/xanthospap/ggdatetime/context:cpp)


## Introduction

ggdatetime is a C++ library to assist date and time - related computations in
ggdatetime is a C++ library to assist date and time related computations in
Geodesy related fields.

## Compilation / Installation
Expand All @@ -17,70 +12,47 @@ Source code is ISO C++17. Compilation should be trivial using any C++ compiler
standard (option `-std=c++17` in gcc and clang).

**October 2021** Source code can also be compiled using the latest
[C++ 20 standard](https://en.cppreference.com/w/cpp/20). To compile against
C++20, set the corresponding flags in the `Makefile.am` files.
[C++ 20 standard](https://en.cppreference.com/w/cpp/20).

> Since December 2021, the build system has been changed from
> [GNU Autotools](https://www.gnu.org/software/automake/manual/html_node/Autotools-Introduction.html)
> to [scons](https://scons.org/).
**April 2022** Building with Autotools is now deprecated and not supported.

For the following, `ROOTDIR` will be the root directory of this repository,
aka the directory under which `/src`, `/test` and `/doc` folders live.

### Compile and install

To compile and install, using [scons](https://scons.org/), just type:
```
# compile
scons
# install (system-wide)
sudo scons install
```

## Verify & Test

After a succesefull installation, users should have:

1. all library header files in `/usr/local/include/datetime/`
2. the library (both a static and shared) in `/usr/local/lib/`

~~To run a validity check, just run: `make check` at the root directory. Hopefully,
you 'll see all checks passing!~~
## Examples

**__The following step is optional__**
A validation test script (kind of unit-testing) can be run to check that the library
works as expected. You do not need to have the library installed on your system to
perform the check (aka the step `sudo make install` is not needed) you only need to
have it compiled (aka `make` should be successeful). If you built the library in
a seperate folder you may need to edit the script, because it assumes that the
(newly compiled) library is located in `ROOTDIR/src/.libs` witch is the default case.
The validation script can be found is [make_unit_tests.sh](https://github.com/xanthospap/ggdatetime/blob/master/var/make_unit_tests.sh)
and to run it (assuming you are in `ROOTDIR`):
`cd var && bash make_unit_tests.sh`. The script will use a number of source files
located in the [ROOT/var](https://github.com/xanthospap/ggdatetime/blob/master/var/) folder
to check the compile-ibility of the sources and the reported results. At the end
of the report, you should see the meesage: `Everything appears to have worked as expected!`
Consult the test programs source code in the
[test folder](https://github.com/xanthospap/libsinex/tree/main/test)
for examples on how to use the library.

Link, include and have fun!
## Developers

## The Library
Take a look at the [LLVM Coding Standards](https://llvm.org/docs/CodingStandards.html)
and if possible stick to it.

### Namespaces
Use [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
to format you code before commiting; if you try to commit with non-acceptable
code format, the CI system will fail.

The whole of the library is wrapped around the `dso` namespace
### Testing

### Linking

- static
- dynamic

## Documentation & Library API (TODO)

- build dox with doxygen (or link to dox)

## TODO

## Bugs & Maintanance
Xanthos, [email protected]
Mitsos, [email protected]

## FAQ
Test source code is found in [test folder](test).
To automatically run all tests, use the Python script
[run_test_suite.py](run_test_suite.py).
Note that to be able to run the scipt, you will have to compile using the
`test=1` option, i.e.
```
## build project and tests
scons test=1
## run tests
./run_test_suite.py --progs-dir=test
```
4 changes: 2 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ lib_src_files = glob.glob(r"src/*.cpp")
hdr_src_files = glob.glob(r"src/*.hpp")

## Environments ...
denv = Environment(CXXFLAGS='-std=c++17 -g -pg -Wall -Wextra -Werror -pedantic -W -Wshadow -Winline -Wdisabled-optimization -DDEBUG')
penv = Environment(CXXFLAGS='-std=c++17 -Wall -Wextra -Werror -pedantic -W -Wshadow -Winline -O2 -march=native')
denv = Environment(CXXFLAGS='-g -pg -Wall -Wextra -Werror -pedantic -W -Wshadow -Winline -Wdisabled-optimization -DDEBUG')
penv = Environment(CXXFLAGS='-Wall -Wextra -Werror -pedantic -W -Wshadow -Winline -O2 -march=native')

## Command line arguments ...
debug = ARGUMENTS.get('debug', 0)
Expand Down
3 changes: 3 additions & 0 deletions src/dtconcepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#define __DSO_DATETIME_CONCEPTS20_HPP__

#if __cplusplus >= 202002L /* concepts only available in C++20 */

#include <type_traits>

namespace dso {
namespace gconcepts {

Expand Down

0 comments on commit 4792141

Please sign in to comment.