-
Notifications
You must be signed in to change notification settings - Fork 28
133 lines (123 loc) · 4.86 KB
/
ci.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
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
on:
push:
branches: [master]
pull_request:
name: CI
jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: Create blank versions of configured file
run: echo -e "" >> src/config.rs
- name: Run cargo fmt
run: cargo fmt --all -- --check
flatpak:
name: Flatpak
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-nightly
options: --privileged
steps:
- uses: actions/checkout@v4
- name: Add Flathub Beta remote
run: |
flatpak --user remote-add --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo
flatpak install --user -y flathub-beta org.freedesktop.Sdk.Extension.rust-stable//24.08beta org.freedesktop.Sdk.Extension.llvm18//24.08beta
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6
with:
bundle: eyedropper.flatpak
# repository-name: flathub-beta
manifest-path: build-aux/com.github.finefindus.eyedropper.Devel.json
run-tests: true
cache-key: flatpak-builder-${{ github.sha }}
spell_check:
name: Spell Checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Python Dependencies
run: pip install codespell
- name: Run spellchecker
run: codespell -S po,_build,.git,.flatpak,_builddir,build,target -L crate,rouge,vermillion
update_translations:
name: Update .pot template
#this cannot be run on pull requests as it cannot commit
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install gettext
run: |
sudo apt update
sudo apt install gettext -y
- name: Update POTFILES.in
run: |
# remove old POTFILES.in
rm po/POTFILES.in
# add warning
echo "# DO NOT EDIT MANUALLY" >> po/POTFILES.in
echo "# This files is autogenerated by the CI pipeline." >> po/POTFILES.in
# add metadata files
echo "# METADATA files" >> po/POTFILES.in
echo "data/com.github.finefindus.eyedropper.desktop.in.in" >> po/POTFILES.in
echo "data/com.github.finefindus.eyedropper.metainfo.xml.in.in" >> po/POTFILES.in
# add ui files
echo "# UI files" >> po/POTFILES.in
find data -name "*.blp*" -print | sort >> po/POTFILES.in
# add rust files
echo "# RUST files" >> po/POTFILES.in
grep gettext src/ -r | grep .rs | cut -d: -f1 | uniq | sort >> po/POTFILES.in
- name: Update Eyedropper.pot
run: |
./scripts/make-pot.sh
echo "POT_LINES_CHANGED=$(git diff -U0 | grep '^[+|-][^+|-]' | grep -Ev '^[+-]"POT-Creation-Date' | wc -l)" >> $GITHUB_ENV
- name: Push changes
if: ${{ env.POT_LINES_CHANGED != 0}}
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "chore(translations): update template"
add: "['po/Eyedropper.pot', 'po/POTFILES.in']"
# notify_translators:
# name: Notify Translators
# runs-on: ubuntu-latest
# if: ${{ false }} # disable for now
# steps:
# - uses: actions/checkout@v3
# - name: Get changed files in the docs folder
# id: changed-files-specific
# uses: tj-actions/changed-files@v32
# with:
# files: |
# po/Eyedropper.pot
# - name: Extract email addresses
# shell: bash
# # extract translator email addresses
# run: echo "EMAILS=$(head -n 12 po/*.po | grep -i -o '[A-Z0-9._%+-]\+@[A-Z0-9.-]\+\.[A-Z]\{2,4\}' | sort | uniq | tr "\n" ",")" >> $GITHUB_ENV
# - name: Run step if any file(s) in the docs folder change
# if: steps.changed-files-specific.outputs.any_changed == 'true'
# uses: dawidd6/action-send-mail@v2
# with:
# server_address: smtp.gmail.com
# server_port: 465
# # user credentials
# username: ${{ secrets.EMAIL_USERNAME }}
# password: ${{ secrets.EMAIL_PASSWORD }}
# # email subject
# subject: Eyedropper has new translations available
# # email body as text
# body: Hi,\n the translation of Eyedropper have been updated. This is an automated email, send whenever the template file changes. If you do not wish to receive this email, please open an issue on the project github page.
# # comma-separated string, send email to
# to: $ {{ env.EMAILS }}
# # from email name
# from: FineFindus