Skip to content

fix: CI workflows bug and linting #109

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

Merged
merged 6 commits into from
Jun 15, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 50 additions & 50 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
module.exports = {
parser: '@typescript-eslint/parser',
env: {
browser: true,
es6: true,
parser: '@typescript-eslint/parser',
env: {
browser: true,
es6: true,
},
plugins: [
'react',
'jsx-a11y',
'import',
'prettier',
'react-hooks',
'regexp',
'@typescript-eslint',
],
extends: [
'airbnb',
'plugin:prettier/recommended',
'plugin:jsx-a11y/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
plugins: [
'react',
'jsx-a11y',
'import',
'prettier',
'react-hooks',
'regexp',
'@typescript-eslint',
ecmaVersion: 2021,
sourceType: 'module',
},
rules: {
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
'react/prop-types': 'off',
'react/jsx-filename-extension': [
1,
{ extensions: ['.js', '.jsx', '.ts', '.tsx'] },
],
extends: [
'airbnb',
'plugin:prettier/recommended',
'plugin:jsx-a11y/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2021,
sourceType: 'module',
},
rules: {
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
'react/prop-types': 'off',
'react/jsx-filename-extension': [
1,
{ extensions: ['.js', '.jsx', '.ts', '.tsx'] },
],
'react/jsx-props-no-spreading': 'off',
'react/destructuring-assignment': ['warn'],
'import/no-unresolved': 'off',
'import/extensions': 'off',
'react-hooks/rules-of-hooks': 'warn',
'react-hooks/exhaustive-deps': 'warn',
'regexp/no-unused-capturing-group': 'error',
'regexp/no-useless-backreference': 'error',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.json'],
},
},
'react/jsx-props-no-spreading': 'off',
'react/destructuring-assignment': ['warn'],
'import/no-unresolved': 'off',
'import/extensions': 'off',
'react-hooks/rules-of-hooks': 'warn',
'react-hooks/exhaustive-deps': 'warn',
'regexp/no-unused-capturing-group': 'error',
'regexp/no-useless-backreference': 'error',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.json'],
},
},
},
};
2 changes: 2 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/[email protected]
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/[email protected]
1 change: 1 addition & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Dependency Review
uses: actions/dependency-review-action@v2
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 16.14.0
cache: 'npm'

- name: Cache NPM Dependencies
Expand Down
34 changes: 21 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Lint Check
name: Lint

on:
workflow_dispatch:
push:
pull_request:
branches:
- main
- docusaurus-v**

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -14,18 +15,25 @@ permissions:
contents: read

jobs:
lint-markdown:
name: Lint markdown
lint:
name: Lint
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v3

- name: Lint markdown format
uses: github/super-linter/slim@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: main
FILTER_REGEX_INCLUDE: .*docs/.*md$
VALIDATE_ALL_CODEBASE: false
VALIDATE_MARKDOWN: true
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 16.14.0
cache: npm

- name: Installation
run: npm install

- name: Lint
run: npm run lint:ci

- name: Prettier Code
run: npm run format:diff
12 changes: 6 additions & 6 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"*.{js,jsx,mjs}": ["eslint --fix"],
"*.css": ["stylelint --allow-empty-input --fix"],
"*": [
"prettier --ignore-unknown --write",
"cspell --no-must-find-files --no-progress"
]
"*.{js,jsx,mjs}": ["eslint --fix"],
"*.css": ["stylelint --allow-empty-input --fix"],
"*": [
"prettier --ignore-unknown --write",
"cspell --no-must-find-files --no-progress"
]
}
16 changes: 8 additions & 8 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"bracketSameLine": true,
"printWidth": 80,
"proseWrap": "never",
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 4
"arrowParens": "always",
"bracketSpacing": true,
"bracketSameLine": true,
"printWidth": 80,
"proseWrap": "never",
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2
}
30 changes: 15 additions & 15 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module.exports = {
extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
rules: {
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['global'],
},
],
'selector-class-pattern': null,
'custom-property-empty-line-before': null,
'selector-id-pattern': null,
'declaration-empty-line-before': null,
'comment-empty-line-before': null,
'value-keyword-case': ['lower', { camelCaseSvgKeywords: true }],
},
extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
rules: {
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['global'],
},
],
'selector-class-pattern': null,
'custom-property-empty-line-before': null,
'selector-id-pattern': null,
'declaration-empty-line-before': null,
'comment-empty-line-before': null,
'value-keyword-case': ['lower', { camelCaseSvgKeywords: true }],
},
};
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"cSpell.words": ["bytecode", "CNCF", "Emscripten", "wasmedge"]
"cSpell.words": ["bytecode", "CNCF", "Emscripten", "wasmedge"]
}
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ If you are ready to contribute, please search for open issues labeled "help-want

