Skip to content

Commit 4f73621

Browse files
Merge pull request #368 from pieces-app/run-test-ci
ran tests before PRs to check functionality
2 parents 8d9e5fc + cdbbfcc commit 4f73621

26 files changed

+1281
-502
lines changed

.github/workflows/run_tests.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
test:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-2025]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.11'
24+
25+
- name: Install Poetry
26+
run: pip install poetry -U
27+
28+
- name: Install dependencies
29+
run: poetry install
30+
31+
- name: Ignore Onboarding to avoid any issues in the test flow
32+
run: |
33+
poetry run python -c "from pieces.core import ConfigCommands; config = ConfigCommands.load_config(); config['skip_onboarding']=True; ConfigCommands.save_config(config)"
34+
35+
# Linux shell dependencies
36+
- name: Install shell dependencies (Linux)
37+
if: matrix.os == 'ubuntu-latest'
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y fish zsh
41+
42+
# macOS shell dependencies
43+
- name: Install shell dependencies (macOS)
44+
if: matrix.os == 'macos-latest'
45+
run: |
46+
brew install fish zsh
47+
48+
- name: Show environment info
49+
run: |
50+
poetry --version
51+
python --version
52+
poetry show
53+
env
54+
55+
# Install PiecesOS based on platform
56+
- name: Install PiecesOS (Linux)
57+
if: matrix.os == 'ubuntu-latest'
58+
run: |
59+
sudo apt update
60+
sudo apt install snapd
61+
sudo snap install pieces-os
62+
63+
- name: Install PiecesOS (macOS)
64+
if: matrix.os == 'macos-latest'
65+
run: |
66+
brew install --cask pieces-os
67+
68+
- name: Install PiecesOS (Windows)
69+
if: matrix.os == 'windows-2025'
70+
run: |
71+
winget install "Pieces OS" --silent --accept-package-agreements --accept-source-agreements
72+
73+
- name: Open PiecesOS
74+
run: |
75+
poetry run pieces open
76+
77+
- name: Run tests
78+
run: |
79+
poetry run pytest tests/ --maxfail=1 --exitfirst -v

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,4 @@ src/pieces/completions/
180180
/choco/tools/pieces
181181
Mesh_Intelligent_Technologies_Inc_6_24_22.pfx
182182
certificate.txt
183+
tests/completion_tests/generated/

completion_scripts/autocomplete_generator.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
```
2424
2525
```powershell
26-
python3 completion_scripts/autocomplete_generator.py --powershell | Invoke-Expression
26+
python3 completion_scripts/autocomplete_generator.py --powershell | Out-String | Invoke-Expression
2727
```
2828
"""
2929

@@ -72,7 +72,9 @@ def main():
7272
if shell_arg in ["bash", "zsh", "fish", "powershell"]:
7373
generate(shell_arg)
7474
else:
75-
print("Usage: python autocomplete_generator.py [--bash|--zsh|--fish|--powershell]")
75+
print(
76+
"Usage: python autocomplete_generator.py [--bash|--zsh|--fish|--powershell]"
77+
)
7678
print("Generates shell completion scripts for the Pieces CLI")
7779

7880

completion_scripts/tests/main.py

Lines changed: 0 additions & 100 deletions
This file was deleted.

completion_scripts/tests/test_fish.py

Lines changed: 0 additions & 192 deletions
This file was deleted.

0 commit comments

Comments
 (0)