Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache CI environment #280

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -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
53 changes: 39 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- 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=.
38 changes: 38 additions & 0 deletions .github/workflows/ci_cron.yml
Original file line number Diff line number Diff line change
@@ -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