Skip to content

Commit

Permalink
CLN: Update ci workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mferrera committed Oct 2, 2023
1 parent d5f9a5a commit 9025259
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
exclude = docs/conf.py, src/xtgeo/cxtgeo/*.py, .eggs, _skbuild, tests/**/snapshots
max-line-length = 88
ignore = E402, W503, E203, C901
exclude = docs/conf.py, src/xtgeo/cxtgeo/*.py, .eggs, tests/**/snapshots, _theversion.py
23 changes: 0 additions & 23 deletions .github/actions/build-xtgeo/action.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/actions/test_setup/action.yml

This file was deleted.

12 changes: 7 additions & 5 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ jobs:
build_docs:
name: Build docs
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: "./.github/actions/build-xtgeo"
- uses: actions/checkout@v4
with:
python-version: 3.9
- name: Install doc requirements
run: pip install -r requirements/requirements_docs.txt
fetch-depth: 0

- name: Install xtgeo
run: pip install ".[docs]"

- name: Build docs
run: sphinx-build -W docs tmp/docs
30 changes: 18 additions & 12 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
name: linting
name: Linting

on: [push, pull_request]

jobs:
linting:
runs-on: ubuntu-latest
uses: ./.github/workflows/setup_tests.yml
with:
python-version: 3.11
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Check black style and linting
run: |
pip install black
pip freeze
black --check *.py src tests --extend-exclude tests/**/snapshots --extend-exclude src/xtgeo/grid3d/grid_properties.py
pip install flake8
flake8 src tests
- name: List dependencies
run: pip freeze

- name: Lint with isort
if: ${{ always() }}
run: isort --check-only src tests

- name: Lint with black
if: ${{ always() }}
run: black src tests

- name: Lint with flake8
if: ${{ always() }}
run: flake8 src tests
29 changes: 29 additions & 0 deletions .github/workflows/setup_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Setup tests
description: Set up the xtgeo test environment

on:
workflow_call:
inputs:
python-version:
required: true
type: string

runs:
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Install test data
run: git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata

- name: Build and install xtgeo
run: |
pip install -U pip
pip install ".[dev]"
49 changes: 21 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,43 @@ jobs:
- os: windows-latest
python-version: 3.11
runs-on: ${{ matrix.os }}
uses: ./.github/workflows/setup_tests.yml
with:
python-version: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: "./.github/actions/test_setup"
with:
python-version: ${{ matrix.python-version }}
- name: Run test
run: python -m pytest --disable-warnings -x --hypothesis-profile ci-fast
- name: Run fast tests
run: pytest --disable-warnings -x --hypothesis-profile ci-fast

hypothesis:
runs-on: ubuntu-latest
uses: ./.github/workflows/setup_tests.yml
with:
python-version: 3.9
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: "./.github/actions/test_setup"
with:
python-version: 3.9

- name: Run just hypothesis tests with more examples
run: python -m pytest --disable-warnings -x -m hypothesis --hypothesis-profile ci --generate-plots

big:
runs-on: ubuntu-latest
uses: ./.github/workflows/setup_tests.yml
with:
python-version: 3.9
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: "./.github/actions/test_setup"
with:
python-version: 3.9
- name: Run just tests marked big
run: XTG_BIGTEST=1 python -m pytest --disable-warnings -x -m bigtest --hypothesis-profile ci --generate-plots

codecov:
runs-on: ubuntu-latest
uses: ./.github/workflows/setup_tests.yml
with:
python-version: 3.9
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: "./.github/actions/test_setup"
with:
python-version: 3.9
- name: "Install codecov"
run: pip install pytest-cov

- name: Generate coverage report
run: pytest tests --doctest-modules --generate-plots --disable-warnings --cov=xtgeo --hypothesis-profile ci-fast --cov-report=xml:xtgeocoverage.xml;

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ pip-wheel-metadata/
.vscode/
.venv*/
.nfs*
tmp/

0 comments on commit 9025259

Please sign in to comment.