From 7d68dc4c16802aa1a08c1c6cedce8a0fc5b29fd5 Mon Sep 17 00:00:00 2001 From: "Ronald I." <14822065+rilma@users.noreply.github.com> Date: Fri, 27 Oct 2023 21:31:01 +0000 Subject: [PATCH] refactor ci stage --- .github/workflows/ci.yaml | 28 ++++++++++++++++++++++++++++ tests/test.py | 20 +++++++------------- 2 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..0469a99 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,28 @@ +name: pyHWM14 Repository CI Workflow + +on: + push: + branches: [ main ] + tags: + - v*.*.* + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python_version: ["3.10"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python_version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python_version }} + - name: Install dependencies + run: | + make install + - name: Run code test in Python programs + run: | + make test \ No newline at end of file diff --git a/tests/test.py b/tests/test.py index 0fb70a3..0447ab8 100755 --- a/tests/test.py +++ b/tests/test.py @@ -1,15 +1,9 @@ -#!/usr/bin/env python -from numpy.testing import run_module_suite,assert_allclose +from unittest import TestCase from pyhwm2014 import HWM14 -def test_hwm14(): - # Single Height profile - h = HWM14( altlim=[90,200], altstp=1, ap=[-1, 35], day=323, - option=1, ut=11.66667, verbose=False, year=1993 ) - - assert_allclose([h.Uwind[92],h.Vwind[92]], - [-16.502953,-39.811909]) - - -if __name__ == '__main__': - run_module_suite() +class Test(TestCase): + def test_hwm14(self): + h = HWM14( altlim=[90,200], altstp=1, ap=[-1, 35], day=323, + option=1, ut=11.66667, verbose=False, year=1993 ) + self.assertAlmostEqual(h.Uwind[92], -16.502953, places=3) + self.assertAlmostEqual(h.Vwind[92], -39.811909, places=3) \ No newline at end of file