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 821404e commit 808ad23
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 69 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.

9 changes: 9 additions & 0 deletions .github/actions/setup_testdata/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Setup xtgeo testdata
description: Set up the xtgeo test environment

runs:
using: "composite"
steps:
- name: Install test data
shell: bash
run: git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata
25 changes: 25 additions & 0 deletions .github/actions/setup_xtgeo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Setup xtgeo
description: Set up the xtgeo test environment

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

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

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

- name: Build and install xtgeo
shell: bash
run: |
pip install -U pip
pip install ".[dev]"
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
34 changes: 23 additions & 11 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
name: linting
name: Linting

on: [push, pull_request]

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@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
fetch-depth: 0

- name: Setup xtgeo
uses: "./.github/actions/setup_xtgeo"
with:
python-version: 3.11

- 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
51 changes: 39 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,49 +23,76 @@ jobs:
python-version: 3.11
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: "./.github/actions/test_setup"

- name: Setup xtgeo
uses: "./.github/actions/setup_xtgeo"
with:
python-version: ${{ matrix.python-version }}
- name: Run test
run: python -m pytest --disable-warnings -x --hypothesis-profile ci-fast

- name: Setup testdata
uses: "./.github/actions/setup_testdata"

- name: Run fast tests
run: pytest --disable-warnings -x --hypothesis-profile ci-fast

hypothesis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: "./.github/actions/test_setup"

- name: Setup xtgeo
uses: "./.github/actions/setup_xtgeo"
with:
python-version: 3.9

- name: Setup testdata
uses: "./.github/actions/setup_testdata"

- 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
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: "./.github/actions/test_setup"

- name: Setup xtgeo
uses: "./.github/actions/setup_xtgeo"
with:
python-version: 3.9

- name: Setup testdata
uses: "./.github/actions/setup_testdata"

- 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
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: "./.github/actions/test_setup"

- name: Setup xtgeo
uses: "./.github/actions/setup_xtgeo"
with:
python-version: 3.9
- name: "Install codecov"
run: pip install pytest-cov

- name: Setup testdata
uses: "./.github/actions/setup_testdata"


- 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 808ad23

Please sign in to comment.