Skip to content

Commit 93e381c

Browse files
authored
feat(plone-package-test-notify): INSTALL_DEPENDENCIES_COMMANDS input
* fix(plone-package-test-notify): export path * feat(plone-package-test-notify): python_version is optional * fix(plone-package-test-notify): do not export path * feat(plone-package-test-notify): only install curl and git if not already installed * feat(plone-package-test-notify): sort inputs * feat(plone-package-test-notify): INSTALL_DEPENDENCIES_COMMANDS input
1 parent 65b0785 commit 93e381c

File tree

3 files changed

+44
-25
lines changed

3 files changed

+44
-25
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [v4.0.0] - 2024-10-01
4+
### Changed
5+
- plone-package-test-notify
6+
- Do not install Python if PYTHON_VERSION is not specified
7+
- plone-package-test-notify (**breaking change**)
8+
- Removed REQUIREMENTS_FILE input
9+
- Added INSTALL_DEPENDENCIES_COMMANDS input
10+
311
## [v3.9.6] - 2024-09-26
412
### Changed
513
- code-analysis-notify

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,15 @@ Test a Plone package and optionally notify via a mattermost webhook
190190

191191
#### Inputs
192192

193-
| name | required | type | default | description |
194-
| ---------------------- | -------- | ------ | ------------------ | ----------- |
195-
| CACHE_KEY | no | string | | key to use in actions/cache |
196-
| PYTHON_VERSION | yes | string | "3.10" | Python version to use |
197-
| TEST_COMMAND | yes | string | "bin/test" | Test command to run |
198-
| REQUIREMENTS_FILE | yes | string | "requirements.txt" | Requirements file |
199-
| BUILDOUT_CONFIG_FILE | yes | string | "buildout.cfg" | Buildout config file |
200-
| MATTERMOST_WEBHOOK_URL | no | string | | Webhook URL to send notifications on Mattermost |
193+
| name | required | type | default | description |
194+
| ----------------------------- | -------- | ------ | ------------------ | ----------- |
195+
| CACHE_KEY | no | string | | key to use in actions/cache |
196+
| PYTHON_VERSION | no | string | | Python version to use |
197+
| TEST_COMMAND | yes | string | "bin/test" | Test command to run |
198+
| REQUIREMENTS_FILE | yes | string | "requirements.txt" | Requirements file |
199+
| BUILDOUT_CONFIG_FILE | yes | string | "buildout.cfg" | Buildout config file |
200+
| MATTERMOST_WEBHOOK_URL | no | string | | Webhook URL to send notifications on Mattermost |
201+
| INSTALL_DEPENDENCIES_COMMANDS | no | string | | Install dependencies commands (one per line) |
201202

202203
#### Example of usage
203204

plone-package-test-notify/action.yml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
name: Run code analysis
22
description: Run code analysis and notify on Mattermost
33
inputs:
4+
BUILDOUT_CONFIG_FILE:
5+
description: 'Path to buildout configuration file'
6+
required: true
7+
default: "buildout.cfg"
48
CACHE_KEY:
59
description: 'Cache key'
610
required: false
11+
INSTALL_DEPENDENCIES_COMMANDS:
12+
description: 'Commands to install dependencies'
13+
required: false
14+
MATTERMOST_WEBHOOK_URL:
15+
description: 'Webhook URL to send notifications on Mattermost, if not provided, notifications will not be sent'
16+
required: false
717
PYTHON_VERSION:
818
description: 'Python version to use'
9-
required: true
10-
default: "3.10"
19+
required: false
1120
TEST_COMMAND:
1221
description: 'Command to run tests'
1322
required: true
1423
default: "bin/test"
15-
REQUIREMENTS_FILE:
16-
description: 'Path to requirements file'
17-
required: true
18-
default: "requirements.txt"
19-
BUILDOUT_CONFIG_FILE:
20-
description: 'Path to buildout configuration file'
21-
required: true
22-
default: "buildout.cfg"
23-
MATTERMOST_WEBHOOK_URL:
24-
description: 'Webhook URL to send notifications on Mattermost, if not provided, notifications will not be sent'
25-
required: false
2624
runs:
2725
using: 'composite'
2826
steps:
29-
- name: Install curl
30-
run: sudo apt-get update && sudo apt-get install -y curl git
27+
- name: Install curl and git
28+
run: |
29+
if which curl > /dev/null && which git > /dev/null; then
30+
echo "curl and git are already installed"
31+
else
32+
sudo apt-get update && sudo apt-get install -y curl git
33+
fi
3134
shell: bash
3235
- name: Checkout
3336
uses: actions/checkout@v4
@@ -39,14 +42,21 @@ runs:
3942
with:
4043
path: ./eggs
4144
key: ${{ inputs.CACHE_KEY }}
42-
- name: Setup Python ${{ inputs.PYTHON_VERSION }}
45+
- name: Setup Python
46+
if: ${{ inputs.PYTHON_VERSION != '' }}
4347
uses: actions/[email protected]
4448
with:
4549
python-version: ${{ inputs.PYTHON_VERSION }}
4650
- name: Install dependencies
51+
if: ${{ inputs.INSTALL_DEPENDENCIES_COMMANDS != '' }}
4752
shell: bash
4853
run: |
49-
pip install -r ${{ inputs.REQUIREMENTS_FILE }}
54+
set +e
55+
IFS=$'\n' read -r -d '' -a commands <<< "${{ inputs.INSTALL_DEPENDENCIES_COMMANDS }}"
56+
for command in "${commands[@]}"; do
57+
echo "Running command: $command"
58+
$command
59+
done
5060
- name: Run buildout
5161
shell: bash
5262
run: |

0 commit comments

Comments
 (0)