Monitor Tests #1662
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 | |
# Required shell entrypoint to have properly configured bash shell | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
linux: | |
runs-on: "ubuntu-latest" | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
name: Linux Python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: esmvaltool | |
environment-file: environment.yml | |
python-version: ${{ matrix.python-version }} | |
miniforge-version: "latest" | |
use-mamba: true | |
- run: mkdir -p test_linux_artifacts_python_${{ matrix.python-version }} | |
- name: Record versions | |
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: Inspect environment | |
run: conda list | |
- name: Install pytest-monitor | |
run: pip install pytest-monitor | |
- name: Install ESMValTool | |
run: pip install -e .[develop] 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/install.txt | |
- name: Install Julia dependencies | |
run: esmvaltool install Julia | |
- name: Run tests | |
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 | |
run: python tests/parse_pymon.py | |
- name: Upload artifacts | |
if: ${{ always() }} # upload artifacts even if fail | |
uses: actions/upload-artifact@v4 | |
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.10", "3.11", "3.12"] | |
architecture: ["x64"] # need to force Intel, arm64 builds have issues | |
fail-fast: false | |
name: OSX Python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
architecture: ${{ matrix.architecture }} | |
activate-environment: esmvaltool | |
environment-file: environment_osx.yml | |
python-version: ${{ matrix.python-version }} | |
miniforge-version: "latest" | |
use-mamba: true | |
# - name: Install libomp with homebrew | |
# run: brew install libomp | |
- run: mkdir -p test_osx_artifacts_python_${{ matrix.python-version }} | |
- name: Record versions | |
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: Inspect environment | |
run: conda list | |
- name: Install git | |
run: mamba install -c conda-forge git | |
- name: Install pytest-monitor | |
run: pip install pytest-monitor | |
- name: Install ESMValTool | |
run: > | |
pip install -e .[develop] 2>&1 | |
| tee test_osx_artifacts_python_${{ matrix.python-version }}/install.txt | |
- name: Run tests | |
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 | |
run: python tests/parse_pymon.py | |
- name: Upload artifacts | |
if: ${{ always() }} # upload artifacts even if fail | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Test_OSX_python_${{ matrix.python-version }} | |
path: test_osx_artifacts_python_${{ matrix.python-version }} |