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

Split the workflows into catalog.yml, client.yml, and lambdas.yml #3866

Open
wants to merge 1 commit into
base: ci_pylint_isort
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to use yaml extension as it's recommended in https://yaml.org/faq.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint-docs job is not really related to catalog

Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
on: [push]
on:
push:
paths:
- '.github/workflows/catalog.yml'
- 'catalog/**'
- 'shared/**'
jobs:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nl0: does anything besides the catalog depend on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, i don't think so

Comment on lines +3 to +6
Copy link
Member

@sir-sigurd sir-sigurd Feb 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that doesn't work well with required jobs (you can see them in repo settings -> branches -> master)
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

If a workflow is skipped due to branch filtering, path filtering, or a commit message, then checks associated with that workflow will remain in a "Pending" state. A pull request that requires those checks to be successful will be blocked from merging.

you can check registry workflow in enterprise for idea on how to implement filtering

also I suggest testing this CI stuff in a fork

test-catalog:
runs-on: ubuntu-latest
Expand Down
78 changes: 10 additions & 68 deletions .github/workflows/py-ci.yml → .github/workflows/client.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
on: [push]
on:
push:
paths:
- '.github/workflows/client.yml'
- 'api/python/**'
- 'gendocs/**'
- 'testdocs/**'
jobs:
linter:
runs-on: ubuntu-latest
Expand All @@ -13,13 +19,13 @@ jobs:
python -m pip install 'pylint==2.10.2' 'pycodestyle>=2.6.1' isort
- name: Run pylint
run: |
pylint $(find -name '*.py')
pylint $(find ./api/python/ -name '*.py')
- name: Run pycodestyle
run: |
pycodestyle $(find -name '*.py')
pycodestyle $(find ./api/python/ -name '*.py')
- name: Run isort
run: |
isort --check --diff .
isort --check --diff ./api/python/

test-gendocs:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -129,67 +135,3 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*

test-lambda:
strategy:
fail-fast: false
matrix:
path:
- access_counts
- es/indexer
- molecule
- pkgevents
- pkgpush
- pkgselect
- preview
- s3hash
- s3select
- shared
- status_reports
- tabular_preview
- transcode
python-version: ['3.8']
include:
- path: thumbnail
python-version: '3.9'
runs-on: ubuntu-latest
env:
QUILT_DISABLE_USAGE_METRICS: true
PYTHONPATH: deps
JUPYTER_PATH: deps/share/jupyter # Jupyter is not smart enough to handle custom Python paths
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# Due to behavior change in pip>=23.1 installing tifffile==0.15.1
# from thumbnail lambda fails whithout installed wheel.
# See https://github.com/pypa/pip/issues/8559.
python -m pip install wheel
if [ ${{ matrix.path }} == "shared" ]
python -m pip install -e lambdas/shared[tests]
then
python -m pip install -e lambdas/shared
python -m pip install -e lambdas/${{ matrix.path }}
fi
python -m pip install -r lambdas/${{ matrix.path }}/test-requirements.txt

# Try to simulate the lambda .zip file:
# - Use --no-deps to ensure that second-order dependencies are included in the requirements file
# - Remove "tests" directories
# - Run "strip" on shared libraries
python -m pip install -t deps --no-deps -r lambdas/${{ matrix.path }}/requirements.txt
find deps -name tests -type d -exec rm -r \{} \+
find deps \( -name '*.so.*' -o -name '*.so' \) -type f -exec strip \{} \+
- name: Pytest
run: |
pytest --cov=lambdas lambdas/${{ matrix.path }}
- uses: codecov/codecov-action@v3
env:
LAMBDA: ${{ matrix.path }}
with:
flags: lambda
name: ${{ github.job }}
env_vars: LAMBDA
90 changes: 90 additions & 0 deletions .github/workflows/lambdas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
on:
push:
paths:
- '.github/workflows/lambdas.yml'
- 'lambdas/**'
jobs:
linter:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install 'pylint==2.10.2' 'pycodestyle>=2.6.1' isort
- name: Run pylint
run: |
pylint $(find ./lambdas/ -name '*.py')
- name: Run pycodestyle
run: |
pycodestyle $(find ./lambdas/ -name '*.py')
- name: Run isort
run: |
isort --check --diff ./lambdas/

test-lambda:
strategy:
fail-fast: false
matrix:
path:
- access_counts
- es/indexer
- molecule
- pkgevents
- pkgpush
- pkgselect
- preview
- s3hash
- s3select
- shared
- status_reports
- tabular_preview
- transcode
python-version: ['3.8']
include:
- path: thumbnail
python-version: '3.9'
runs-on: ubuntu-latest
env:
QUILT_DISABLE_USAGE_METRICS: true
PYTHONPATH: deps
JUPYTER_PATH: deps/share/jupyter # Jupyter is not smart enough to handle custom Python paths
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# Due to behavior change in pip>=23.1 installing tifffile==0.15.1
# from thumbnail lambda fails whithout installed wheel.
# See https://github.com/pypa/pip/issues/8559.
python -m pip install wheel
if [ ${{ matrix.path }} == "shared" ]
python -m pip install -e lambdas/shared[tests]
then
python -m pip install -e lambdas/shared
python -m pip install -e lambdas/${{ matrix.path }}
fi
python -m pip install -r lambdas/${{ matrix.path }}/test-requirements.txt

# Try to simulate the lambda .zip file:
# - Use --no-deps to ensure that second-order dependencies are included in the requirements file
# - Remove "tests" directories
# - Run "strip" on shared libraries
python -m pip install -t deps --no-deps -r lambdas/${{ matrix.path }}/requirements.txt
find deps -name tests -type d -exec rm -r \{} \+
find deps \( -name '*.so.*' -o -name '*.so' \) -type f -exec strip \{} \+
- name: Pytest
run: |
pytest --cov=lambdas lambdas/${{ matrix.path }}
- uses: codecov/codecov-action@v3
env:
LAMBDA: ${{ matrix.path }}
with:
flags: lambda
name: ${{ github.job }}
env_vars: LAMBDA
Loading