Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
26815a9
ci: add gitlab-ci.yml
Mar 24, 2025
405508e
test: add pytest fixture lenapy_paths
Mar 25, 2025
19c2e2e
ci: check notebooks
Mar 25, 2025
85d60d9
test: start adding tests
Mar 26, 2025
894d25b
test: add dummy tests
Mar 26, 2025
17f9acb
ci: update pytest
Mar 26, 2025
6efc860
test: add writers test
Mar 26, 2025
1d53f43
test: add climato test
Mar 26, 2025
69ee17b
test: add test dep
Apr 2, 2025
01d70dd
test: add lngeo tests
Apr 2, 2025
421e3ac
ci: export proxy for tests
Apr 2, 2025
41ceabb
test: add test_lngeo.test_isosurface
Apr 2, 2025
a8ea3ae
test: add test_lnocean
Apr 2, 2025
7e1bdfb
ci: add github ci
Apr 2, 2025
fed87ae
ci: add action 'publish-unit-test-result-action'
Apr 3, 2025
60a8892
ci: add doc build job
Apr 3, 2025
ab9856b
ci: add retention-days to doc artifact
Apr 3, 2025
b8210dc
refact: refactor gravi_writer
Apr 3, 2025
b33af26
test: add test_harmo
Apr 7, 2025
99257e0
test: remove some file from coverage measurements
Apr 7, 2025
3c04650
test: add test_lenapy_grace
Apr 7, 2025
1e3d895
docs: remove functions from pylint checks
Apr 14, 2025
0ebf112
ci: remove bash -l {0} from formater job
Apr 16, 2025
752b5e9
test: add pytest parameter '--overwrite_references'
Apr 17, 2025
203a433
style: add type hints
Apr 23, 2025
64e6eb7
refact: remove unused argument
Apr 23, 2025
f3697cb
test: add test_lntime
Apr 23, 2025
614fa85
test: add test_gravity
Apr 23, 2025
33e731f
test: add test_lnharmo.py
Apr 23, 2025
9729843
test: add test_lnharmo.py
Apr 23, 2025
2b27de2
test: add test_lntime_gls
Apr 24, 2025
3dc94d4
test: overwrite references if required
Apr 24, 2025
9683a36
ci: add doc generation
Apr 24, 2025
da1767d
test: allclose instead of equal
Apr 24, 2025
cf5b105
ci: 2 days artifact
Apr 25, 2025
1535ab3
doc: update doc
Apr 29, 2025
9695e3a
doc: update doc
Apr 29, 2025
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
196 changes: 196 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
name: CI Pipeline

on:
push:
branches:
- main
- develop
pull_request:
branches:
- '**'

jobs:
build-env:
name: Build Conda Environment
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: lenapy_env
environment-file: environment.yml
auto-activate-base: false

- name: Cache Conda environment
uses: actions/cache@v4
with:
path: /usr/share/miniconda/envs/lenapy_env
key: conda-${{ runner.os }}-${{ hashFiles('environment.yml') }}
restore-keys: |
conda-${{ runner.os }}-

formater:
name: Code Formatting Check
runs-on: ubuntu-latest
needs: build-env
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Dependencies
shell: bash -l {0}
run: pip install -e .[formatter]

- name: Run Black & Isort
run: |
black --check --diff lenapy
isort lenapy --check --diff

pytest:
name: Run Pytest
runs-on: ubuntu-latest
needs: build-env
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: false
activate-environment: lenapy_env

- name: Restore Conda environment
uses: actions/cache@v4
with:
path: /usr/share/miniconda/envs/lenapy_env
key: conda-${{ runner.os }}-${{ hashFiles('environment.yml') }}

- name: Run Pytest with Coverage
shell: bash -l {0}
run: |
pip install -e .[test]
pytest -s tests --cov=lenapy --cov-report=xml:.ci-reports/coverage.xml --cov-report html:cov_html --cov-report=term --junitxml=pytest-results.xml

- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
.ci-reports/
cov_html/
pytest-results.xml
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: pytest-results.xml

test_notebooks:
name: Test Jupyter Notebooks
runs-on: ubuntu-latest
needs: build-env
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: false
activate-environment: lenapy_env

- name: Restore Conda environment
uses: actions/cache@v4
with:
path: /usr/share/miniconda/envs/lenapy_env
key: conda-${{ runner.os }}-${{ hashFiles('environment.yml') }}

- name: Install Notebook Dependencies
shell: bash -l {0}
run: |
pip install -e .[test]
pip install -e .[notebook]

- name: Run Pytest on Notebooks
shell: bash -l {0}
run: |
pytest --nbmake --nbmake-kernel=python3 doc/tutorials/

pylint_analysis:
name: Pylint Code Analysis
runs-on: ubuntu-latest
needs: build-env
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Dependencies
shell: bash -l {0}
run: pip install -e .[quality]

- name: Run Pylint
shell: bash -l {0}
run: |
pylint --recursive=y --disable=all --fail-under=10 --enable=too-many-statements,too-many-nested-blocks lenapy

mccabe_analysis:
name: McCabe Complexity Analysis
runs-on: ubuntu-latest
needs: build-env
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: lenapy
auto-activate-base: false

- name: Install Quality Tools
shell: bash -l {0}
run: pip install .[quality]

- name: Run McCabe Complexity Check
shell: bash -l {0}
run: ./continuous_integration/scripts/check_mccabe_complexity.sh 25 lenapy

