Skip to content

Commit

Permalink
Merge pull request #217 from jamshale/release-improvements
Browse files Browse the repository at this point in the history
Release improvements
  • Loading branch information
jamshale authored Apr 30, 2024
2 parents 2de7352 + 396e624 commit 78932c5
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 87 deletions.
166 changes: 85 additions & 81 deletions .github/workflows/create-release-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,82 +145,82 @@ jobs:
#----------------------------------------------
# Collect plugins that fail linting
#----------------------------------------------
- name: Lint plugins
id: lint_plugins
continue-on-error: true
run: |
declare -a failed_plugins=()
for dir in ./*/; do
current_folder=$(basename "$dir")
if [[ $current_folder == "plugin_globals" ]]; then
continue
fi
cd $current_folder
poetry install --no-interaction --no-root --extras "aca-py"
if poetry run ruff check .; then
echo "plugin $current_folder passed lint check"
else
echo "plugin $current_folder failed lint check"
failed_plugins+=("$current_folder")
fi
cd ..
done
echo lint_plugins=${failed_plugins[*]} >> $GITHUB_OUTPUT
#----------------------------------------------
# Collect plugins that fail unit tests
#----------------------------------------------
- name: Unit Test Plugins
id: unit_test_plugins
continue-on-error: true
run: |
declare -a failed_plugins=()
for dir in ./*/; do
current_folder=$(basename "$dir")
if [[ $current_folder == "plugin_globals" ]]; then
continue
fi
cd $current_folder
poetry install --no-interaction --no-root --extras "aca-py"
if poetry run pytest; then
echo "plugin $current_folder passed unit test check"
else
echo "plugin $current_folder failed unit test check"
failed_plugins+=("$current_folder")
fi
cd ..
done
echo unit_test_plugins=${failed_plugins[*]} >> $GITHUB_OUTPUT
# ----------------------------------------------
# Install docker compose
# ----------------------------------------------
- name: Initialize Docker Compose
uses: isbang/[email protected]
# ----------------------------------------------
# Collect plugins that fail integration tests
# ----------------------------------------------
- name: Integration Test Plugins
id: integration_test_plugins
continue-on-error: true
run: |
trap 'echo "integration_test_exit_code=$?" >> "$GITHUB_OUTPUT"' EXIT
declare -a failed_plugins=()
for dir in ./*/; do
current_folder=$(basename "$dir")
if [[ $current_folder == "plugin_globals" ]]; then
continue
fi
cd $current_folder/integration
docker compose down --remove-orphans
docker compose build
if docker compose run tests; then
echo "plugin $current_folder passed integration test check"
else
echo "plugin $current_folder failed integration test check"
failed_plugins+=("$current_folder")
fi
cd ../..
done
echo integration_test_plugins=${failed_plugins[*]} >> $GITHUB_OUTPUT
# - name: Lint plugins
# id: lint_plugins
# continue-on-error: true
# run: |
# declare -a failed_plugins=()
# for dir in ./*/; do
# current_folder=$(basename "$dir")
# if [[ $current_folder == "plugin_globals" ]]; then
# continue
# fi
# cd $current_folder
# poetry install --no-interaction --no-root --extras "aca-py"
# if poetry run ruff check .; then
# echo "plugin $current_folder passed lint check"
# else
# echo "plugin $current_folder failed lint check"
# failed_plugins+=("$current_folder")
# fi
# cd ..
# done
# echo lint_plugins=${failed_plugins[*]} >> $GITHUB_OUTPUT
# #----------------------------------------------
# # Collect plugins that fail unit tests
# #----------------------------------------------
# - name: Unit Test Plugins
# id: unit_test_plugins
# continue-on-error: true
# run: |
# declare -a failed_plugins=()
# for dir in ./*/; do
# current_folder=$(basename "$dir")
# if [[ $current_folder == "plugin_globals" ]]; then
# continue
# fi
# cd $current_folder
# poetry install --no-interaction --no-root --extras "aca-py"
# if poetry run pytest; then
# echo "plugin $current_folder passed unit test check"
# else
# echo "plugin $current_folder failed unit test check"
# failed_plugins+=("$current_folder")
# fi
# cd ..
# done
# echo unit_test_plugins=${failed_plugins[*]} >> $GITHUB_OUTPUT
# # ----------------------------------------------
# # Install docker compose
# # ----------------------------------------------
# - name: Initialize Docker Compose
# uses: isbang/[email protected]
# # ----------------------------------------------
# # Collect plugins that fail integration tests
# # ----------------------------------------------
# - name: Integration Test Plugins
# id: integration_test_plugins
# continue-on-error: true
# run: |
# trap 'echo "integration_test_exit_code=$?" >> "$GITHUB_OUTPUT"' EXIT
# declare -a failed_plugins=()
# for dir in ./*/; do
# current_folder=$(basename "$dir")
# if [[ $current_folder == "plugin_globals" ]]; then
# continue
# fi
# cd $current_folder/integration
# docker compose down --remove-orphans
# docker compose build
# if docker compose run tests; then
# echo "plugin $current_folder passed integration test check"
# else
# echo "plugin $current_folder failed integration test check"
# failed_plugins+=("$current_folder")
# fi
# cd ../..
# done
# echo integration_test_plugins=${failed_plugins[*]} >> $GITHUB_OUTPUT
#----------------------------------------------
# Integration Test Failure Check
#----------------------------------------------
Expand Down Expand Up @@ -295,9 +295,9 @@ jobs:
echo "$body" | cat - RELEASES.md > temp && mv temp RELEASES.md
# Check if there are any upgrades
upgraded_plugins=$(python repo_manager.py 5)
has_upgrades=false
upgraded_plugins=($(python repo_manager.py 5))
has_upgrades=false
for plugin in ${potential_upgrades[@]}; do
for upgrade in ${upgraded_plugins[@]}; do
if [[ $plugin == *"$upgrade"* ]]; then
Expand All @@ -317,10 +317,14 @@ jobs:
# Update the release notes with the upgraded plugins
details="Plugins upgraded this release: "
for plugin in ${upgraded_plugins}; do
details="$details $plugin"
details=$(printf 'Plugins upgraded this release: \n\t - ')
count=${#upgraded_plugins[*]}
for i in $(seq 0 "$(("$count" - 2))" );
do
details=$(printf '%s %s \n\t - ' "$details" "${upgraded_plugins[$i]}")
done
details=$(printf '%s %s \n' "$details" "${upgraded_plugins[$count - 1]}")
# Replace the first occurence of ' - ' with the details
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,15 @@ jobs:
# Get the release notes
body=$(python repo_manager.py 4)
upgraded_plugins=($(python repo_manager.py 5))
details=$(printf 'Plugins upgraded this release: \n\t - ')
details="Plugins upgraded this release: "
upgraded_plugins=$(python repo_manager.py 5)
for plugin in ${upgraded_plugins}; do
details="$details $plugin"
count=${#upgraded_plugins[*]}
for i in $(seq 0 "$(("$count" - 2))" );
do
details=$(printf '%s %s \n\t - ' "$details" "${upgraded_plugins[$i]}")
done
details=$(printf '%s %s \n' "$details" "${upgraded_plugins[$count - 1]}")
# Set the outputs
Expand All @@ -131,7 +134,7 @@ jobs:
with:
token: ${{ secrets.BOT_PR_PAT }}
name: ${{ steps.prepare_release.outputs.tag }}
body: ${{ steps.prepare_release.outputs.body }}
body: ${{ steps.prepare_release.outputs.release_body }}
tag_name: ${{ steps.prepare_release.outputs.tag }}
prerelease: false

5 changes: 4 additions & 1 deletion repo_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,11 @@ def main(arg_1 = None):
new_plugins = [plugin for plugin in all_plugins if plugin not in released_plugins]
for plugin in new_plugins:
plugins_on_old_release.append(plugin)
[print(plugin) for plugin in plugins_on_old_release]
output = ""
for plugin in plugins_on_old_release:
output += f'{plugin} '

print(output)
elif selection == "6":
print("Exiting...")
exit(0)
Expand Down

0 comments on commit 78932c5

Please sign in to comment.