Skip to content

Merge pull request #336 from dastra/store-author-images-locally #186

Merge pull request #336 from dastra/store-author-images-locally

Merge pull request #336 from dastra/store-author-images-locally #186

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python Pattern Submission Workflow
on:
push:
paths:
- "python-test-samples/**"
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files using defaults
id: get_changed
uses: tj-actions/changed-files@v44
with:
separator: ","
- name: Echo changed files
id: setfiles
run: |
files=${{ steps.get_changed.outputs.all_changed_files }}
echo $files
echo "FILES=$files" >> $GITHUB_OUTPUT
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Get new folder
id: setfolders
run: |
python -m pip install --upgrade pip
pip install github-action-utils
python .github/workflows/getPatternFolder.py "${{ steps.setfiles.outputs.FILES }}"
- name: Install dependencies
run: |
for folder in ${{ steps.setfolders.outputs.folders }}
do
cd $folder
pip install flake8 pytest boto3
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi
cd -
done
- name: Lint with flake8
run: |
for folder in ${{ steps.setfolders.outputs.folders }}
do
cd $folder
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
cd -
done
- name: Test with pytest
run: |
for folder in ${{ steps.setfolders.outputs.folders }}
do
cd $folder
# Set dummy values to keep botocore happy
export AWS_DEFAULT_REGION=us-east-1
export AWS_ACCESS_KEY_ID=fake
export AWS_SECRET_ACCESS_KEY=fake
pytest -s tests/unit -v
cd -
done