From 71a391b947a372c22a0c3b4a6ccad058b231b15c Mon Sep 17 00:00:00 2001 From: tourniert Date: Thu, 5 Sep 2024 17:43:23 +0200 Subject: [PATCH 1/4] add github workflows --- .github/workflows/tests.yml | 41 +++++++++++++++++++++++++++++++++++++ requirements.txt | 1 + 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..78cec83d --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,41 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + tests: + env: + PYTHONPATH: '.' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r requirements_dev.txt + - name: Lint with ruff + run: | + ruff check py4cast + - name: Integration Test with pytest + run: | + coverage run -p -m pytest tests/ + coverage run -p bin/train.py --model halfunet --model_conf config/models/halfunet32.json --dataset dummy --epochs 1 --batch_size 1 --num_pred_steps_train 1 --limit_train_batches 1 + coverage run -p bin/train.py --model hilam --dataset dummy --epochs 1 --batch_size 1 --num_pred_steps_train 1 --limit_train_batches 1 + coverage combine + coverage report --fail-under=60 diff --git a/requirements.txt b/requirements.txt index 47694166..39abc173 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,6 +25,7 @@ einops==0.7.0 torchinfo==1.8.0 tabulate==0.9.0 pytest==8.1.1 +coverage==7.6.1 onnx==1.16.1 onnxruntime==1.18.1 onnxruntime-gpu==1.18.1 From fcc8e7d71d9971043404f6b64c7001bc6f35df72 Mon Sep 17 00:00:00 2001 From: tourniert Date: Thu, 5 Sep 2024 17:48:02 +0200 Subject: [PATCH 2/4] remove workflow --- .github/workflows/tests.yml | 41 ------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 78cec83d..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,41 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - -name: Tests - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - tests: - env: - PYTHONPATH: '.' - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements_dev.txt - - name: Lint with ruff - run: | - ruff check py4cast - - name: Integration Test with pytest - run: | - coverage run -p -m pytest tests/ - coverage run -p bin/train.py --model halfunet --model_conf config/models/halfunet32.json --dataset dummy --epochs 1 --batch_size 1 --num_pred_steps_train 1 --limit_train_batches 1 - coverage run -p bin/train.py --model hilam --dataset dummy --epochs 1 --batch_size 1 --num_pred_steps_train 1 --limit_train_batches 1 - coverage combine - coverage report --fail-under=60 From 4cd6f409c48ee67cd9f64f7bbd34830854337f1a Mon Sep 17 00:00:00 2001 From: tourniert Date: Thu, 5 Sep 2024 17:53:13 +0200 Subject: [PATCH 3/4] add workflow --- .github/workflows/tests.yml | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..78cec83d --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,41 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + tests: + env: + PYTHONPATH: '.' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r requirements_dev.txt + - name: Lint with ruff + run: | + ruff check py4cast + - name: Integration Test with pytest + run: | + coverage run -p -m pytest tests/ + coverage run -p bin/train.py --model halfunet --model_conf config/models/halfunet32.json --dataset dummy --epochs 1 --batch_size 1 --num_pred_steps_train 1 --limit_train_batches 1 + coverage run -p bin/train.py --model hilam --dataset dummy --epochs 1 --batch_size 1 --num_pred_steps_train 1 --limit_train_batches 1 + coverage combine + coverage report --fail-under=60 From a098da70d7c2d41240f52cf94617217ba7336f20 Mon Sep 17 00:00:00 2001 From: tourniert Date: Fri, 6 Sep 2024 13:06:42 +0200 Subject: [PATCH 4/4] add CI badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 76f395e5..dbaa5bd1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # PY4CAST +![Unit Tests](https://github.com/meteofrance/py4cast/actions/workflows/tests.yml/badge.svg) + This project, built using **PyTorch** and **PyTorch-lightning**, is designed to train a variety of Neural Network architectures (GNNs, CNNs, Vision Transformers, ...) on various weather forecasting datasets. This is a **Work in Progress**, intended to share ideas and design concepts with partners. Developped at Météo-France by **DSM/AI Lab** and **CNRM/GMAP/PREV**.