-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (117 loc) · 3.96 KB
/
test.yml
File metadata and controls
135 lines (117 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Reusable Test
on:
workflow_call:
inputs:
component:
required: true
type: string
jobs:
test-backend:
runs-on: windows-latest
if: inputs.component == 'backend'
strategy:
fail-fast: true
max-parallel: 1
matrix:
#python-version: ["3.14", "3.15"]
python-version: ["3.14"]
steps:
- uses: actions/checkout@v6
# Set condition as env variable for reuse across steps
- name: Set condition variable
id: should_run
run: |
if [[ "${{ matrix.python-version }}" == "3.14" ]] || \
([[ "${{ matrix.python-version }}" == "3.15" ]] && \
[[ "${{ github.event_name }}" == "push" ]] && \
[[ "${{ github.ref }}" == "refs/heads/main" ]]); then
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "should_run=false" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Set up Python ${{ matrix.python-version }}
if: steps.should_run.outputs.should_run == 'true'
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: ${{ matrix.python-version == '3.15' }}
- name: Install Build Dependencies (Windows)
if: runner.os == 'Windows' && matrix.python-version == '3.15'
run: |
choco install zlib --no-progress
# Try to set typical paths (this is heuristic)
echo "LIB=$env:ChocolateyInstall\lib\zlib\lib;$env:LIB" >> $env:GITHUB_ENV
echo "INCLUDE=$env:ChocolateyInstall\lib\zlib\include;$env:INCLUDE" >> $env:GITHUB_ENV
shell: pwsh
- name: Install dependencies
if: steps.should_run.outputs.should_run == 'true'
run: |
python -m pip install --upgrade pip
pip install .[test,gui,desktop,web-server]
- name: Run All Python Tests
if: steps.should_run.outputs.should_run == 'true'
timeout-minutes: 20
run: |
pytest tests/ -v --tb=short
env:
PYTHONPATH: ${{ github.workspace }}/src
CI: true
GITHUB_ACTIONS: true
- name: Smoke Test (CLI)
if: steps.should_run.outputs.should_run == 'true'
timeout-minutes: 5
run: |
python -m switchcraft.main --version
python -m switchcraft.main --help
shell: bash
env:
PYTHONPATH: ${{ github.workspace }}/src
- name: Check Translations (i18n)
if: steps.should_run.outputs.should_run == 'true'
timeout-minutes: 5
run: |
python scripts/check_i18n.py
shell: bash
test-cli-core:
runs-on: windows-latest
if: inputs.component == 'cli'
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14.3"
- name: Install Core (No GUI)
run: |
python -m pip install --upgrade pip
pip install .[test,desktop]
- name: Run CLI Dynamic Tests
timeout-minutes: 10
run: |
pytest tests/test_cli_dynamic.py tests/test_cli_core.py -v
env:
PYTHONPATH: ${{ github.workspace }}/src
test-e2e:
runs-on: windows-latest
if: inputs.component == 'e2e'
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14.3"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[test,gui,desktop,web-server]
pip install pytest-asyncio
- name: Run E2E Integration Tests
timeout-minutes: 30
run: |
echo "Running E2E / Integration Tests..."
pytest tests/test_ui_interactions.py tests/test_github_login_integration.py -v --tb=short
env:
PYTHONPATH: ${{ github.workspace }}/src
CI: true
GITHUB_ACTIONS: true