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

feat: add workflows similar to amp-embedded-infra-lib, restructure components #84

Merged
merged 24 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1ed8245
.github/workflows/ci: Add building natively on Windows and MacOS
richardapeters Sep 28, 2024
32a82a1
.github/workflows/ci: fix casing
richardapeters Sep 28, 2024
4d09369
Use host-single-Debug which specifies no generator for non-Unix nativ…
richardapeters Sep 28, 2024
c4075f7
cucumber-cpp/StepRegistry: Fix compilation for MacOS
richardapeters Sep 28, 2024
8f89c27
Move ccache compiler selection to workflows/ci
richardapeters Sep 28, 2024
69bfc8f
cucumber-cpp/StepRegistry and HookRegistry: Fix compilation for MacOS
richardapeters Sep 28, 2024
e826d3d
cucumber-cpp-example/fixtures/Fixture: Fix compilation for MacOS
richardapeters Sep 28, 2024
da6c02a
Update .github/workflows/ci.yml
richardapeters Sep 28, 2024
573ae65
Add linting
richardapeters Sep 29, 2024
dffa040
Resolve linting issues
richardapeters Sep 29, 2024
6518a0e
Resolve linting issues
richardapeters Sep 29, 2024
6ae5e60
Resolve linting issues
richardapeters Sep 29, 2024
103bf21
Use snake_case instead of kebab-case for directories
richardapeters Sep 29, 2024
7b38e5c
Add .github/workflows/security.yml
richardapeters Sep 29, 2024
bd766cb
Resolve clang-formatting issues
richardapeters Sep 29, 2024
aad2d38
Resolve a few Sonar warnings
richardapeters Sep 29, 2024
3a9cff5
Rework directory structure
richardapeters Sep 29, 2024
e55060c
Fix tests path
richardapeters Sep 29, 2024
7c6e829
Fix tests path
richardapeters Sep 29, 2024
f069e09
feat: removed deprecated MakeShared
daantimmer Sep 30, 2024
64d982c
chore: replace member functions with free functions for better generi…
daantimmer Sep 30, 2024
755969e
chore: update bats location for 'bats' task in tasks.json
daantimmer Sep 30, 2024
aeed6ce
Rename integration_test to acceptance_test
richardapeters Oct 1, 2024
7d6111c
Format devcontainer.json
richardapeters Oct 1, 2024
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
24 changes: 12 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/cpp
{
"build": {
"context": "..",
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"alexkrechik.cucumberautocomplete",
"akiramiyakoda.cppincludeguard",
"github.vscode-github-actions"
]
}
"build": {
"context": "..",
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"alexkrechik.cucumberautocomplete",
"akiramiyakoda.cppincludeguard",
"github.vscode-github-actions"
]
}
}
}
richardapeters marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions .github/linters/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"trailingComma": "none"
}
43 changes: 43 additions & 0 deletions .github/linters/goodcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
rules:
- id: amp.suppressions.sonar
pattern: ///\s*NOSONAR/
glob: "**/*.[c|h]pp"
severity: info
message: |
Try to minimize the use of static-analysis suppressions

- id: amp.suppressions.compiler-warning
pattern:
- /#pragma.*diagnostic ignored.*/
- /#pragma warning(\s*disable.*)/
glob: "**/*.[c|h]pp"
severity: info
message: |
Try to minimize the use of warning suppressions

- id: amp.no-pragma-once
pattern: /#pragma\s*once/
glob: "**/*.hpp"
severity: error
message: |
Do not use #pragma once
fail: |
#pragma once
pass: |
#ifndef NAMESPACE_COMPONENT_HPP
#define NAMESPACE_COMPONENT_HPP

- id: amp.no-global-tracer
pattern: /services::GlobalTracer().Trace().*/
glob: "**/*.[c|h]pp"
severity: error
message: |
Do not use services::GlobalTracer() in production code
Write a tracing decorator class instead

exclude:
- .build
- .install

exclude_binary: true
59 changes: 53 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ jobs:
with:
key: ${{ github.job }}
max-size: 2G
- run: |
cmake --preset=Windows
cmake --build --preset=Windows-Release
- uses: lukka/run-cmake@2ce8982be71b8e9a3c4d5e432135035afd1e76a7 # v10.7
with:
configurePreset: "Windows"
buildPreset: "Windows-Release"
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']"
daantimmer marked this conversation as resolved.
Show resolved Hide resolved

build-linux:
name: Linux Host Build
Expand All @@ -57,6 +59,13 @@ jobs:
configurePreset: "Host"
buildPreset: "Host-Release"
testPreset: "Host-Release"
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']"
daantimmer marked this conversation as resolved.
Show resolved Hide resolved
- name: Upload test logs
if: ${{ failure() }}
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: test-logs
path: build/Host/Testing/Temporary/

build-linux-devcontainer:
name: Linux Host Build in Devcontainer
Expand All @@ -73,6 +82,13 @@ jobs:
configurePreset: "Host"
buildPreset: "Host-Release"
testPreset: "Host-Release"
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']"
daantimmer marked this conversation as resolved.
Show resolved Hide resolved
- name: Upload test logs
if: ${{ failure() }}
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: test-logs
path: build/Host/Testing/Temporary/

