-
-
Notifications
You must be signed in to change notification settings - Fork 32
100 lines (89 loc) · 3.52 KB
/
Copy pathci.yml
File metadata and controls
100 lines (89 loc) · 3.52 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
name: Build and Lint
on:
push:
branches:
- '**'
pull_request:
jobs:
lint:
name: Lint with flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Lint
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --builtins="_"
# Exit if any flake8 issue is found (errors or warnings)
flake8 . --count --max-complexity=10 --max-line-length=88 --statistics
translation-check:
name: Check translation template
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install meson ninja
sudo apt-get update
sudo apt-get install -y gettext blueprint-compiler desktop-file-utils libglib2.0-dev
- name: Setup build directory
run: |
meson setup builddir
- name: Check if .pot file needs updating
run: |
# Backup the original .pot file from the checkout
cp po/drum-machine.pot po/drum-machine.pot.orig
# Regenerate the .pot file
meson compile -C builddir drum-machine-pot
# Verify the generated .pot file exists
if [ ! -f po/drum-machine.pot ]; then
echo "::error::Failed to generate .pot file. Build may have failed."
exit 1
fi
# Normalize both files by:
# 1. Replacing timestamp with placeholder
# 2. Removing line number references (e.g., ":123" -> "")
normalize_pot() {
sed -E \
-e 's/POT-Creation-Date: [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}\+[0-9]{4}/POT-Creation-Date: TIMESTAMP/g' \
-e '/^#:/ s/:[0-9]+//g' \
"$1"
}
normalize_pot po/drum-machine.pot.orig > po/drum-machine.pot.orig.normalized
normalize_pot po/drum-machine.pot > po/drum-machine.pot.normalized
# Compare normalized files (ignore whitespace differences)
if ! diff -u --ignore-all-space po/drum-machine.pot.orig.normalized po/drum-machine.pot.normalized > /dev/null; then
echo "::error file=po/drum-machine.pot::Translation template (.pot file) is out of date. Please run 'meson compile -C builddir drum-machine-pot' and commit the updated po/drum-machine.pot file."
echo ""
echo "Diff of changes needed:"
diff -u po/drum-machine.pot.orig.normalized po/drum-machine.pot.normalized || true
exit 1
fi
echo "✓ Translation template is up to date"
flatpak:
name: Flatpak Builder
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-nightly
options: --privileged
steps:
- uses: actions/checkout@v4
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: "drum-machine-devel.flatpak"
manifest-path: "io.github.revisto.drum-machine.json"
run-tests: "true"
cache-key: flatpak-builder-${{ github.sha }}