build_doc:
name: Build sphinx documentation
runs-on: ubuntu-latest
needs: build-env
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: false
activate-environment: lenapy_env

- name: Restore Conda environment
uses: actions/cache@v4
with:
path: /usr/share/miniconda/envs/lenapy_env
key: conda-${{ runner.os }}-${{ hashFiles('environment.yml') }}

- name: Install documentation dependencies
shell: bash -l {0}
run: pip install .[doc]
- name: Build doc
shell: bash -l {0}
run: |
conda install pandoc
sphinx-build -b html doc doc/build

- name: Upload doc as artefact
uses: actions/upload-artifact@v4
with:
name: doc-build
path: |
doc/build
retention-days: 7
133 changes: 133 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH

stages:
- init
- quality
- documentation

# Default configuration for all jobs
default:
tags:
- Usine_Logicielle
timeout: 30 minutes

variables:
DEBUG:
value: 'false'
description: "Afficher des logs supplémentaires"

TAG_IMAGE_CONDA: "publicremotes-docker/continuumio/miniconda3:23.5.2-0"
TAG_IMAGE_SONAR: "publicremotes-docker/sonarsource/sonar-scanner-cli:4.5"
CI: "true"
JFROG_CLI_HOME_DIR: ".jfrog/"
JFROG_CLI_TEMP_DIR: ".jfrog_tmp"
JFROG_VERSION: "v2/2.14.0"
JFROG_OS: "jfrog-cli-linux-amd64"
JFROG_CLI_BUILD_NAME: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_SLUG}_gitlab-ci"
JFROG_CLI_BUILD_NUMBER: "${CI_PIPELINE_ID}"

ARTIFACTORY_BUILD_URL: "https://${artifactory_host}/artifactory/webapp/#/builds/${JFROG_CLI_BUILD_NAME}/${JFROG_CLI_BUILD_NUMBER}"
CI_TEMPLATE_REGISTRY_HOST: "${ARTIFACTORY_HOST}/publicremotes-docker"
PIP_INDEX_URL: "https://${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN}@${ARTIFACTORY_HOST}/artifactory/api/pypi/pypi/simple"
PIP_CERT: "${CNES_CERTIFICATE}"
PIP_CACHE_DIR: ".pip-cache/"
CONDA_ENVS_DIRS: ".conda/envs"
CONDA_SSL_VERIFY: "${CNES_CERTIFICATE}"
PIP_SSL_VERIFY: "${CNES_CERTIFICATE}"
REQUESTS_CA_BUNDLE: "${CNES_CERTIFICATE}"

build-env:
stage: init
image: ${ARTIFACTORY_HOST}/${TAG_IMAGE_CONDA}
before_script:
- export no_proxy=$NO_PROXY
- export http_proxy=$HTTP_PROXY
- export https_proxy=$HTTP_PROXY
- mkdir -p ${CONDA_ENVS_DIRS}
- pip install conda-lock
script:
- conda-lock install --name lenapy_env conda-lock.yml
timeout: 15 minutes
artifacts:
untracked: true
expire_in: 1 day

formater:
stage: quality
image: ${ARTIFACTORY_HOST}/${TAG_IMAGE_CONDA}
before_script:
- source activate lenapy_env
- pip install .[formatter]
script:
- python -m black --check --diff lenapy
- python -m isort lenapy --check --diff

pytest:
stage: quality
image: ${ARTIFACTORY_HOST}/${TAG_IMAGE_CONDA}
before_script:
- export no_proxy=$NO_PROXY
- export http_proxy=$HTTP_PROXY
- export https_proxy=$HTTP_PROXY
script:
- source activate lenapy_env
- pip install -e .[test]
- pytest -s tests --cov=lenapy --cov-report=xml:.ci-reports/coverage.xml --cov-report html:cov_html --cov-report=term --junitxml=.ci-reports/junit-report.xml
artifacts:
when: always
paths:
- ./.ci-reports/
- ./cov_html/
expire_in: 1 day

test_notebooks:
stage: quality
image: ${ARTIFACTORY_HOST}/${TAG_IMAGE_CONDA}
script:
- source activate lenapy_env
- pip install -e .[test]
- pip install -e .[notebook]
- pytest --nbmake --nbmake-kernel=python3 doc/tutorials/

pylint_analysis:
stage: quality
image: ${ARTIFACTORY_HOST}/${TAG_IMAGE_CONDA}
script:
- source activate lenapy_env
- pip install .[quality]
- pylint --recursive=y --disable=all --fail-under=10 --enable=too-many-statements,too-many-nested-blocks lenapy | tee pylint_report.txt
artifacts:
when: always
paths:
- pylint_report.txt
expire_in: 1 day

mccabe_analysis:
stage: quality
image: ${ARTIFACTORY_HOST}/${TAG_IMAGE_CONDA}
script:
- source activate lenapy_env
- pip install .[quality]
- ./continuous_integration/scripts/check_mccabe_complexity.sh 25 lenapy lenapy/readers/ocean.py lenapy/plots/plotting.py

build_doc:
stage: documentation
image: ${ARTIFACTORY_HOST}/${TAG_IMAGE_CONDA}
before_script:
- source activate lenapy_env
- pip install .[doc]
script:
- conda install pandoc
- sphinx-build -b html doc doc/build
artifacts:
when: always
paths:
- doc/build
expire_in: 2 day
Loading
Loading