test-linux:
name: Linux Host Test
Expand All @@ -89,11 +105,42 @@ jobs:
with:
key: ${{ github.job }}
max-size: 2G
- uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8
with:
configurePreset: "Host"
buildPreset: "Host-Debug"
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']"
daantimmer marked this conversation as resolved.
Show resolved Hide resolved
- run: |
cmake --preset=Host
cmake --build --preset=Host-Debug
bats --formatter junit test/test.bats | tee test-report.xml
bats --formatter junit cucumber_cpp/acceptance_test/test.bats | tee test-report.xml
- uses: EnricoMi/publish-unit-test-result-action@82082dac68ad6a19d980f8ce817e108b9f496c2a # v2.17.1
if: always()
with:
files: test-report.xml

host_build_test:
name: Host Build & Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 # v1.2.13
with:
key: ${{ github.job }}-${{ matrix.os }}
max-size: 2G
variant: sccache
- uses: lukka/run-cmake@2ce8982be71b8e9a3c4d5e432135035afd1e76a7 # v10.7
with:
configurePreset: "host-single-Debug"
buildPreset: "host-single-Debug"
testPreset: "host-single-Debug"
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache']"
- name: Upload test logs
if: ${{ failure() }}
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: test-logs
path: build/host-single-Dbebug/Testing/Temporary/
47 changes: 47 additions & 0 deletions .github/workflows/linting-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Linting & Formatting

on:
pull_request:
types: [opened, synchronize, reopened]
merge_group:

permissions:
contents: read

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
linter:
name: Linting
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
security-events: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
persist-credentials: false
- uses: oxsecurity/megalinter/flavors/c_cpp@bacb5f8674e3730b904ca4d20c8bd477bc51b1a7 # v7.13.0
env:
APPLY_FIXES: all
VALIDATE_ALL_CODEBASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: git diff
- uses: github/codeql-action/upload-sarif@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12
if: ${{ success() || failure() }}
with:
sarif_file: megalinter-reports/megalinter-report.sarif
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
if: ${{ success() || failure() }}
with:
name: linter
path: |
megalinter-reports
- uses: reviewdog/action-suggester@63b8f8cc21dfa052ac44436e65ed31edcffcb6c1 # v1.17.0
with:
tool_name: MegaLinter
36 changes: 36 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Security

on:
workflow_dispatch:
branch_protection_rule:
schedule:
- cron: "33 8 * * 6"
push:
branches: [main]

permissions: read-all

jobs:
analysis:
name: OSSF Scorecards
runs-on: ubuntu-latest
permissions:
security-events: write
id-token: write
actions: read
contents: read
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- name: Analysis
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
with:
results_file: scorecards.sarif
results_format: sarif
repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
publish_results: true
- uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8
with:
sarif_file: scorecards.sarif
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.install
.xwin-cache
.vs/
megalinter-reports/
12 changes: 12 additions & 0 deletions .ls-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ls:
.dir: snake_case
.hpp: PascalCase
.cpp: PascalCase

ignore:
- .devcontainer
- .git
- .github
- .vscode
- extern
- megalinter-reports
29 changes: 29 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ENABLE:
- ACTION
- CPP
- DOCKERFILE
- JSON
- MARKDOWN
- REPOSITORY
- SPELL
- XML
- YAML
DISABLE_LINTERS:
- CPP_CPPLINT
- REPOSITORY_DEVSKIM
- REPOSITORY_GITLEAKS
- REPOSITORY_KICS
- REPOSITORY_SEMGREP
- SPELL_CSPELL
- JSON_V8R
DISABLE_ERRORS_LINTERS:
- MARKDOWN_MARKDOWN_LINK_CHECK
- SPELL_PROSELINT
- SPELL_LYCHEE
CPP_CLANG_FORMAT_FILTER_REGEX_EXCLUDE: (external)
SPELL_PROSELINT_FILE_EXTENSIONS: [".md", ".adoc"]
SARIF_REPORTER: true
PRINT_ALPACA: false
SHOW_SKIPPED_LINTERS: false
REPOSITORY_GOODCHECK_RULES_PATH: .github/linters
JSON_JSONLINT_ARGUMENTS: --mode cjson
3 changes: 3 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# See: https://avd.aquasec.com/misconfig/dockerfile/general/avd-ds-0002/
# We allow root access in our container that we use for development purposes
DS002
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"label": "bats",
"type": "shell",
"command": "bats --formatter junit test/test.bats | tee test-report.xml",
"command": "bats --formatter junit cucumber_cpp/integration_test/test.bats | tee test-report.xml",
"problemMatcher": []
}
]
Expand Down
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@ include(GNUInstallDirs)
include(CTest)
include(GoogleTest)

add_subdirectory(extern)
add_subdirectory(cucumber-cpp)
add_subdirectory(cucumber-cpp-runner)
add_subdirectory(cucumber-cpp-example)
add_subdirectory(test)
add_subdirectory(external)
add_subdirectory(cucumber_cpp)
Loading
Loading