-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (86 loc) · 2.24 KB
/
analyze-and-test.yml
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
# Action name here
name: Code Maintenance
on:
# Triggered on main branch when lib/ or test/ contents change
push:
branches: [main]
paths:
- "organizer/"
- "test/"
# And every pull request to main
pull_request:
branches: [main]
# Allows manual triggering
workflow_dispatch:
jobs:
detect-secrets:
name: No committed secrets
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
set-safe-directory: true
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install detect-secrets
run: pip install detect-secrets
- name: Scan for secrets
run: detect-secrets scan --baseline .secrets.baseline
prettier-check:
name: Prettier formatted files
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
set-safe-directory: true
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install prettier
run: npm install -g prettier
- name: Run prettier against files
run: prettier -c .
analyze-code:
name: No code smells
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
set-safe-directory: true
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Lint code
uses: chartboost/ruff-action@v1
- name: Check code formatting
uses: psf/black@stable
with:
options: "--check"
run-tests:
name: Tests pass
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
set-safe-directory: true
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Make sure jmenu isn't installed
run: pip uninstall jmenu -y
- name: Run unit tests
run: pytest
- name: Build package
run: |
python3 -m build
pip install dist/*.whl
- name: Test import
shell: python
run: |
try:
import jmenu.main
print(jmenu.main.get_version())
exit(0)
except ModuleNotFoundError:
exit(1)
- name: Clean
run: pip uninstall jmenu -y