**Contents**

- <a name="contributing-flow">Contribution Flow</a>
- <a href="#commit-signoff">Developer Certificate of Origin</a>
- WasmEdge Contribution Flow
- <a href="#contributing-docs">WasmEdge Docs</a>
- <a href="https://wasmedge.org/docs/contribute/" target="_blank">WasmEdge Runtime</a>
- <a href="https://github.com/WasmEdge/WasmEdge/blob/master/SECURITY.md" target="_blank">Reporting a vulnerability</a>
- <a name="contributing-flow">Contribution Flow</a>
- <a href="#commit-signoff">Developer Certificate of Origin</a>
- WasmEdge Contribution Flow
- <a href="#contributing-docs">WasmEdge Docs</a>
- <a href="https://wasmedge.org/docs/contribute/" target="_blank">WasmEdge Runtime</a>
- <a href="https://github.com/WasmEdge/WasmEdge/blob/master/SECURITY.md" target="_blank">Reporting a vulnerability</a>

# <a name="contributing-flow">Contribution Flow</a>

Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
12 changes: 6 additions & 6 deletions docs/contribute/plugin/_category_.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"label": "WasmEdge Plugin System",
"position": 3,
"link": {
"type": "generated-index",
"description": "we will learn how to the WasmEdge Plugin System."
}
"label": "WasmEdge Plugin System",
"position": 3,
"link": {
"type": "generated-index",
"description": "we will learn how to the WasmEdge Plugin System."
}
}
12 changes: 6 additions & 6 deletions docs/contribute/source/_category_.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"label": "Build WasmEdge from source",
"position": 2,
"link": {
"type": "generated-index",
"description": "we will learn how to the WasmEdge Plugin System."
}
"label": "Build WasmEdge from source",
"position": 2,
"link": {
"type": "generated-index",
"description": "we will learn how to the WasmEdge Plugin System."
}
}
42 changes: 21 additions & 21 deletions docs/contribute/source/build_from_src.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ Please follow this guide to build and test WasmEdge from the source code.
WasmEdge provides various tools for enabling different runtime environments for optimal performance. You can find that there are several wasmedge related tools:

