Skip to content

reorganize repo folders #74

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 3 commits into from
Nov 23, 2024
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
File renamed without changes.
6 changes: 3 additions & 3 deletions .github/workflows/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ def main():
Updater.new_version,
"--no-git-tag-version",
],
cwd="node-binding",
cwd="bindings/node",
check=True,
)
subprocess.run(["napi", "version"], cwd="node-binding", check=True)
print("Updated version in node-binding/**package.json")
subprocess.run(["napi", "version"], cwd="bindings/node", check=True)
print("Updated version in bindings/node/**package.json")

subprocess.run(
[
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/node-js-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- cpp-linter/Cargo.toml
- Cargo.toml
- Cargo.lock
- node-binding/**
- bindings/node/**
- package.json
- yarn.lock
- .github/workflows/node-js-packaging.yml
Expand All @@ -27,7 +27,7 @@ on:
- cpp-linter/Cargo.toml
- Cargo.toml
- Cargo.lock
- node-binding/**
- bindings/node/**
- package.json
- yarn.lock
- .github/workflows/node-js-packaging.yml
Expand Down Expand Up @@ -83,12 +83,12 @@ jobs:
if: ${{ matrix.settings.setup }}
shell: bash
- name: Setup node x86
working-directory: node-binding
working-directory: bindings/node
if: matrix.settings.target == 'i686-pc-windows-msvc'
run: yarn config set supportedArchitectures.cpu "ia32"
shell: bash
- name: Install dependencies
working-directory: node-binding
working-directory: bindings/node
run: yarn install
- name: Setup node x86
uses: actions/setup-node@v4
Expand All @@ -113,13 +113,13 @@ jobs:
- name: Build
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker }}
working-directory: node-binding
working-directory: bindings/node
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: node-binding/${{ env.APP_NAME }}.*.node
path: bindings/node/${{ env.APP_NAME }}.*.node
if-no-files-found: error
test-macOS-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
Expand Down Expand Up @@ -151,10 +151,10 @@ jobs:
uses: actions/download-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: node-binding
path: bindings/node
- name: List packages
run: ls -R .
working-directory: node-binding
working-directory: bindings/node
shell: bash
- name: Test bindings
run: yarn test
Expand Down Expand Up @@ -182,10 +182,10 @@ jobs:
uses: actions/download-artifact@v4
with:
name: bindings-x86_64-unknown-linux-gnu
path: node-binding
path: bindings/node
- name: List packages
run: ls -R .
working-directory: node-binding
working-directory: bindings/node
shell: bash
- name: Test bindings
run: >-
Expand Down Expand Up @@ -213,16 +213,16 @@ jobs:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: node-binding/artifacts
path: bindings/node/artifacts
- name: Move artifacts
working-directory: node-binding
working-directory: bindings/node
run: yarn artifacts
- name: List packages
run: ls -R ./npm
working-directory: node-binding
working-directory: bindings/node
shell: bash
- name: Publish
working-directory: node-binding
working-directory: bindings/node
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public --provenance true ${{ contains(github.ref_name, '-rc') && '--tag next' || '' }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/pre-commit-hooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@ jobs:
node-version: 20
cache: yarn
- run: yarn install
- run: yarn run eslint
working-directory: node-binding
- run: yarn lint
14 changes: 8 additions & 6 deletions .github/workflows/python-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ on:
branches: [main]
paths:
- cpp-linter/**.{rs,toml}
- py-binding/**
- bindings/python/**
- Cargo.{toml,lock}
- .github/workflows/python-packaging.yml
- pyproject.toml
tags:
- '*'
pull_request:
branches: [main]
paths:
- cpp-linter/**.{rs,toml}
- py-binding/**
- bindings/python/**
- Cargo.{toml,lock}
- .github/workflows/python-packaging.yml
- pyproject.toml

permissions:
contents: read
Expand Down Expand Up @@ -75,7 +77,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path py-binding/Cargo.toml ${{ steps.is-openssl-vendored.outputs.enabled }}
args: --release --out dist --find-interpreter ${{ steps.is-openssl-vendored.outputs.enabled }}
# sccache: 'true'
manylinux: auto
before-script-linux: |
Expand Down Expand Up @@ -116,7 +118,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path py-binding/Cargo.toml
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
Expand All @@ -143,7 +145,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path py-binding/Cargo.toml --features openssl-vendored
args: --release --out dist --find-interpreter --features openssl-vendored
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
Expand All @@ -162,7 +164,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --manifest-path py-binding/Cargo.toml --out dist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/run-dev-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:

- name: Install clang v7
if: runner.os == 'Linux'
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '7'

Expand All @@ -92,7 +92,7 @@ jobs:

- name: Install clang v8
if: runner.os == 'Linux'
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '8'

Expand All @@ -113,7 +113,7 @@ jobs:
run: just test ci

- name: Install clang v10
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '10'

Expand All @@ -123,7 +123,7 @@ jobs:
run: just test ci

- name: Install clang 11
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '11'

Expand All @@ -133,7 +133,7 @@ jobs:
run: just test ci

- name: Install clang 12
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '12'

Expand All @@ -143,7 +143,7 @@ jobs:
run: just test ci

- name: Install clang 13
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '13'

Expand All @@ -153,7 +153,7 @@ jobs:
run: just test ci

- name: Install clang 14
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '14'

Expand All @@ -163,7 +163,7 @@ jobs:
run: just test ci

- name: Install clang 15
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '15'

Expand All @@ -173,7 +173,7 @@ jobs:
run: just test ci

- name: Install clang 16
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '16'

Expand All @@ -183,7 +183,7 @@ jobs:
run: just test ci

- name: Install clang 17
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '17'

Expand All @@ -193,7 +193,7 @@ jobs:
run: just test ci

- name: Install clang 18
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
uses: ./.github/install-clang-action
with:
version: '18'

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: trailing-whitespace
exclude: cpp-linter/tests/.*\.(?:patch|diff)
- id: end-of-file-fixer
exclude: node-binding/.*package\.json
exclude: bindings/node/.*package\.json
- id: check-docstring-first
- id: check-added-large-files
args: [--maxkb=9000]
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace]
members = ["cpp-linter", "py-binding", "node-binding", "docs"]
members = ["cpp-linter", "bindings/python", "bindings/node", "docs"]
resolver = "2"

[workspace.package]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion node-binding/Cargo.toml → bindings/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ crate-type = ["cdylib"]
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "2.16.13", default-features = false, features = ["napi4", "async"] }
napi-derive = "2.12.2"
cpp-linter = { path = "../cpp-linter" }
cpp-linter = { path = "../../cpp-linter" }
anyhow = "1.0.93"

[features]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion py-binding/Cargo.toml → bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.23.1", features = ["extension-module"] }
cpp-linter = { path = "../cpp-linter" }
cpp-linter = { path = "../../cpp-linter" }
tokio = "1.41.1"

[features]
Expand Down
6 changes: 3 additions & 3 deletions py-binding/README.md → bindings/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ For the description of supported Command Line Interface options, see

## Development

Build the binding with [maturin]:
Build the binding with [maturin] (from repository root folder):

```text
maturin dev --manifest-path py-binding/Cargo.toml
maturin dev
```

Then invoke the executable script as a normal CLI app:
Expand All @@ -49,7 +49,7 @@ cpp-linter -help
| `cpp_linter` | The pure python sources that wrap the rust binding. Typing information is located here. |
| `src` | The location for all rust sources related to binding the cpp-linter library. |
| `Cargo.toml` | Metadata about the binding's rust package (which _is not_ intended to be published to crates.io). |
| `pyproject.toml` | Metadata about the python package. |
| `../../pyproject.toml` | Metadata about the python package (located in repo root). |
| `requirements-dev.txt` | The dependencies used in development (not needed for runtime/production). |

Hidden files and folders are not described in the table above.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions cpp-linter/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ fn probe_ssl_certs() {
/// This is the backend entry point for console applications.
///
/// The idea here is that all functionality is implemented in Rust. However, passing
/// command line arguments is done differently in Python or Rust.
/// command line arguments is done differently in Python, node.js, or Rust.
///
/// - In python, the ``sys.argv`` list is passed from the ``cpp_linter.entry_point.main()``
/// function to rust via the ``cpp_linter.run.main()`` binding (which wraps [`run_main()`]).
/// - In python, the `sys.argv` list is passed from the `cpp_linter.main()`
/// function to rust via the `cpp_linter.main()` binding (which wraps [`run_main()`]).
/// - In node.js, the `process.argv` array is passed from `cli.js` module to
/// rust via `index.node` module's `main()` (which wraps([`run_main()`])).
/// - In rust, the [`std::env::args`] is passed to [`run_main()`] in the binary
/// source `main.rs`.
///
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/node.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Node.js Binding

{%
include "../../node-binding/README.md"
include "../../bindings/node/README.md"
start="<!-- start -->"
%}
2 changes: 1 addition & 1 deletion docs/docs/python.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Python Binding

{%
include "../../py-binding/README.md"
include "../../bindings/python/README.md"
start="<!-- start -->"
%}
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"name": "@cpp-linter/cpp-linter-rs",
"version": "0.0.0",
"description": "Node.js bindings for the cpp-linter rust source.",
"main": "node-bindings/index.node",
"main": "bindings/node/index.node",
"directories": {
"doc": "docs"
},
"scripts": {
"build": "cd node-binding && napi build --platform --release",
"build:debug": "cd node-binding && napi build --platform",
"test": "cd node-binding && ava"
"build": "cd bindings/node && napi build --platform --release",
"build:debug": "cd bindings/node && napi build --platform",
"test": "cd bindings/node && ava",
"lint": "cd bindings/node && yarn run eslint"
},
"repository": {
"type": "git",
Expand All @@ -23,7 +24,7 @@
"homepage": "https://github.com/cpp-linter/cpp-linter-rs#readme",
"private": true,
"workspaces": [
"node-binding"
"bindings/node"
],
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
Loading
Loading