Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
Signed-off-by: jamshale <jamiehalebc@gmail.com>
  • Loading branch information
jamshale committed Nov 10, 2023
1 parent 225fb75 commit 5adcae6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pull Request - Integration Tests
name: Integration Tests
on:
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
Expand All @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and install poetry
# Check out repo
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Initialize Docker Compose
uses: isbang/compose-action@v1.5.1
#----------------------------------------------
# Run integration Tests
# Run integration tests for changed plugins
#----------------------------------------------
- name: Run integration tests
id: integration-tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,48 @@
name: Push any branch
name: Linting and Unit Tests
on:
push:
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
branches:
- "**"

jobs:
quality-and-unit-tests:
linting-and-unit-tests:
name: "Code quality and unit tests"
runs-on: ubuntu-latest
outputs:
changed-plugins: ${{ steps.changed-plugins.outputs.cache-hit }}
steps:
#----------------------------------------------
# check-out repo and install poetry
# Check out repo
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
#----------------------------------------------
# Get changed plugins
#----------------------------------------------
- name: Get changed plugins
id: changed-plugins
uses: tj-actions/changed-files@v40
run: /

# This will navigate to each subdirectory and perform integration tests
# If we have a directory that isn't a plugin then it will need to skip it. Currently there is none.
declare -a changed_dirs=()
for dir in ./*/; do
current_folder=$(basename "$dir")
for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ $changed_file == *"$current_folder"* ]]; then
if ! [[ ${changed_dirs[*]} =~ $current_folder ]]; then
changed_dirs+=("$current_folder")
fi
fi
done
done

echo "::set-output name=changed-plugins::${changed_dirs[*]}"
#----------------------------------------------
# Install python and poetry with cache
#----------------------------------------------
- name: Install poetry
run: pipx install poetry
id: setup-poetry
Expand All @@ -32,7 +61,7 @@ jobs:
# This will navigate to each subdirectory and install the dependencies
# If we have a directory that isn't a plugin then it will need to skip it. Currently there is none.
for dir in ./*/; do
for dir in ${{ steps.changed-plugins.changed-plugins }}; do
cd $dir
poetry install --no-interaction --no-root
cd ..
Expand Down

0 comments on commit 5adcae6

Please sign in to comment.