diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000000..f2eec6bb61 --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,71 @@ +name: Pylint + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + py-version: + #- 3.5 + #- 3.6 + - 3.7 + #- 3.8 + #- 3.9 + py-arch: + - x64 + mpi: + #- mpich + - openmpi + os: + - ubuntu-latest + #- ubuntu-18.04 + #- ubuntu-20.04 + #- macos-10.15 + #- macos-latest + + steps: + - uses: actions/checkout@v2 + #- name: Install MPI (${{ matrix.mpi }}) + # run: apt install -y openmpi-bin libopenmpi-dev + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.py-version }} + architecture: ${{ matrix.py-arch }} + #- name: Install prerequisites + # run: | + # apt install -y + # build-essential gfortran libgsl-dev cmake + # libfftw3-3 libfftw3-dev + # libgmp3-dev libmpfr6 libmpfr-dev + # libhdf5-serial-dev hdf5-tools + # libblas-dev liblapack-dev + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install pylint pycodestyle pydocstyle flake8 + # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + #- name: Install AMUSE + # run: | + # pip install -e . + #- name: Analyse the code with flake8 + # run: flake8 `git diff --name-only --diff-filter=ACMRTUXB main | grep -E "(.py$)"` + #- name: Analyse the code with pycodestyle + # run: pycodestyle `git diff --name-only --diff-filter=ACMRTUXB main | grep -E "(.py$)"` + #- name: Analyse the code with pydocstyle + # run: pydocstyle `git diff --name-only --diff-filter=ACMRTUXB main | grep -E "(.py$)"` + - name: Analysing the code with pylint + run: | + for file in `git diff --name-only --diff-filter=ACMRTUXB main | grep -E "(.py$)"`; do + pylint $file; + done diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000000..0be53adf5c --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,39 @@ +# 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: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest