-
Notifications
You must be signed in to change notification settings - Fork 8
/
Taskfile.yml
198 lines (174 loc) · 6.8 KB
/
Taskfile.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
version: 3
env:
REPOSITORY: alma-installments-prestashop
tasks:
default:
silent: true
cmds:
- task -l
brew:
preconditions:
- sh: brew -v
msg: 'This task requires `brew`. Please refer to this documentation: https://brew.sh/'
pre-commit:
desc: Install pre-commit tool
internal: true
deps: [brew]
status:
- pre-commit --version
cmds:
- brew install pre-commit
pre-commit:install:
desc: Install and set up pre-commit hooks
deps: [pre-commit]
cmds:
- pre-commit install --hook-type pre-commit --hook-type commit-msg
tools:install:
desc: Composer install of tools
sources:
- alma/composer.json
- alma/composer.lock
cmds:
- composer install --optimize-autoloader --working-dir=alma
docker:build:
desc: Build prestashop docker image
cmds:
- docker compose build prestashop
test:
desc: Execute Unit Tests with coverage
deps:
- docker:build
cmds:
- docker compose run --rm prestashop
dist:
desc: Build the zip file of the module
deps:
- clean
cmds:
- docker build -t alma_prestashop_builder:latest scripts/build/
- docker run --rm -u $(id -u):$(id -g) -w ${PWD} -v "${PWD}:${PWD}" alma_prestashop_builder:latest /bin/sh scripts/build/build-dist-docker.sh
clean:
desc: Remove the dist folder
cmds:
- rm -rf ./dist
lint:ci:
desc: Run linter within docker-compose for the CI
deps:
- docker:build
cmds:
- docker compose run --no-deps --rm --entrypoint "php" -w /var/www/html/modules prestashop alma/vendor/bin/php-cs-fixer fix --dry-run --diff alma
lint:
desc: Run linter
deps:
- tools:install
cmds:
- php alma/vendor/bin/php-cs-fixer fix --dry-run --diff alma
# Search for variables in smarty templates that are not escaped
# ="{\$[^\s|]*} => Search for string ="{$<variable>}" with variable not followed by the character |
# exits with 0 if no match is found
# exits with 1 with an error message if a match is found
# TODO : Check rule to be clarified with Prestashop, check commented in the meantime
# - grep --color -r -P '="{\$[^\s|]*}' alma/views/templates/* || exit 0 && >&2 echo "Variables in smarty templates should use |escape:'htmlall':'UTF-8'" && exit 1
lint:fix:
desc: Run linter and apply fix
deps:
- tools:install
cmds:
- php alma/vendor/bin/php-cs-fixer fix alma
# Execute autoindex to add index in all folders
- php ./alma/vendor/bin/autoindex prestashop:add:index --exclude=vendor alma/
# Remove blank line at the end of index.php file
# Script commented as it is not coherent with the linter rules
- #./scripts/remove-blank-line-index.sh
php-compatibility:
desc: Check compatibility code
deps:
- tools:install
cmds:
- php ./alma/vendor/bin/phpcs -p alma --standard=PHPCompatibility -s --runtime-set testVersion 5.6-8.1 --ignore=\*/vendor/\*,\*/.coverage/\*
crowdin:
internal: true
preconditions:
- sh: which crowdin
msg: Crowdin CLI is required
crowdin:download:
desc: Download translations from Crowdin
deps:
- crowdin
cmds:
- crowdin download
crowdin:upload:
desc: Upload translations to Crowdin
deps:
- crowdin
cmds:
- crowdin upload sources
gh-cli:
internal: true
preconditions:
- sh: gh --version
msg: |
⚠️ This task requires `gh` (Github CLI).
Please check out: https://github.com/cli/cli#installation
You'll need a personal access token to authenticate with `gh`.
Please check out: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-personal-access-token-classic
Then, run `gh auth login` or set the GITHUB_TOKEN environment variable with your personal access token.
release:
deps:
- gh-cli
desc: Create a release pull request
cmds:
- gh workflow run release-pull-request.yml
- sleep 5
- cmd: echo "✅ Release pull request created, check out https://github.com/alma/{{.REPOSITORY}}/pulls?q=is%3Aopen+is%3Apr+label%3Arelease"
silent: true
- defer: { task: release:info }
release:help:
desc: Print help regarding the release process
cmds:
- cmd: |
echo -e "ℹ️ The Release PR can be created using \e[3mtask release\e[0m command"
echo " Run it and check out https://github.com/alma/{{.REPOSITORY}}/pulls?q=is%3Aopen+is%3Apr+label%3Arelease"
echo " If no pull request is created, check out https://github.com/alma/{{.REPOSITORY}}/actions/workflows/release-pull-request.yml for errors"
silent: true
- defer: { task: release:info }
release:info:
internal: true
cmds:
- cmd: |
echo "TODO next:"
echo "➡️ Review and merge the pull request to publish the release in Github"
echo "➡️ Publish the release in the Prestashop Marketplace"
echo " - Go to https://addons.prestashop.com"
echo " - Log in using 1Password credentials"
echo " - Go to compte vendeur => product => module Alma => Add a zip"
echo " - Add the zip that can be downloaded from last release assets https://github.com/alma/alma-installments-prestashop/releases/latest"
echo " - Set Compatibility 1.5.3.1 to latest"
echo " - Add changelogs (one by line)"
echo " - Check the RGPD Europe compliance box (2nd one)"
echo "➡️ Merge the Backport PR to update develop branch"
silent: true
hotfix:
deps:
- gh-cli
desc: Create a hotfix pull request
preconditions:
- sh: test -n "{{.CHANGELOG_MESSAGE}}"
msg: |
⚠️ This task requires a changelog message.
Please provide a changelog message. Example: `task hotfix CHANGELOG_MESSAGE='This is a message'`.
cmds:
- gh workflow run hotfix-pull-request.yml -F changelog-message='{{.CHANGELOG_MESSAGE}}'
- sleep 5
- cmd: echo "✅ Hotfix pull request created, check out https://github.com/alma/{{.REPOSITORY}}/pulls?q=is%3Aopen+is%3Apr+label%3Ahotfix"
silent: true
- defer: { task: release:info }
hotfix:help:
desc: Print help regarding the hotfix process
cmds:
- cmd: |
echo -e "ℹ️ The Hotfix PR can be created using \e[3mtask hotfix CHANGELOG_MESSAGE='insert a changelog message'\e[0m command"
echo " Run it and check out https://github.com/alma/{{.REPOSITORY}}/pulls?q=is%3Aopen+is%3Apr+label%3Ahotfix"
echo " If no pull request is created, check out https://github.com/alma/{{.REPOSITORY}}/actions/workflows/hotfix-pull-request.yml for errors"
silent: true
- defer: { task: release:info }