diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..3b645097 --- /dev/null +++ b/.flake8 @@ -0,0 +1,22 @@ +# flake8 does not support pyproject.toml (https://github.com/PyCQA/flake8/issues/234) + +[flake8] +select = F, W, E, C +# We should set max line length lower eventually +max-line-length = 130 +exclude = + docs, + .tox, + .eggs, + build +ignore = + F401,F821,F841,E122,E126,E127,E402,E501,E741 + # F401, # imported but unused + # F821, # undefined name + # F841, # local variable assigned but never used + # E122, # continuation line missing indentation or outdented + # E126, # continuation line over-indented for hanging indent + # E127, # continuation line over-indented for visual indent + # E402, # module level import not at top of file + # E501, # line too long (103 > 79 characters) + # E741, # ambiguous variable name diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f0d2e56..a72bd987 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,22 +3,47 @@ name: pysiaf CI -on: [push, pull_request] +on: [ push, pull_request ] jobs: - build: - - runs-on: ubuntu-latest + test: + name: test (${{ matrix.os }}, Python ${{ matrix.python }}) + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11"] - + os: [ ubuntu-latest ] + python: [ "3.9", "3.10", "3.11" ] + include: + - os: macos-latest + python: "3.11" + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + cache: 'pip' + cache-dependency-path: 'pyproject.toml' + - uses: actions/cache@v3 + with: + path: ${{ env.pythonLocation }} + key: test-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml', '**/setup.*') }} + - run: python -m pip install . pytest pytest-xdist + - run: pip freeze + - run: pytest -n auto + test_with_coverage: + name: run tests with coverage + needs: [ test ] + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: 'pyproject.toml' - - run: pip install ".[test]" - - run: pytest \ No newline at end of file + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + - uses: actions/cache@v3 + with: + path: ${{ env.pythonLocation }} + key: test-coverage-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml', '**/setup.*') }} + - run: pip install -e ".[test]" pytest-xdist pytest-cov + - run: pip freeze + - run: pytest -n auto --cov-report=xml --cov-report=term-missing --cov=. diff --git a/.github/workflows/ci_cron.yml b/.github/workflows/ci_cron.yml new file mode 100644 index 00000000..a2046cfd --- /dev/null +++ b/.github/workflows/ci_cron.yml @@ -0,0 +1,38 @@ + +name: Weekly cron + +on: + schedule: + # Weekly Monday 6AM build + - cron: "0 0 * * 1" + workflow_dispatch: + +jobs: + test: + name: test (${{ matrix.os }}, Python ${{ matrix.python }}) + needs: [ style ] + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: macos-latest + python: "3.9" + - os: macos-latest + python: "3.10" + - os: ubuntu-latest + python: "3.12-dev" + - os: macos-latest + python: "3.12-dev" + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - uses: actions/cache@v3 + with: + path: ${{ env.pythonLocation }} + key: test-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml', '**/setup.*') }} + - run: python -m pip install . pytest pytest-xdist + - run: pip freeze + - run: pytest -n auto