Skip to content

Commit

Permalink
[Github Actions] Compress all bash shell setters into one default opt…
Browse files Browse the repository at this point in the history
…ion per workflow (#3315)
  • Loading branch information
valeriupredoi committed Aug 8, 2023
1 parent 9485a64 commit 430ee45
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 142 deletions.
46 changes: 18 additions & 28 deletions .github/workflows/install-from-conda.yml
Expand Up @@ -9,6 +9,11 @@ on:
schedule:
- cron: '0 4 * * *'

# Required shell entrypoint to have properly configured bash shell
defaults:
run:
shell: bash -l {0}

jobs:
linux:
runs-on: "ubuntu-latest"
Expand All @@ -24,20 +29,16 @@ jobs:
miniforge-version: "latest"
miniforge-variant: Mambaforge
use-mamba: true
- shell: bash -l {0}
run: mkdir -p conda_install_linux_artifacts_python_${{ matrix.python-version }}
- run: mkdir -p conda_install_linux_artifacts_python_${{ matrix.python-version }}
- name: Record versions
shell: bash -l {0}
run: |
mamba --version 2>&1 | tee conda_install_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
which conda 2>&1 | tee conda_install_linux_artifacts_python_${{ matrix.python-version }}/conda_path.txt
which mamba 2>&1 | tee -a conda_install_linux_artifacts_python_${{ matrix.python-version }}/conda_path.txt
python -V 2>&1 | tee conda_install_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
- name: Install ESMValTool
shell: bash -l {0}
run: mamba install esmvaltool 2>&1 | tee conda_install_linux_artifacts_python_${{ matrix.python-version }}/install.txt
- name: Verify installation
shell: bash -l {0}
run: |
esmvaltool --help
esmvaltool version 2>&1 | tee conda_install_linux_artifacts_python_${{ matrix.python-version }}/version.txt
Expand Down Expand Up @@ -65,31 +66,20 @@ jobs:
# python-version: ${{ matrix.python-version }}
# miniconda-version: "latest"
# channels: conda-forge
# - shell: bash -l {0}
# run: mkdir -p conda_install_osx_artifacts_python_${{ matrix.python-version }}
# - shell: bash -l {0}
# run: conda --version 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt
# - shell: bash -l {0}
# run: which conda 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/conda_path.txt
# - shell: bash -l {0}
# run: python -V 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt
# - run: mkdir -p conda_install_osx_artifacts_python_${{ matrix.python-version }}
# - run: conda --version 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt
# - run: which conda 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/conda_path.txt
# - run: python -V 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt
# # ncurses needs to be from conda-forge and not main channel
# # for now it's turned off since we're not testing R/Julia installs
# # - shell: bash -l {0}
# # run: conda uninstall -y ncurses
# # - shell: bash -l {0}
# # run: conda list ncurses
# # - shell: bash -l {0}
# # run: conda install -y conda-forge::ncurses
# # - shell: bash -l {0}
# # run: conda list ncurses
# - shell: bash -l {0}
# #run: conda install esmvaltool --no-update-deps 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt
# run: conda install esmvaltool-python esmvaltool-ncl 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt
# - shell: bash -l {0}
# run: esmvaltool --help
# - shell: bash -l {0}
# run: esmvaltool version 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/version.txt
# # - run: conda uninstall -y ncurses
# # - run: conda list ncurses
# # - run: conda install -y conda-forge::ncurses
# # - run: conda list ncurses
# - run: conda install esmvaltool --no-update-deps 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt
# - run: conda install esmvaltool-python esmvaltool-ncl 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt
# - run: esmvaltool --help
# - run: esmvaltool version 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/version.txt
# - name: Upload artifacts
# if: ${{ always() }} # upload artifacts even if fail
# uses: actions/upload-artifact@v2
Expand Down
76 changes: 17 additions & 59 deletions .github/workflows/install-from-condalock-file.yml
Expand Up @@ -20,6 +20,11 @@ on:
schedule:
- cron: '0 0 * * *'

# Required shell entrypoint to have properly configured bash shell
defaults:
run:
shell: bash -l {0}

jobs:
linux:
runs-on: "ubuntu-latest"
Expand All @@ -38,68 +43,21 @@ jobs:
python-version: ${{ matrix.python-version }}
miniconda-version: "latest"
channels: conda-forge
- shell: bash -l {0}
run: mkdir -p source_install_linux_artifacts_python_${{ matrix.python-version }}
- shell: bash -l {0}
run: conda --version 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
- shell: bash -l {0}
run: which python
- shell: bash -l {0}
run: python -V 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
- shell: bash -l {0}
run: conda create --name esmvaltool-fromlock --file conda-linux-64.lock
- shell: bash -l {0}
run: which python
- shell: bash -l {0}
run: pip --version
- shell: bash -l {0}
run: pip install -e .[develop]
- shell: bash -l {0}
run: esmvaltool --help
- shell: bash -l {0}
run: esmvaltool version 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/version.txt
- shell: bash -l {0}
run: flake8
- shell: bash -l {0}
run: pytest -n 2 -m "not installation"
- run: mkdir -p source_install_linux_artifacts_python_${{ matrix.python-version }}
- run: conda --version 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
- run: which python
- run: python -V 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
- run: conda create --name esmvaltool-fromlock --file conda-linux-64.lock
- run: which python
- run: pip --version
- run: pip install -e .[develop]
- run: esmvaltool --help
- run: esmvaltool version 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/version.txt
- run: flake8
- run: pytest -n 2 -m "not installation"
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
uses: actions/upload-artifact@v2
with:
name: Source_Install_Linux_python_${{ matrix.python-version }}
path: source_install_linux_artifacts_python_${{ matrix.python-version }}

# osx:
# runs-on: "macos-latest"
# strategy:
# matrix:
# python-version: ["3.9", "3.10", "3.11"]
# fail-fast: false
# name: OSX Python ${{ matrix.python-version }}
# steps:
# - uses: actions/checkout@v2
# - uses: conda-incubator/setup-miniconda@v2
# with:
# activate-environment: esmvaltool
# environment-file: environment.yml
# python-version: ${{ matrix.python-version }}
# miniconda-version: "latest"
# channels: conda-forge
# - shell: bash -l {0}
# run: mkdir -p source_install_osx_artifacts_python_${{ matrix.python-version }}
# - shell: bash -l {0}
# run: conda --version 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt
# - shell: bash -l {0}
# run: python -V 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt
# - shell: bash -l {0}
# run: pip install -e .[develop] 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt
# - shell: bash -l {0}
# run: esmvaltool --help
# - shell: bash -l {0}
# run: esmvaltool version 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/version.txt
# - name: Upload artifacts
# if: ${{ always() }} # upload artifacts even if fail
# uses: actions/upload-artifact@v2
# with:
# name: Source_Install_OSX_python_${{ matrix.python-version }}
# path: source_install_osx_artifacts_python_${{ matrix.python-version }}
29 changes: 12 additions & 17 deletions .github/workflows/install-from-source.yml
Expand Up @@ -9,6 +9,11 @@ on:
schedule:
- cron: '0 0 * * *'

# Required shell entrypoint to have properly configured bash shell
defaults:
run:
shell: bash -l {0}

jobs:
linux:
runs-on: "ubuntu-latest"
Expand All @@ -29,18 +34,14 @@ jobs:
miniforge-version: "latest"
miniforge-variant: Mambaforge
use-mamba: true
- shell: bash -l {0}
run: mkdir -p source_install_linux_artifacts_python_${{ matrix.python-version }}
- run: mkdir -p source_install_linux_artifacts_python_${{ matrix.python-version }}
- name: Record versions
shell: bash -l {0}
run: |
mamba --version 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
python -V 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
- name: Install
shell: bash -l {0}
run: pip install -e .[develop] 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/install.txt
- name: Verify installation
shell: bash -l {0}
run: |
esmvaltool --help
esmvaltool version 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/version.txt
Expand Down Expand Up @@ -70,18 +71,12 @@ jobs:
# python-version: ${{ matrix.python-version }}
# miniconda-version: "latest"
# channels: conda-forge
# - shell: bash -l {0}
# run: mkdir -p source_install_osx_artifacts_python_${{ matrix.python-version }}
# - shell: bash -l {0}
# run: conda --version 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt
# - shell: bash -l {0}
# run: python -V 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt
# - shell: bash -l {0}
# run: pip install -e .[develop] 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt
# - shell: bash -l {0}
# run: esmvaltool --help
# - shell: bash -l {0}
# run: esmvaltool version 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/version.txt
# - run: mkdir -p source_install_osx_artifacts_python_${{ matrix.python-version }}
# - run: conda --version 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt
# - run: python -V 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt
# - run: pip install -e .[develop] 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt
# - run: esmvaltool --help
# - run: esmvaltool version 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/version.txt
# - name: Upload artifacts
# if: ${{ always() }} # upload artifacts even if fail
# uses: actions/upload-artifact@v2
Expand Down
22 changes: 7 additions & 15 deletions .github/workflows/run-tests-monitor.yml
Expand Up @@ -12,6 +12,11 @@ on:
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"
Expand All @@ -32,29 +37,22 @@ jobs:
miniforge-version: "latest"
miniforge-variant: Mambaforge
use-mamba: true
- shell: bash -l {0}
run: mkdir -p test_linux_artifacts_python_${{ matrix.python-version }}
- 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
Expand Down Expand Up @@ -84,28 +82,22 @@ jobs:
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 }}
- 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
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/test-development.yml
Expand Up @@ -15,6 +15,11 @@ on:
schedule:
- cron: '0 0 * * *'

