Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCBrammer committed Aug 5, 2024
1 parent f462b8d commit 93eb432
Showing 1 changed file with 20 additions and 72 deletions.
92 changes: 20 additions & 72 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# All CI tasks (linting, testing, building) are maintained in this workflow file
# All CI tasks (testing, building) are maintained in this workflow file
# and their inter-dependencies controlled with job-level `if` and `needs` until
# GitHub Actions allows for them to be factored out into separate, inter-dependent
# workflow files.
Expand All @@ -7,89 +7,37 @@
name: CI
on: [push, pull_request, release] # runs on all branches
env:
PYTHON_VERSION: 3.9
PYTHON_VERSION: 3.12

jobs:

lint:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Lint
run: flake8 . --exclude biopeaks/images,biopeaks/tests/testdata,biopeaks/resources.py --max-complexity=10 --ignore E303,C901,E203,W503,E501,W504,E129,W605,E371,E731


test:

needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-pip-wheels
uses: actions/cache@v2
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: |
poetry install --no-interaction --no-root
virtualenvs-create: false

- name: Install biopeaks
run: poetry install --no-interaction
run: poetry install --no-interaction --without build

- name: Test on Windows
if: matrix.os == 'windows-latest'
shell: bash -l {0}
run: |
source $VENV
pytest -v
- name: Install system dependencies for headless testing
run: sudo ./.devcontainer/install_system_dependencies.sh

- name: Test on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: | # run coverage only on Ubuntu
source $VENV
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 \
libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-xinerama0 libxcb-xfixes0 libegl1 libopengl0
xvfb-run pytest -v --cov-config=.coveragerc --cov-report=xml --cov=biopeaks
- name: Test and collect coverage
run: pytest -v --cov-config=.coveragerc --cov-report=xml --cov=biopeaks

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml

Expand All @@ -102,10 +50,10 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

Expand All @@ -117,7 +65,7 @@ jobs:

- name: Load cached venv
id: cached-pip-wheelsy
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
Expand All @@ -138,10 +86,10 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

Expand All @@ -153,7 +101,7 @@ jobs:

- name: Load cached venv
id: cached-pip-wheels
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
Expand All @@ -172,7 +120,7 @@ jobs:
--icon=biopeaks\\images\\python_icon.ico biopeaks\\__main__.py
- name: Upload executable
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: biopeaks_windows
path: dist/biopeaks.exe
Expand All @@ -187,7 +135,7 @@ jobs:
steps:

- name: Download executable
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: biopeaks_windows

Expand Down

0 comments on commit 93eb432

Please sign in to comment.