Skip to content

Commit

Permalink
Update github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
JosepSampe committed May 13, 2024
1 parent 5e98883 commit 217fd72
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "functional-tests"
name: IBM CE Tests

on:
workflow_dispatch:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Run Lithops tests
run: |
cd lithops/tests
pytest -o log_cli=true --log-cli-level=DEBUG --backend localhost --storage localhost
pytest -v --backend localhost --storage localhost
ibm_ce_cos_tests:
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Run Lithops tests
run: |
cd lithops/tests
pytest -o log_cli=true --log-cli-level=DEBUG --backend code_engine --storage ibm_cos
pytest -v --backend code_engine --storage ibm_cos
- name: Delete Lithops CE runtime
if: needs.determine_runnable_test_jobs.outputs.code_engine == 'true'
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/python-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Python Linting

on:
push:
branches:
- master
paths:
- 'setup.py'
- 'lithops/**'

pull_request:
branches:
- master
paths:
- 'setup.py'
- 'lithops/**'

workflow_dispatch:
# this allows to run the workflow manually through the github dashboard

jobs:

python_linting:
runs-on: ubuntu-latest

steps:
- name: Clone Lithops repository
uses: actions/checkout@v4

- name: Install Python 3.10
uses: actions/setup-python@v5
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,W503
100 changes: 100 additions & 0 deletions .github/workflows/tests-all-os.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Tests all OS

on:
workflow_dispatch:
# this allows to run the workflow manually through the github dashboard

jobs:
localhost_tests:
runs-on: ${{ matrix.os }}
timeout-minutes: 6
env:
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: YES

strategy:
fail-fast: True
matrix:
include:
# Linux
- os: ubuntu-20.04
python-version: "3.6"
- os: ubuntu-22.04
python-version: "3.7"
- os: ubuntu-22.04
python-version: "3.8"
- os: ubuntu-22.04
python-version: "3.9"
- os: ubuntu-22.04
python-version: "3.10"
- os: ubuntu-22.04
python-version: "3.11"
- os: ubuntu-22.04
python-version: "3.12"

# macOS
- os: macos-12
python-version: "3.7"
- os: macos-13
python-version: "3.8"
- os: macos-14
python-version: "3.9"
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
- os: macos-14
python-version: "3.12"

# Windows
- os: windows-2022
python-version: "3.7"
- os: windows-2022
python-version: "3.8"
- os: windows-2022
python-version: "3.9"
- os: windows-2022
python-version: "3.10"
- os: windows-2022
python-version: "3.11"
- os: windows-2022
python-version: "3.12"

steps:
- name: Clone Lithops repository
uses: actions/checkout@v4

- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Lithops
run: |
pip3 install -U .[tests]
- name: Create Lithops config file
run: |
mkdir -p $HOME/.lithops
echo "lithops:" >> $HOME/.lithops/config
echo " monitoring_interval: 0.1" >> $HOME/.lithops/config
echo " log_level: DEBUG" >> $HOME/.lithops/config
echo " include_modules: None" >> $HOME/.lithops/config
echo "localhost:" >> $HOME/.lithops/config
echo " version: 2" >> $HOME/.lithops/config
- name: Run Lithops tests
run: |
cd lithops/tests
pytest -v --durations=0 --backend localhost --storage localhost
- name: Display last 500 lines of the Lithops log file
if: cancelled() || failure()
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
tail -n 500 /tmp/lithops-runner/localhost-runner.log
elif [ "$RUNNER_OS" == "macOS" ]; then
tail -n 500 $TMPDIR/lithops-runner/localhost-runner.log
elif [ "$RUNNER_OS" == "Windows" ]; then
tail -n 500 "C:\Users\RUNNER~1\AppData\Local\Temp\lithops-root\localhost-runner.log"
fi
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
name: "on-pull-request"
name: Tests

on:
push:
branches:
- master
paths:
- 'setup.py'
- 'lithops/**'

pull_request:
branches:
- master
paths:
- 'setup.py'
- 'lithops/**'

workflow_dispatch:
# this allows to run the workflow manually through the github dashboard

Expand All @@ -16,6 +23,7 @@ jobs:
localhost_tests:
runs-on: ubuntu-22.04
timeout-minutes: 5

strategy:
fail-fast: false
matrix:
Expand All @@ -37,29 +45,4 @@ jobs:
- name: Run Lithops tests
run: |
cd lithops/tests
pytest -o log_cli=true --log-cli-level=DEBUG --backend localhost --storage localhost
python_linting:
runs-on: ubuntu-latest

steps:
- name: Clone Lithops repository
uses: actions/checkout@v4

- name: Install Python 3.10
uses: actions/setup-python@v5
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,W503
pytest -v --backend localhost --storage localhost
4 changes: 1 addition & 3 deletions lithops/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def setup_global(request):
backend = config.getoption("--backend")
storage = config.getoption("--storage")
region = config.getoption("--region")
debug = config.getoption("--debug")

config_data = None

Expand All @@ -36,14 +35,13 @@ def setup_global(request):
raise FileNotFoundError(f"The provided config file '{config_file}' does not exist")

config_ow = {'lithops': {}, 'backend': {}}
config_ow['lithops']['log_level'] = 'DEBUG'
if storage:
config_ow['lithops']['storage'] = storage
if storage == 'localhost':
config_ow['lithops']['monitoring_interval'] = 0.1
if backend:
config_ow['lithops']['backend'] = backend
if debug:
config_ow['lithops']['log_level'] = 'DEBUG'
if region:
config_ow['backend']['region'] = region

Expand Down

0 comments on commit 217fd72

Please sign in to comment.