Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: build

on:
workflow_call:
inputs:
coverage:
type: boolean
default: false
scan:
type: boolean
default: false
doc:
type: boolean
default: false

workflow_dispatch:
inputs:
coverage:
type: boolean
default: false
scan:
type: boolean
default: false
doc:
type: boolean
default: false

jobs:
build:
runs-on: ubuntu-latest

container:
image: joinframework/join-ci:latest

permissions:
contents: read
security-events: write

defaults:
run:
shell: bash

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Build Environment
if: ${{ inputs.scan || inputs.coverage }}
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Initialize codeql
if: ${{ inputs.scan }}
uses: github/codeql-action/init@v3

- name: Configure
if: ${{ inputs.scan || inputs.coverage }}
run: cmake -B build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DDCONV_ENABLE_COVERAGE=ON -DDCONV_ENABLE_TESTS=ON

- name: Build
if: ${{ inputs.scan || inputs.coverage }}
run: cmake --build build --config Debug

- name: Run codeql scan
if: ${{ inputs.scan }}
uses: github/codeql-action/analyze@v3

- name: Run tests
if: ${{ inputs.coverage }}
run: ctest --test-dir build --output-on-failure -C Debug

- name: Generate coverage report
if: ${{ inputs.coverage }}
run: |
lcov --directory build --capture --exclude "*/usr/include/*" --exclude '*/tests/*' --output-file lcov.info
genhtml lcov.info --prefix $GITHUB_WORKSPACE --output-directory coverage

- name: Upload coverage data to GitHub
if: ${{ inputs.coverage }}
uses: actions/upload-artifact@v4
with:
name: coverage-data
path: lcov.info

- name: Upload coverage report to GitHub
if: ${{ inputs.coverage }}
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/

- name: Run doxygen
if: ${{ inputs.doc }}
uses: mattnotmitt/doxygen-action@v1
with:
doxyfile-path: ./doxyfile
working-directory: .

- name: Upload documentation to GitHub
if: ${{ inputs.doc }}
uses: actions/upload-pages-artifact@v3
with:
path: ./doc/html

deploy-coverage:
if: ${{ inputs.coverage }}

runs-on: ubuntu-latest

container:
image: joinframework/join-ci:latest

permissions:
contents: read

needs: build

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}

- name: Download coverage data from GitHub
uses: actions/download-artifact@v4
with:
name: coverage-data
path: ./

- name: Deploy coverage report to coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
files: lcov.info

- name: Deploy coverage report to codecov
uses: codecov/codecov-action@v5
with:
token: ${{secrets.CODECOV_TOKEN}}
flags: unittests
files: lcov.info
fail_ci_if_error: true

- name: Deploy coverage report to codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{secrets.CODACY_PROJECT_TOKEN}}
coverage-reports: lcov.info

deploy-pages:
if: ${{ inputs.doc }}

runs-on: ubuntu-latest

container:
image: joinframework/join-ci:latest

permissions:
contents: read
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

needs: build

steps:
- name: Deploy documentation to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
60 changes: 0 additions & 60 deletions .github/workflows/coverage.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/doxygen.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: pages

on:
push:
branches: [ main ]

workflow_dispatch:

jobs:
generate:
uses: ./.github/workflows/build.yml

secrets: inherit

with:
doc: true

permissions:
contents: read
security-events: write
pages: write
id-token: write
47 changes: 13 additions & 34 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,26 @@ name: security
on:
push:
branches: [ main ]

pull_request:
branches: [ main ]

schedule:
- cron: "51 9 * * 5"
- cron: "0 11 * * 0"

workflow_dispatch:

jobs:
scan:
runs-on: ubuntu-22.04
uses: ./.github/workflows/build.yml

secrets: inherit

with:
scan: true

permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout
uses: actions/[email protected]

- name: Perform codacy analysis
uses: codacy/[email protected]
with:
project-token: ${{secrets.CODACY_PROJECT_TOKEN}}
verbose: true
output: results.sarif
format: sarif
gh-code-scanning-compat: true
max-allowed-issues: 2147483647

- name: Upload codacy scan report to github
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif

- name: Initialize codeql
uses: github/codeql-action/init@v2

- name: Configure
run: cmake -B _lgtm_build_dir -G "Unix Makefiles" -DDCONV_ENABLE_TESTS=ON

- name: Build
run: cmake --build _lgtm_build_dir --config Debug

- name: Perform codeql analysis
uses: github/codeql-action/analyze@v2
pages: write
id-token: write
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test

on:
push:
branches: [ main ]

pull_request:
branches: [ main ]

workflow_dispatch:

jobs:
coverage:
uses: ./.github/workflows/build.yml

secrets: inherit

with:
coverage: true

permissions:
contents: read
security-events: write
pages: write
id-token: write
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

Double to string conversion is done using the **Grisu2** algorithm, described by **Florian Loitsch** in its publication [Printing Floating-Point Numbers Quickly and Accurately with Integers](https://florian.loitsch.com/publications).

String to double conversion is done using a fast and simple (but not accurate!) approach and fallback to **strtod** if conversion can't be done the simplified way.
String to double conversion uses the **Eisel-Lemire** algorithm for fast parsing with a fallback to **strtod** for cases requiring higher precision.

The code is far from being perfect so any help to improve speed, accuratie, code quality etc... is welcome.

Expand Down
Loading