1. `wasmedge` is the general wasm runtime.
- `wasmedge` executes a `WASM` file in the interpreter mode or a compiled `WASM` file in the ahead-of-time compilation mode.
- To disable building all tools, you can set the CMake option `WASMEDGE_BUILD_TOOLS` to `OFF`.
- `wasmedge` executes a `WASM` file in the interpreter mode or a compiled `WASM` file in the ahead-of-time compilation mode.
- To disable building all tools, you can set the CMake option `WASMEDGE_BUILD_TOOLS` to `OFF`.
2. `wasmedgec` is the ahead-of-time `WASM` compiler.
- `wasmedgec` compiles a general `WASM` file into a compiled `WASM` file.
- To disable building the ahead-of-time compiler only, you can set the CMake option `WASMEDGE_BUILD_AOT_RUNTIME` to `OFF`.
- `wasmedgec` compiles a general `WASM` file into a compiled `WASM` file.
- To disable building the ahead-of-time compiler only, you can set the CMake option `WASMEDGE_BUILD_AOT_RUNTIME` to `OFF`.
3. `libwasmedge.so` is the WasmEdge C API shared library. (`libwasmedge.dylib` on MacOS and `wasmedge.dll` on Windows)
- `libwasmedge.so`, `libwasmedge.dylib`, or `wasmedge.dll` provides the C API for the ahead-of-time compiler and the WASM runtime.
- The APIs related to the ahead-of-time compiler will always fail if the CMake option `WASMEDGE_BUILD_AOT_RUNTIME` is set as `OFF`.
- To disable building just the shared library, you can set the CMake option `WASMEDGE_BUILD_SHARED_LIB` to `OFF`.
- `libwasmedge.so`, `libwasmedge.dylib`, or `wasmedge.dll` provides the C API for the ahead-of-time compiler and the WASM runtime.
- The APIs related to the ahead-of-time compiler will always fail if the CMake option `WASMEDGE_BUILD_AOT_RUNTIME` is set as `OFF`.
- To disable building just the shared library, you can set the CMake option `WASMEDGE_BUILD_SHARED_LIB` to `OFF`.
4. `ssvm-qitc` is for AI applications and supports the ONNC runtime for AI models in the ONNX format.
- If you want to try `ssvm-qitc`, please refer to [ONNC-Wasm](https://github.com/ONNC/onnc-wasm) project to set up the working environment and tryout several examples.
- And here is our [tutorial for ONNC-Wasm project(YouTube Video)](https://www.youtube.com/watch?v=cbiPuHMS-iQ).
- If you want to try `ssvm-qitc`, please refer to [ONNC-Wasm](https://github.com/ONNC/onnc-wasm) project to set up the working environment and tryout several examples.
- And here is our [tutorial for ONNC-Wasm project(YouTube Video)](https://www.youtube.com/watch?v=cbiPuHMS-iQ).

## CMake Building Options

Expand All @@ -43,24 +43,24 @@ Developers can set the CMake options to customize the WasmEdge building.
1. `WASMEDGE_BUILD_TESTS`: build the WasmEdge tests. Default is `OFF`.
2. `WASMEDGE_BUILD_AOT_RUNTIME`: build with the Ahead-of-Time compiler supporting. Default is `ON`.
3. `WASMEDGE_BUILD_SHARED_LIB`: build the WasmEdge shared library (`libwasmedge.so`, `libwasmedge.dylib`, or `wasmedge.dll`). Default is `ON`.
- By default, the WasmEdge shared library will link to the LLVM shared library.
- By default, the WasmEdge shared library will link to the LLVM shared library.
4. `WASMEDGE_BUILD_STATIC_LIB`: build the WasmEdge static library (`libwasmedge.a`, Linux and MacOS platforms, experimental). Default is `OFF`.
- If this option is set as `ON`, the option `WASMEDGE_FORCE_DISABLE_LTO` will forcefully be set as `ON`.
- If this option is set as `ON`, the `libz` and `libtinfo` on Linux platforms will be statically linked.
- For linking with `libwasmedge.a`, developers should also add the `-ldl`, `-pthread`, `-lm`, and `-lstdc++` linker options on both Linux and MacOS platforms, and `-lrt` on Linux platforms.
- If this option is set as `ON`, the option `WASMEDGE_FORCE_DISABLE_LTO` will forcefully be set as `ON`.
- If this option is set as `ON`, the `libz` and `libtinfo` on Linux platforms will be statically linked.
- For linking with `libwasmedge.a`, developers should also add the `-ldl`, `-pthread`, `-lm`, and `-lstdc++` linker options on both Linux and MacOS platforms, and `-lrt` on Linux platforms.
5. `WASMEDGE_BUILD_TOOLS`: build the `wasmedge` and `wasmedgec` tools. Default is `ON`.
- The `wasmedge` and `wasmedgec` tools will link to the WasmEdge shared library by default.
- If this option is set as `ON` and `WASMEDGE_BUILD_AOT_RUNTIME` is set as `OFF`, the `wasmedgec` tool for the AOT compiler will not be built.
- If this option is set as `ON` but the option `WASMEDGE_LINK_TOOLS_STATIC` is set as `OFF`, the option `WASMEDGE_BUILD_SHARED_LIB` will forcefully be set as `ON`.
- If this option and the option `WASMEDGE_LINK_TOOLS_STATIC` are both set as `ON`, the `WASMEDGE_LINK_LLVM_STATIC` and `WASMEDGE_BUILD_STATIC_LIB` will both be set as `ON`, and the `wasmedge` and `wasmedgec` tools will link to the WasmEdge static library instead. In this case, the plugins will not work in tools.
- The `wasmedge` and `wasmedgec` tools will link to the WasmEdge shared library by default.
- If this option is set as `ON` and `WASMEDGE_BUILD_AOT_RUNTIME` is set as `OFF`, the `wasmedgec` tool for the AOT compiler will not be built.
- If this option is set as `ON` but the option `WASMEDGE_LINK_TOOLS_STATIC` is set as `OFF`, the option `WASMEDGE_BUILD_SHARED_LIB` will forcefully be set as `ON`.
- If this option and the option `WASMEDGE_LINK_TOOLS_STATIC` are both set as `ON`, the `WASMEDGE_LINK_LLVM_STATIC` and `WASMEDGE_BUILD_STATIC_LIB` will both be set as `ON`, and the `wasmedge` and `wasmedgec` tools will link to the WasmEdge static library instead. In this case, the plugins will not work in tools.
6. `WASMEDGE_BUILD_PLUGINS`: build the WasmEdge plugins. Default is `ON`.
7. `WASMEDGE_BUILD_EXAMPLE`: build the WasmEdge examples. Default is `OFF`.
8. `WASMEDGE_PLUGIN_WASI_NN_BACKEND`: build the WasmEdge WASI-NN plugin (Linux platforms only). Default is empty.
- This option is useless if the option `WASMEDGE_BUILD_PLUGINS` is set as `OFF`.
- To build the WASI-NN plugin with backend, please use `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=<backend_name>`.
- To build the WASI-NN plugin with multiple backends, please use `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=<backend_name1>,<backend_name2>`.
- This option is useless if the option `WASMEDGE_BUILD_PLUGINS` is set as `OFF`.
- To build the WASI-NN plugin with backend, please use `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=<backend_name>`.
- To build the WASI-NN plugin with multiple backends, please use `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=<backend_name1>,<backend_name2>`.
9. `WASMEDGE_PLUGIN_WASI_CRYPTO`: build the WasmEdge WASI-Crypto plugin (Linux platforms only). Default is `OFF`.
- This option is useless if the option `WASMEDGE_BUILD_PLUGINS` is set as `OFF`.
- This option is useless if the option `WASMEDGE_BUILD_PLUGINS` is set as `OFF`.
10. `WASMEDGE_FORCE_DISABLE_LTO`: forcefully turn off the link time optimization. Default is `OFF`.
11. `WASMEDGE_LINK_LLVM_STATIC`: link the LLVM and lld libraries statically (Linux and MacOS platforms only, experimental). Default is `OFF`.
12. `WASMEDGE_LINK_TOOLS_STATIC`: make the `wasmedge` and `wasmedgec` tools to link the WasmEdge library and LLVM libraries statically (Linux and MacOS platforms only, experimental). Default is `OFF`.
Expand Down
12 changes: 6 additions & 6 deletions docs/contribute/source/os/_category_.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"label": "Build WasmEdge",
"position": 3,
"link": {
"type": "generated-index",
"description": "we will learn how to build WasmEdge from source on different OSes."
}
"label": "Build WasmEdge",
"position": 3,
"link": {
"type": "generated-index",
"description": "we will learn how to build WasmEdge from source on different OSes."
}
}
Loading