This repository has been archived by the owner on Dec 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: python-prefect | ||
author: sp1thas | ||
description: Run prefect commands on a Python project | ||
branding: | ||
icon: check | ||
color: blue | ||
|
||
inputs: | ||
projectName: | ||
description: The name of the Prefect project to register this flow in | ||
required: true | ||
prefectVersion: | ||
description: Version of prefect to use | ||
required: false | ||
default: "-" | ||
flowPath: | ||
description: A path to a file or a directory containing the flow(s) to register. | ||
required: false | ||
default: "-" | ||
flowModulePath: | ||
description: A python module name containing the flow(s) to register. | ||
required: false | ||
default: "-" | ||
jsonPath: | ||
description: A path or URL to a JSON file created by `prefect build` containing the flow(s) to register. | ||
required: false | ||
default: "-" | ||
flowName: | ||
description: | ||
The name of a flow to register from the specified paths/modules. | ||
If provided, only flows with a matching name will be registered. | ||
required: false | ||
default: "-" | ||
flowLabel: | ||
description: A label to add on all registered flow(s). | ||
required: false | ||
default: "-" | ||
requirementsFiles: | ||
description: | ||
path(s) to requirements files that should be installed to properly | ||
configure third-party imports | ||
required: false | ||
default: "-" | ||
|
||
outputs: | ||
prefect-result: | ||
description: prefect result | ||
value: ${{ steps.run-isort.outputs.isort-output }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- run: ${{ github.action_path }}/bin/ensure_python | ||
shell: bash | ||
- run: | ||
${{ github.action_path }}/bin/install_packages ${{ inputs.prefectVersion | ||
}} ${{ inputs.requirementsFiles }} | ||
shell: bash | ||
- id: run-prefect | ||
run: | ||
${{ github.action_path }}/bin/run_register ${{ inputs.projectName }} ${{ inputs.flowPath }} ${{ inputs.flowModulePath }} ${{ inputs.jsonPath }} ${{ inputs.flowName }} ${{ inputs.flowLabel }} | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
# If Python 3 isn't installed, exit | ||
python3 -V > /dev/null 2>&1 || (echo "python3 is not available. Use the setup-python action" && exit 1) | ||
|
||
# Make sure we're using a supported version of Python | ||
major_version=$(python3 -c 'import sys; print(sys.version_info[0])') | ||
minor_version=$(python3 -c 'import sys; print(sys.version_info[1])') | ||
if [ "$major_version" -lt 3 ] || [ "$minor_version" -lt 6 ]; then | ||
echo "Minimum supported version of python is 3.6, but $(python3 -V) is installed" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
prefect_version=$1 | ||
requirements_files=$2 | ||
|
||
echo "::group::Install prefect" | ||
if [ -z "$prefect_version" ]; then | ||
echo "Installing latest version of prefect" | ||
pip3 install "prefect" | ||
else | ||
echo "Installing prefect==$prefect_version" | ||
pip3 install "prefect==$prefect_version" | ||
fi | ||
echo "::endgroup::" | ||
|
||
if [ -n "$requirements_files" ]; then | ||
echo "::group::Install modules from requirements arg" | ||
for file in $requirements_files; do | ||
pip install -r "$file" | ||
done | ||
echo "::endgroup::" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Running prefect $*" | ||
|
||
args="--project ${1}" | ||
|
||
if [ ! "${2}" == "-" ]; | ||
then | ||
args="${args} -p ${2}" | ||
fi | ||
if [ ! "${3}" == "-" ]; | ||
then | ||
args="${args} -m ${3}" | ||
fi | ||
if [ ! "${4}" == "-" ]; | ||
then | ||
args="${args} -j ${4}" | ||
fi | ||
if [ ! "${5}" == "-" ]; | ||
then | ||
args="${args} -n ${5}" | ||
fi | ||
if [ ! "${6}" == "-" ]; | ||
then | ||
args="${args} -l ${6}" | ||
fi | ||
|
||
prefect_result=$(prefect register "${args}") | ||
exit_code=$? | ||
|
||
echo "::set-output name=prefect-output::${prefect_result}" | ||
exit $exit_code |