Skip to content

Commit 78dc052

Browse files
authored
Merge pull request #51 from Kodo-Robotics/github-workflow
Add Github Workflow
2 parents f028c9f + 9cbe6b0 commit 78dc052

215 files changed

Lines changed: 6708 additions & 2699 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Tests & Linting
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint-js:
11+
name: 🧼 ESLint (JS/TS)
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
22+
- name: Install Node.js dependencies
23+
run: npm install
24+
25+
- name: Run ESLint
26+
run: npm run lint:js
27+
28+
lint-py:
29+
name: 🐍 Ruff (Python)
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
- name: Setup Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: '3.11'
39+
40+
- name: Install Python Dependencies
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install ruff
44+
45+
- name: Ruff check
46+
run: npm run lint:py
47+
48+
parser-tests:
49+
name: 🧪 Parser Tests
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
55+
- name: Setup Python
56+
uses: actions/setup-python@v5
57+
with:
58+
python-version: '3.11'
59+
60+
- name: Install Python Dependencies
61+
run: |
62+
python -m pip install --upgrade pip
63+
pip install -r parser/requirements.txt
64+
pip install pytest ruff
65+
66+
- name: Run parser tests
67+
run: npm run test:parser
68+
69+
webview-tests:
70+
name: 🎨 Webview Visual Tests
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v4
75+
76+
- name: Setup Node.js
77+
uses: actions/setup-node@v4
78+
with:
79+
node-version: 20
80+
81+
- name: Install Node.js dependencies
82+
run: npm install
83+
84+
- name: Install Playwright browsers
85+
run: npx playwright install --with-deps
86+
87+
- name: Run webview tests (headless)
88+
run: xvfb-run -a npm run test:webview
89+
90+
extension-tests:
91+
name: 🧩 Extension Tests (VS Code)
92+
runs-on: ubuntu-latest
93+
steps:
94+
- name: Checkout repository
95+
uses: actions/checkout@v4
96+
97+
- name: Setup Node.js
98+
uses: actions/setup-node@v4
99+
with:
100+
node-version: 20
101+
102+
- name: Install Node.js dependencies
103+
run: npm install
104+
105+
- name: Setup Python
106+
uses: actions/setup-python@v5
107+
with:
108+
python-version: '3.11'
109+
110+
- name: Install Python Dependencies
111+
run: |
112+
python -m pip install --upgrade pip
113+
pip install -r parser/requirements.txt
114+
115+
- name: Run extension tests
116+
run: xvfb-run -a npm run test:src

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Thumbs.db
44
**/node_modules/
55
**/out/
66
*/.vs/
7+
**/.venv/
78
**/.vscode-test/
89
tsconfig.lsif.json
910
*.lsif

CHANGELOG

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
77

88
---
99

10+
## [0.1.8] - 2025-08-08
11+
12+
### Added
13+
- `npm run` scripts for testing & linting
14+
- `ruff` and `eslint` for linting
15+
- GitHub Actions for testing & linting
16+
- Detailed `CONTRIBUTING.md`
17+
1018
## [0.1.7] - 2025-08-04
1119

1220
### Added

