Skip to content

Commit

Permalink
feat(plone-package-test-notify): INSTALL_DEPENDENCIES_COMMANDS input
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
remdub authored Oct 1, 2024
1 parent 65b0785 commit 93e381c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 25 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v4.0.0] - 2024-10-01
### Changed
- plone-package-test-notify
- Do not install Python if PYTHON_VERSION is not specified
- plone-package-test-notify (**breaking change**)
- Removed REQUIREMENTS_FILE input
- Added INSTALL_DEPENDENCIES_COMMANDS input

## [v3.9.6] - 2024-09-26
### Changed
- code-analysis-notify
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,15 @@ Test a Plone package and optionally notify via a mattermost webhook

#### Inputs

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

#### Example of usage

Expand Down
44 changes: 27 additions & 17 deletions plone-package-test-notify/action.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
name: Run code analysis
description: Run code analysis and notify on Mattermost
inputs:
BUILDOUT_CONFIG_FILE:
description: 'Path to buildout configuration file'
required: true
default: "buildout.cfg"
CACHE_KEY:
description: 'Cache key'
required: false
INSTALL_DEPENDENCIES_COMMANDS:
description: 'Commands to install dependencies'
required: false
MATTERMOST_WEBHOOK_URL:
description: 'Webhook URL to send notifications on Mattermost, if not provided, notifications will not be sent'
required: false
PYTHON_VERSION:
description: 'Python version to use'
required: true
default: "3.10"
required: false
TEST_COMMAND:
description: 'Command to run tests'
required: true
default: "bin/test"
REQUIREMENTS_FILE:
description: 'Path to requirements file'
required: true
default: "requirements.txt"
BUILDOUT_CONFIG_FILE:
description: 'Path to buildout configuration file'
required: true
default: "buildout.cfg"
MATTERMOST_WEBHOOK_URL:
description: 'Webhook URL to send notifications on Mattermost, if not provided, notifications will not be sent'
required: false
runs:
using: 'composite'
steps:
- name: Install curl
run: sudo apt-get update && sudo apt-get install -y curl git
- name: Install curl and git
run: |
if which curl > /dev/null && which git > /dev/null; then
echo "curl and git are already installed"
else
sudo apt-get update && sudo apt-get install -y curl git
fi
shell: bash
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -39,14 +42,21 @@ runs:
with:
path: ./eggs
key: ${{ inputs.CACHE_KEY }}
- name: Setup Python ${{ inputs.PYTHON_VERSION }}
- name: Setup Python
if: ${{ inputs.PYTHON_VERSION != '' }}
uses: actions/[email protected]
with:
python-version: ${{ inputs.PYTHON_VERSION }}
- name: Install dependencies
if: ${{ inputs.INSTALL_DEPENDENCIES_COMMANDS != '' }}
shell: bash
run: |
pip install -r ${{ inputs.REQUIREMENTS_FILE }}
set +e
IFS=$'\n' read -r -d '' -a commands <<< "${{ inputs.INSTALL_DEPENDENCIES_COMMANDS }}"
for command in "${commands[@]}"; do
echo "Running command: $command"
$command
done
- name: Run buildout
shell: bash
run: |
Expand Down

0 comments on commit 93e381c

Please sign in to comment.