Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
godronus committed Aug 27, 2024
0 parents commit 00a58bf
Show file tree
Hide file tree
Showing 173 changed files with 50,840 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-env"],
"plugins": ["babel-plugin-transform-import-meta"]
}
149 changes: 149 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
...

3 changes: 3 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: './config/eslint/repo/.eslintrc.cjs',
};
73 changes: 73 additions & 0 deletions .github/workflows/build-libs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build /libs directory

on:
workflow_call:
secrets:
VAULT_TOKEN:
required: true

jobs:
build_fastedge_libs:
runs-on: [self-hosted, ubuntu-22-04, regular]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up repo submodules
run: git submodule update --init --recursive

- name: Setup Node.js latest
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install dependencies
run: |
npm ci
- name: Import Secrets
uses: hashicorp/vault-action@v3
id: secrets
with:
url: https://puppet-vault.gc.onl
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
secret/project_fastedge/harbor-robot-account password | HARBOR_PASSWORD ;
secret/project_fastedge/harbor-robot-account username | HARBOR_LOGIN ;
- name: Login to Harbor
uses: docker/login-action@v3
with:
registry: harbor.p.gc.onl
username: ${{ steps.secrets.outputs.HARBOR_LOGIN }}
password: ${{ steps.secrets.outputs.HARBOR_PASSWORD }}

- name: display contents of lib folder
run: ls -la lib

- name: Ensure build folders are empty # Should already be empty
run: |
rm -rf lib/*
rm -rf bin/*
- name: Build docker images
run: docker build -t clang-monkey .

- name: Build FastEdge runtime libs
run: docker run -v $(pwd)/lib:/usr/src/app/lib clang-monkey

- name: Build Javascript libs
run: npm run build:js

- name: Run Integration Tests
run: npm run test:integration

- name: Upload libs Artifact
uses: actions/upload-artifact@v4
with:
name: libs-artifact
retention-days: 1
path: |
bin/
lib/
types/
28 changes: 28 additions & 0 deletions .github/workflows/code-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Code Validation

on:
workflow_call:

jobs:
code_validation:
runs-on: [self-hosted, ubuntu-22-04, regular]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js latest
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install dependencies
run: |
npm ci
- name: ESlint
run: |
npm run lint
- name: File naming convention
run: |
./scripts/filename-validation.sh
57 changes: 57 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy to NPM

on:
push:
# If you add a branch here, you **MUST** create a branch rule in Github settings
branches: ['*.*.x', '*.x', 'main', 'next', 'next-major', 'beta', 'alpha']
paths:
- 'src/**'
- 'runtime/**'

workflow_dispatch: # trigger manually
inputs:
dry_run:
description: 'NPM release dry-run'
required: true
default: 'true'

jobs:
# Gihub Actions do not allow regex validation for numbers in *.*.x branch names
validate_branch_name:
runs-on: [self-hosted, ubuntu-22-04, regular]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Validate branch name
run: |
branch_name=$(echo $GITHUB_REF | cut -d'/' -f3)
if [[ $branch_name =~ ^[0-9]+(\.[0-9]+)?\.x$ ]] || [[ $branch_name == "main" ]] || [[ $branch_name == "next" ]] || [[ $branch_name == "next-major" ]] || [[ $branch_name == "beta" ]] || [[ $branch_name == "alpha" ]]; then
echo "Branch name is valid"
else
echo "Branch name is invalid"
exit 1
fi
code_validation:
needs: [validate_branch_name]
uses: ./.github/workflows/code-validation.yaml

unit_tests:
needs: [validate_branch_name]
uses: ./.github/workflows/unit-tests.yaml

build_fastedge_artifacts:
needs: [code_validation, unit_tests]
uses: ./.github/workflows/build-libs.yaml
secrets:
VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }}

npm_release:
needs: [build_fastedge_artifacts]
uses: ./.github/workflows/release.yaml
with:
dry_run: ${{ github.event.inputs.dry_run || 'true' }}
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
71 changes: 71 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Deploy Docs to Github Pages

on:
push:
branches: ['main']
paths:
- 'docs/**'

workflow_dispatch: # trigger manually

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

concurrency:
group: 'pages'
cancel-in-progress: false

env:
BUILD_PATH: './docs'

jobs:
build:
name: Build Static Docs
runs-on: [self-hosted, ubuntu-22-04, regular]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5

- name: Install dependencies
run: npm ci
working-directory: ${{ env.BUILD_PATH }}

- name: Vars
run: |
echo "astro origin=${{ steps.pages.outputs.origin }}"
echo "astro base_path=${{ steps.pages.outputs.base_path }}"
- name: Build with Astro
run: |
npm run build -- \
--site "${{ steps.pages.outputs.origin }}" \
--base "${{ steps.pages.outputs.base_path }}"
working-directory: ${{ env.BUILD_PATH }}

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.BUILD_PATH }}/dist

deploy:
name: Deploy Static Docs
needs: build
runs-on: [self-hosted, ubuntu-22-04, regular]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Loading

0 comments on commit 00a58bf

Please sign in to comment.