CONTRIBUTING.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# 🤝 Contributing to LaunchMap
2+
3+
Thank you for your interest in contributing to LaunchMap!
4+
Contributions of all kinds, features, bug fixes, tests, docs, and feedback are welcome!
5+
6+
---
7+
8+
## 🛠️ Project Structure
9+
```txt
10+
launchmap/
11+
├── parser/ # Python-based static launch file parser
12+
├── src/ # VS Code extension (TypeScript)
13+
├── webview/ # Webview frontend (HTML/JS)
14+
```
15+
16+
---
17+
18+
## ⚙️ Setup Instructions
19+
20+
### Installation
21+
22+
```bash
23+
# Clone the repo
24+
git clone https://github.com/Kodo-Robotics/launchmap
25+
cd launchmap
26+
27+
# Python setup
28+
python3 -m venv .venv
29+
source .venv/bin/activate
30+
pip install -r parser/requirements.txt
31+
32+
# Node setup
33+
npm install
34+
```
35+
36+
### Running
37+
38+
Here is how you can get the extension running and see the output:
39+
40+
1. Compile the code
41+
```bash
42+
npm run compile
43+
```
44+
This converts the TypeScript code into JavaScript so VS Code can run it.
45+
46+
2. Start the extension in a debug VS Code window
47+
- Open the file `src/extension.ts`.
48+
- Press F5 (or go to Run and Debug → Launch Extension).
49+
50+
This launches a new VS Code window with the extension loaded in "dev mode" so you can test your changes live.
51+
52+
3. Open a sample launch file
53+
- In the new debug VS Code window, navigate to:
54+
`parser/tests/real_cases/launch_files/`
55+
- Open any `.launch.py` file (these are real world test cases).
56+
57+
4. Run the LaunchMap visualizer
58+
- Press `Cmd + Shift + P` (or `Ctrl + Shift + P` on Windows/Linux).
59+
- Search for `LaunchMap: Open Launch Visualizer` and run it.
60+
61+
You should now see the visualization output.
62+
63+
---
64+
65+
## 🧹 Linting & Code Style
66+
67+
We use:
68+
- `ruff` for Python (ultra-fast linter + formatter)
69+
- `eslint` for TypeScript/JavaScript
70+
71+
### 🔍 Run Python Lint (parser)
72+
73+
```bash
74+
# Test
75+
npm run lint:py
76+
77+
# Fix
78+
npm run lint:py:fix
79+
```
80+
81+
### 🔍 Run JS/TS Lint (extension + webview)
82+
83+
```bash
84+
# Test
85+
npm run lint:js
86+
87+
# Fix
88+
npm run lint:js:fix
89+
```
90+
91+
---
92+
93+
## 🧪 Running Tests
94+
95+
```bash
96+
# Parser Tests
97+
npm run test:parser
98+
99+
# Webview Visual Tests
100+
npm run test:webview
101+
102+
# Extension Integration Tests
103+
npm run test:src
104+
```
105+
106+
### ⚠️ Notes on Snapshot Testing
107+
- Visual snapshots are stored under `webview/tests/__screenshots__/`
108+
- Snapshots may differ between macOS, Windows, and Linux
109+
- Snapshots are only validated on PRs in CI (Linux)
110+
- If you are on macOS/Windows, avoid committing updated snapshots unless necessary
111+
112+
---
113+
114+
## 💡 Tips
115+
- Prefer small, focused PRs
116+
- Follow lint rules strictly (ruff and eslint)
117+
- Playwright tests are validated automatically on PRs
118+
- Use `npx playwright test --update-snapshots` only on Linux for visual diffs
119+
120+
---
121+
122+
## 📬 Questions?
123+
- Join our [Discord Server](https://discord.gg/EK3pHZxrKy)
124+
- Ask on GitHub
125+
126+
Thanks again for contributing! 🚀

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![VSCode Marketplace](https://img.shields.io/visual-studio-marketplace/v/KodoRobotics.launchmap?label=VSCode%20Marketplace)](https://marketplace.visualstudio.com/items?itemName=KodoRobotics.launchmap)
77
[![License](https://img.shields.io/github/license/Kodo-Robotics/launchmap?color=blue)](./LICENSE)
88
[![Join Discord](https://img.shields.io/badge/Discord-Join%20Community-5865F2?logo=discord&logoColor=white)](https://discord.gg/EK3pHZxrKy)
9+
[![Test Status](https://github.com/Kodo-Robotics/launchmap/actions/workflows/tests.yml/badge.svg)](https://github.com/Kodo-Robotics/launchmap/actions/workflows/tests.yml)
910

1011
**LaunchMap** is a Visual Studio Code extension that lets you visualize the structure of ROS 2 launch files as interactive graphs directly inside VSCode.
1112

@@ -177,7 +178,7 @@ New to the ROS 2 ecosystem? Here are some great resources to get you started:
177178
## 🤝 Contributing
178179

179180
Contributions are welcome!
180-
Please open an issue, suggest a feature, or submit a pull request.
181+
Refer to [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
181182

182183
---
183184

eslint.config.mjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import tseslint from 'typescript-eslint';
4+
import { defineConfig } from 'eslint/config';
5+
6+
export default defineConfig([
7+
{
8+
files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
9+
plugins: { js },
10+
extends: ['js/recommended'],
11+
languageOptions: {
12+
globals: {
13+
...globals.browser,
14+
...globals.node
15+
}
16+
},
17+
rules: {
18+
indent: ['error', 2],
19+
quotes: ['error', 'single'],
20+
semi: ['error', 'always'],
21+
'comma-spacing': ['error', { before: false, after: true }],
22+
'keyword-spacing': ['error', { before: true, after: true }],
23+
'space-before-blocks': ['error', 'always'],
24+
'space-in-parens': ['error', 'never'],
25+
'array-bracket-spacing': ['error', 'never'],
26+
'object-curly-spacing': ['error', 'always'],
27+
'no-trailing-spaces': 'error',
28+
'eol-last': ['error', 'always'],
29+
}
30+
},
31+
tseslint.configs.recommended
32+
]);

0 commit comments

Comments
 (0)