pose2sim/.github/workflows/continuous-integration.yml

70 lines
2.3 KiB
YAML
Raw Normal View History

2022-06-13 22:04:45 +08:00
# This workflow will install Python dependencies, run tests and lint on several OS with a several versions of Python
2022-06-12 21:10:56 +08:00
# See: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
2022-06-10 23:29:01 +08:00
name: Build on Win-MacOS-Ubuntu with Python 3.8-3.11
2022-06-10 23:29:01 +08:00
on:
push:
branches: [ "main" ]
paths-ignore:
2023-11-16 20:06:50 +08:00
- 'setup.cfg'
- 'README.md'
- 'Content/**'
2022-06-10 23:29:01 +08:00
pull_request:
branches: [ "main" ]
2022-06-12 21:10:56 +08:00
permissions:
contents: read
2022-06-10 23:29:01 +08:00
jobs:
build:
2022-06-12 21:10:56 +08:00
runs-on: ${{ matrix.os }}
2022-06-10 23:29:01 +08:00
strategy:
fail-fast: false
matrix:
2023-05-04 22:35:55 +08:00
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, "3.10", "3.11"]
2022-06-12 21:10:56 +08:00
include:
- os: ubuntu-latest
path: ~/.cache/pip
2023-05-04 22:35:55 +08:00
- os: macos-latest
2022-06-13 20:37:31 +08:00
path: ~/Library/Caches/pip
2022-06-12 21:10:56 +08:00
- os: windows-latest
path: ~\AppData\Local\pip\Cache
2022-06-10 23:29:01 +08:00
steps:
2022-06-12 21:10:56 +08:00
- name: Checkout code
2024-01-27 06:43:29 +08:00
uses: actions/checkout@v4
2022-06-12 21:10:56 +08:00
2024-06-30 21:57:15 +08:00
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: pose2sim
- name: Install OpenSim with conda
2024-06-30 22:17:23 +08:00
run: |
conda create -n pose2sim python=${{ matrix.python-version }} -y
conda install -n pose2sim -c conda-forge -c defaults pip
conda install opensim-org::opensim -y
2024-06-30 21:57:15 +08:00
2024-06-30 22:17:23 +08:00
- name: Install pip dependencies
2022-06-12 21:10:56 +08:00
run: |
2024-06-30 21:57:15 +08:00
conda run -n pose2sim python -m pip install --upgrade pip
conda run -n pose2sim python -m pip install flake8 pytest
conda run -n pose2sim python -m pip install git+https://github.com/${{ github.repository }}.git@${{ github.sha }}
2022-06-12 21:10:56 +08:00
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
2024-06-30 21:57:15 +08:00
conda run -n pose2sim flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
2022-06-12 21:10:56 +08:00
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
2024-06-30 21:57:15 +08:00
conda run -n pose2sim flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
2022-06-12 21:10:56 +08:00
- name: Test with pytest
run: |
2024-04-15 21:39:32 +08:00
cd Pose2Sim/S00_Demo_BatchSession
2024-06-30 21:57:15 +08:00
conda run -n pose2sim pytest -v tests.py