Skip to content

python linting

python linting #5

Workflow file for this run

name: "on-pull-request"
on:
pull_request:
branches:
- master
workflow_dispatch:
# this allows to run the workflow manually through the github dashboard
env:
HAVE_LITHOPS_CONFIG: ${{ secrets.LITHOPS_CONFIG != '' }}
LITHOPS_CONFIG_FILE: /tmp/lithops_config.yaml
jobs:
determine_runnable_test_jobs:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
outputs:
localhost: ${{ steps.script.outputs.localhost }}
ibm_cf: ${{ steps.script.outputs.ibm_cf }}
code_engine: ${{ steps.script.outputs.code_engine }}
steps:
- name: Set jobs to run
id: script
run: |
echo "localhost=true" >> $GITHUB_OUTPUT
echo "ibm_cf=false" >> $GITHUB_OUTPUT
echo "code_engine=false" >> $GITHUB_OUTPUT
localhost_tests:
runs-on: ubuntu-latest
needs: determine_runnable_test_jobs
if: needs.determine_runnable_test_jobs.outputs.localhost == 'true'
steps:
- name: Clone Lithops repository
uses: actions/checkout@v3
- name: Install Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Lithops
run: |
pip3 install -U .
- name: Run Lithops tests
run: |
lithops test -b localhost -s localhost
ibm_ce_cos_tests:
runs-on: ubuntu-latest
needs: determine_runnable_test_jobs
if: needs.determine_runnable_test_jobs.outputs.code_engine == 'true'
steps:
- name: Clone Lithops repository
uses: actions/checkout@v3
- name: Install Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Lithops
run: |
pip3 install -U .
- name: Install Lithops config
id: config
run: |
echo -n -e "${{ secrets.LITHOPS_CONFIG }}" > $LITHOPS_CONFIG_FILE
- name: Build new runtime
run: |
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
cd runtime/code_engine
lithops runtime build -f Dockerfile.githubci ${{ secrets.DOCKER_USER }}/lithops-ce-gihub-ci:${{ github.run_id }} -b code_engine
sed -i '/runtime: lithops-ce/c\ runtime: '${{ secrets.DOCKER_USER }}'/lithops-ce-gihub-ci:'${{ github.run_id }} $LITHOPS_CONFIG_FILE
- name: Run Lithops tests
run: |
lithops test -b code_engine -s ibm_cos -k
- name: Delete Lithops CE runtime
if: needs.determine_runnable_jobs.outputs.code_engine == 'true'
run: |
lithops runtime delete ${{ secrets.DOCKER_USER }}/lithops-ce-gihub-ci:${{ github.run_id }} -b code_engine -s ibm_cos
python_linting:
runs-on: ubuntu-latest
steps:
- name: Clone Lithops repository
uses: actions/checkout@v3
- name: Install Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install -U flake8
- name: Install Lithops
run: |
pip3 install -U .
- name: Lint with flake8
run: |
flake8 lithops --count --max-line-length=180 --statistics --ignore W605