Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linter matrix #682

Merged
merged 51 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ede79dd
testing the lint
yairsimantov20 Jun 2, 2024
8418222
testing the lint
yairsimantov20 Jun 2, 2024
8858efb
testing the lint
yairsimantov20 Jun 2, 2024
dd36623
testing the lint
yairsimantov20 Jun 2, 2024
5217833
testing the lint
yairsimantov20 Jun 2, 2024
6faac09
testing the lint
yairsimantov20 Jun 2, 2024
e36538f
testing the lint
yairsimantov20 Jun 2, 2024
079a988
testing the lint
yairsimantov20 Jun 2, 2024
911bb19
testing the lint
yairsimantov20 Jun 2, 2024
35eb646
testing the lint
yairsimantov20 Jun 2, 2024
a6f7351
testing the lint
yairsimantov20 Jun 2, 2024
a05d011
testing the lint
yairsimantov20 Jun 2, 2024
b9b9ef0
testing the lint
yairsimantov20 Jun 2, 2024
ab3b1b6
testing the lint
yairsimantov20 Jun 2, 2024
f3ea8be
testing the lint
yairsimantov20 Jun 2, 2024
9b86207
testing the lint
yairsimantov20 Jun 2, 2024
ef90cda
testing the lint
yairsimantov20 Jun 2, 2024
fcbd514
testing the lint
yairsimantov20 Jun 2, 2024
ada1442
testing the lint
yairsimantov20 Jun 2, 2024
56061e9
testing the lint
yairsimantov20 Jun 2, 2024
02c0049
Merge branch 'main' into lint-matrix
yairsimantov20 Jun 2, 2024
8599cb1
testing the lint
yairsimantov20 Jun 2, 2024
2ab77ce
testing the lint
yairsimantov20 Jun 2, 2024
7ecaeed
Merge remote-tracking branch 'origin/lint-matrix' into lint-matrix
yairsimantov20 Jun 2, 2024
8e141c5
testing the lint
yairsimantov20 Jun 2, 2024
c25ff7e
testing the lint
yairsimantov20 Jun 2, 2024
fb5b828
testing the lint
yairsimantov20 Jun 2, 2024
b50a3ec
testing the lint
yairsimantov20 Jun 2, 2024
d48c2d5
testing the lint
yairsimantov20 Jun 2, 2024
98cc2cf
testing the lint
yairsimantov20 Jun 2, 2024
206eaf9
testing the lint
yairsimantov20 Jun 2, 2024
e159ea9
testing the lint
yairsimantov20 Jun 2, 2024
f872cf3
testing the lint
yairsimantov20 Jun 2, 2024
158ea1e
testing the lint
yairsimantov20 Jun 2, 2024
1e59cb1
testing the lint
yairsimantov20 Jun 2, 2024
b047aec
testing the lint
yairsimantov20 Jun 2, 2024
335ec59
testing the lint
yairsimantov20 Jun 2, 2024
92a4ba8
testing the lint
yairsimantov20 Jun 2, 2024
70e9a52
testing the lint
yairsimantov20 Jun 2, 2024
ecb6e1e
testing the lint
yairsimantov20 Jun 2, 2024
7f99378
testing the lint
yairsimantov20 Jun 2, 2024
4fa825d
testing the lint
yairsimantov20 Jun 2, 2024
0505229
testing the lint
yairsimantov20 Jun 2, 2024
6059fd0
testing the lint
yairsimantov20 Jun 2, 2024
37a0b18
testing the lint
yairsimantov20 Jun 2, 2024
4fde127
testing the lint
yairsimantov20 Jun 2, 2024
8aa28fa
testing the lint
yairsimantov20 Jun 2, 2024
347a8a4
testing the lint
yairsimantov20 Jun 2, 2024
0933f9c
Merge branch 'lint-matrix' of github.com:port-labs/Port-Ocean into li…
yairsimantov20 Jun 3, 2024
152e9cf
lint
yairsimantov20 Jun 3, 2024
5beb8b0
Merge branch 'main' into lint-matrix
yairsimantov20 Jun 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,56 @@ on:
workflow_dispatch:

jobs:
detect-changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Get list of changed files
id: changed-files
uses: tj-actions/[email protected]
- name: Set matrix
id: set-matrix
run: |
folders_to_ignore="integrations/*/LICENSE.md|integrations/*/README.md|integrations/*/CONTRIBUTING.md|integrations/*/CHANGELOG.md"
changed_folders=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep '^integrations/' | grep -v '^($folders_to_ignore)' | cut -d'/' -f2 | sort | uniq)
if [ -z "$changed_folders" ]; then
changed_folders=""
fi

folders_to_ignore="integrations/|scripts/|assets/|docs/|LICENSE.md|README.md|CONTRIBUTING.md|CHANGELOG.md"
other_changes=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep -v '^($folders_to_ignore)' | wc -l)
if [ "$other_changes" -ne 0 ]; then
# Add the root directory to the matrix if there are changes outside the integrations folder
changed_folders=$(echo -e "$changed_folders\n.")
fi

matrix=$(echo "$changed_folders" | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "matrix=$matrix" >> $GITHUB_OUTPUT

lint:
name: Lint
name: ${{ matrix.folder == '.' && '🌊 Ocean Core' || format('🚢 {0}', matrix.folder) }}
needs: detect-changes
runs-on: ubuntu-latest
strategy:
matrix:
folder: ${{ fromJson(needs.detect-changes.outputs.matrix) }}
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Dependencies
- name: Install dependencies
working-directory: ${{ matrix.folder != '.' && format('integrations/{0}', matrix.folder) || '.' }}
run: |
make install/all
make install
- name: Lint
working-directory: ${{ matrix.folder != '.' && format('integrations/{0}', matrix.folder) || '.' }}
run: |
make lint/all
make lint
20 changes: 1 addition & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ define deactivate_virtualenv
fi
endef

.SILENT: install install/all lint lint/integrations lint/all build run new test clean
.SILENT: install install/all lint build run new test clean


# Install dependencies
Expand Down Expand Up @@ -69,24 +69,6 @@ lint:
$(ACTIVATE) && \
$(call run_checks,.)

lint/integrations:
$(ACTIVATE) && \
exit_code=0; \
for dir in $(wildcard $(CURDIR)/integrations/*); do \
count=$$(find $$dir -type f -name '*.py' -not -path "*/venv/*" | wc -l); \
if [ $$count -ne 0 ]; then \
echo "Linting $$dir"; \
cd $$dir; \
$(MAKE) lint || exit_code=$$?; \
cd ../..; \
fi; \
done; \
if [ $$exit_code -ne 0 ]; then \
exit 1; \
fi

lint/all: lint lint/integrations

# Development commands
build:
$(ACTIVATE) && poetry build
Expand Down