# Required shell entrypoint to have properly configured bash shell
defaults:
run:
shell: bash -l {0}

jobs:
linux:
runs-on: "ubuntu-latest"
Expand All @@ -35,31 +40,24 @@ jobs:
miniforge-version: "latest"
miniforge-variant: Mambaforge
use-mamba: true
- shell: bash -l {0}
run: mkdir -p develop_test_linux_artifacts_python_${{ matrix.python-version }}
- run: mkdir -p develop_test_linux_artifacts_python_${{ matrix.python-version }}
- name: Record versions
shell: bash -l {0}
run: |
mamba --version 2>&1 | tee develop_test_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
python -V 2>&1 | tee develop_test_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
- name: Install ESMValTool
shell: bash -l {0}
run: pip install -e .[develop] 2>&1 | tee develop_test_linux_artifacts_python_${{ matrix.python-version }}/install.txt
- name: Install Julia dependencies
shell: bash -l {0}
run: esmvaltool install Julia
- name: Install development version of ESMValCore
shell: bash -l {0}
run: |
cd ..
git clone https://github.com/ESMValGroup/ESMValCore.git
cd ESMValCore
pip install -e .[develop]
- name: Run flake8
shell: bash -l {0}
run: flake8
- name: Run tests
shell: bash -l {0}
run: pytest -n 2 -m "not installation" 2>&1 | tee develop_test_linux_artifacts_python_${{ matrix.python-version }}/test_report.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
Expand Down

0 comments on commit 430ee45

Please sign in to comment.