Revision 6948d5512d3a9b5b7db1367128f0b9c6ddc690f1 authored by FranziskaWinterstein on 13 April 2023, 12:13:27 UTC, committed by GitHub on 13 April 2023, 12:13:27 UTC
1 parent 2b88c72
Raw File
run-tests-monitor.yml
---
name: Monitor Tests
on:
  push:
    branches:
      - main
  # run the test only if the PR is to main
  # turn it on if required
  # pull_request:
  #   branches:
  #   - main
  schedule:
    - cron: '0 0 * * *'  # nightly

jobs:
  linux:
    runs-on: "ubuntu-latest"
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.8", "3.9", "3.10"]
    name: Linux Python ${{ matrix.python-version }}
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - uses: conda-incubator/setup-miniconda@v2
        with:
          activate-environment: esmvaltool
          environment-file: environment.yml
          python-version: ${{ matrix.python-version }}
          miniforge-version: "latest"
          miniforge-variant: Mambaforge
          use-mamba: true
      - shell: bash -l {0}
        run: mkdir -p test_linux_artifacts_python_${{ matrix.python-version }}
      - name: Record versions
        shell: bash -l {0}
        run: |
          mamba --version 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
          python -V 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
      - name: Install pytest-monitor
        shell: bash -l {0}
        run: pip install pytest-monitor
      - name: Install ESMValTool
        shell: bash -l {0}
        run: pip install -e .[develop] 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/install.txt
      - name: Install Julia dependencies
        shell: bash -l {0}
        run: esmvaltool install Julia
      - name: Run tests
        shell: bash -l {0}
        run: >
          pytest -n 2 -m "not installation" --db ../.pymon 2>&1
          | tee test_linux_artifacts_python_${{ matrix.python-version }}/test_report.txt
      - name: Parse monitor information
        shell: bash -l {0}
        run: python tests/parse_pymon.py
      - name: Upload artifacts
        if: ${{ always() }}  # upload artifacts even if fail
        uses: actions/upload-artifact@v2
        with:
          name: Test_Linux_python_${{ matrix.python-version }}
          path: test_linux_artifacts_python_${{ matrix.python-version }}

  osx:
    runs-on: "macos-latest"
    strategy:
      matrix:
        python-version: ["3.8", "3.9", "3.10"]
      fail-fast: false
    name: OSX Python ${{ matrix.python-version }}
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - uses: conda-incubator/setup-miniconda@v2
        with:
          activate-environment: esmvaltool
          environment-file: environment_osx.yml
          python-version: ${{ matrix.python-version }}
          miniforge-version: "latest"
          miniforge-variant: Mambaforge
          use-mamba: true
      # - name: Install libomp with homebrew
      #   run: brew install libomp
      - shell: bash -l {0}
        run: mkdir -p test_osx_artifacts_python_${{ matrix.python-version }}
      - name: Record versions
        shell: bash -l {0}
        run: |
          mamba --version 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt
          python -V 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt
      - name: Install pytest-monitor
        shell: bash -l {0}
        run: pip install pytest-monitor
      - name: Install ESMValTool
        shell: bash -l {0}
        run: >
          pip install -e .[develop] 2>&1
          | tee test_osx_artifacts_python_${{ matrix.python-version }}/install.txt
      - name: Run tests
        shell: bash -l {0}
        run: >
          pytest -n 2 -m "not installation" --db ../.pymon 2>&1
          | tee test_osx_artifacts_python_${{ matrix.python-version }}/test_report.txt
      - name: Parse monitor information
        shell: bash -l {0}
        run: python tests/parse_pymon.py
      - name: Upload artifacts
        if: ${{ always() }}  # upload artifacts even if fail
        uses: actions/upload-artifact@v2
        with:
          name: Test_OSX_python_${{ matrix.python-version }}
          path: test_osx_artifacts_python_${{ matrix.python-version }}
back to top