From bc0a663b052616e3b2359a2397fc5dd0b8ccb8a6 Mon Sep 17 00:00:00 2001 From: "Karl N. Kappler" Date: Fri, 16 Aug 2024 15:22:54 -0700 Subject: [PATCH] Add gh actions tests These were suppresed during manuscript development to conserve energy. We are re-enabling them so that the `joss` release can be shown to pass tests with the current mt_metadata, and mth5 releases. The tests.yml pins mt_metadata to 0.3.7, and mth5 to 0.4.4 - also updated path to ipynb moved from example to tutorial in yml - (and updated the filename) --- .github/workflows/tests.yml | 103 ++++++++++++++++++ ...ynb => process_cas04_single_station.ipynb} | 0 2 files changed, 103 insertions(+) create mode 100644 .github/workflows/tests.yml rename docs/tutorials/{process_cas04_single_station_h5.ipynb => process_cas04_single_station.ipynb} (100%) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..5bd03033 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,103 @@ +name: Testing + +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' +jobs: + setup-build: + name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash -l {0} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest"] + python-version: [3.8, 3.9, "3.10", "3.11"] +# python-version: ["3.10", ] + + steps: + - uses: actions/checkout@v2 + + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v2.1.1 + with: + activate-environment: aurora-test + python-version: ${{ matrix.python-version }} + + - name: Install Env + run: | + python --version + conda install -c conda-forge pytest pytest-cov certifi">=2017.4.17" pandoc + pip install -r requirements-dev.txt + pip install mt_metadata==0.3.7 + pip install mth5==0.4.4 + + - name: Install Our Package + run: | + pip install -e . + conda list + + - name: Install Jupyter and dependencies + run: | + pip install jupyter + pip install ipykernel + python -m ipykernel install --user --name aurora-test + # Install any other dependencies you need + + - name: Execute Jupyter Notebooks + run: | + jupyter nbconvert --to notebook --execute docs/examples/dataset_definition.ipynb + jupyter nbconvert --to notebook --execute docs/examples/operate_aurora.ipynb + jupyter nbconvert --to notebook --execute docs/tutorials/pole_zero_fitting/lemi_pole_zero_fitting_example.ipynb + jupyter nbconvert --to notebook --execute docs/tutorials/processing_configuration.ipynb + jupyter nbconvert --to notebook --execute docs/tutorials/process_cas04_single_station.ipynb + jupyter nbconvert --to notebook --execute docs/tutorials/synthetic_data_processing.ipynb + jupyter nbconvert --to notebook --execute tests/test_run_on_commit.ipynb + # Replace "notebook.ipynb" with your notebook's filename + +# - name: Commit changes (if any) +# run: | +# git config --local user.email "action@github.com" +# git config --local user.name "GitHub Action" +# git commit -a -m "Execute Jupyter notebook" +# git push +# if: ${{ success() }} + + + - name: Run Tests + run: | + # pytest -s -v tests/synthetic/test_fourier_coefficients.py + # pytest -s -v tests/test_general_helper_functions.py + pytest -s -v --cov=./ --cov-report=xml --cov=aurora + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + + + - name: Build Doc + if: ${{ (github.ref == 'refs/heads/main') && (matrix.python-version == '3.8')}} + run: | + cd docs + make html + cd .. + + - name: GitHub Pages + if: ${{ (github.ref == 'refs/heads/main') && (matrix.python-version == '3.8')}} + uses: crazy-max/ghaction-github-pages@v2.5.0 + with: + build_dir: docs/_build/html + # Write the given domain name to the CNAME file + # fqdn: aurora.simpeg.xyz + # Allow Jekyll to build your site + jekyll: false # optional, default is true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/tutorials/process_cas04_single_station_h5.ipynb b/docs/tutorials/process_cas04_single_station.ipynb similarity index 100% rename from docs/tutorials/process_cas04_single_station_h5.ipynb rename to docs/tutorials/process_cas04_single_station.ipynb