diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9054169e..e334bbac 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,6 +1,3 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Python package on: [ push ] @@ -13,32 +10,49 @@ jobs: fail-fast: false matrix: python-version: ["3.10", "3.11", "3.12"] - include: - - python-version: "3.10" - numpy-version: "2.1.3" + numpy-version: ["2.1.3"] + environment-manager: ["conda", "pip"] steps: - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + if: ${{ matrix.environment-manager == 'pip' }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - if: ${{ matrix.numpy-version}} - run: python -m pip install numpy==${{ matrix.numpy-version }} - - name: Install dependencies + + - name: Set up Conda ${{ matrix.python-version }} + if: ${{ matrix.environment-manager == 'conda' }} + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: ${{ matrix.python-version }} + activate-environment: test-env + auto-activate-base: false + + - name: Install dependencies with pip + if: ${{ matrix.environment-manager == 'pip' }} run: | python -m pip install --upgrade pip + python -m pip install numpy==${{ matrix.numpy-version }} python -m pip install flake8 pytest - #python -m pip install mdtraj # removed as long as mdtraj is not supporting numpy2 + # Install mdtraj if numpy compatibility is resolved + # python -m pip install mdtraj python -m pip install . if [ -f requirements.txt ]; then pip install --upgrade -r requirements.txt; fi - #- name: Lint with flake8 - # run: | - # # 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 + + - name: Install dependencies with Conda + if: ${{ matrix.environment-manager == 'conda' }} + run: | + conda install --yes numpy=${{ matrix.numpy-version }} flake8 pytest + conda install --yes pip + pip install --upgrade pip + # Install mdtraj if numpy compatibility is resolved + # pip install mdtraj + pip install . + if [ -f requirements.txt ]; then pip install --upgrade -r requirements.txt; fi + - name: Test with pytest run: | - pytest pytim/ --doctest-modules - + pytest pytim/ --doctest-modules +