-
Notifications
You must be signed in to change notification settings - Fork 2
95 lines (82 loc) · 2.77 KB
/
release_test.yml
File metadata and controls
95 lines (82 loc) · 2.77 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
name: Release Testing
on:
pull_request:
branches:
- main
paths:
- 'custom_components/**'
- '.github/workflows/**'
jobs:
validate_hacs:
runs-on: ubuntu-latest
name: HACS Validation
steps:
- uses: actions/checkout@v6
- name: HACS Validation
uses: hacs/action@main
with:
category: integration
validate_hassfest:
runs-on: ubuntu-latest
name: Hassfest Validation
steps:
- uses: actions/checkout@v6
- name: Hassfest Validation
uses: home-assistant/actions/hassfest@master
python_test:
runs-on: ubuntu-latest
name: Python Validation
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
check_version:
runs-on: ubuntu-latest
name: Version Check
if: startsWith(github.head_ref, 'release/v')
steps:
- uses: actions/checkout@v6
- name: Extract version from branch name
id: extract_version
run: echo "version=$(echo ${{ github.head_ref }} | sed 's/release\///')" >> $GITHUB_OUTPUT
- name: Check manifest version
run: |
MANIFEST_VERSION=$(grep '"version"' custom_components/ovms/manifest.json | cut -d'"' -f4)
BRANCH_VERSION="${{ steps.extract_version.outputs.version }}"
echo "Manifest version: $MANIFEST_VERSION"
echo "Branch version: $BRANCH_VERSION"
if [ "$MANIFEST_VERSION" != "$BRANCH_VERSION" ]; then
echo "Error: Version in manifest.json ($MANIFEST_VERSION) does not match branch version ($BRANCH_VERSION)"
exit 1
else
echo "✅ Version check passed"
fi
add_release_label:
runs-on: ubuntu-latest
name: Add Release Label
if: startsWith(github.head_ref, 'release/v')
steps:
- name: Add release label
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['release']
})