Install from PyPi #1789
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
# Install esmvalcore from PyPi on different OS's | |
# and different Python version; test locally with | |
# act: https://github.com/nektos/act | |
# Example how to setup conda workflows: | |
# https://github.com/marketplace/actions/setup-miniconda | |
# Notes: | |
# - you can group commands with | delimiter (or &&) but those will be run | |
# in one single call; declaring the shell variable makes the action run each | |
# command separately (better for debugging); | |
# - can try multiple shells eg pwsh or cmd /C CALL {0} (but overkill for now!); | |
# TODO: read the cron tasking documentation: | |
# https://www.netiq.com/documentation/cloud-manager-2-5/ncm-reference/data/bexyssf.html | |
name: Install from PyPi | |
# runs on a push on main and at the end of every day | |
on: | |
# triggering on push without branch name will run tests every time | |
# there is a push on any branch | |
# turn it on only if needed | |
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 * * *' | |
# Required shell entrypoint to have properly configured bash shell | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
linux: | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
# fail-fast set to False allows all other tests | |
# in the workflow to run regardless of any fail | |
fail-fast: false | |
name: Linux Python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: esmvalcore | |
environment-file: environment.yml | |
python-version: ${{ matrix.python-version }} | |
miniforge-version: "latest" | |
use-mamba: true | |
- run: mkdir -p pip_install_linux_artifacts_python_${{ matrix.python-version }} | |
- name: Record versions | |
run: | | |
mamba --version 2>&1 | tee pip_install_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt | |
python -V 2>&1 | tee pip_install_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt | |
pip -V 2>&1 | tee pip_install_linux_artifacts_python_${{ matrix.python-version }}/pip_version.txt | |
- name: Install | |
run: pip install esmvalcore 2>&1 | tee pip_install_linux_artifacts_python_${{ matrix.python-version }}/install.txt | |
- name: Verify installation | |
run: | | |
esmvaltool --help | |
esmvaltool version 2>&1 | tee pip_install_linux_artifacts_python_${{ matrix.python-version }}/version.txt | |
- name: Upload artifacts | |
if: ${{ always() }} # upload artifacts even if fail | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PIP_Install_Linux_python_${{ matrix.python-version }} | |
path: pip_install_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 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
architecture: ${{ matrix.architecture }} | |
activate-environment: esmvalcore | |
environment-file: environment.yml | |
python-version: ${{ matrix.python-version }} | |
miniforge-version: "latest" | |
use-mamba: true | |
- run: mkdir -p pip_install_osx_artifacts_python_${{ matrix.python-version }} | |
- name: Record versions | |
run: | | |
mamba --version 2>&1 | tee pip_install_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt | |
python -V 2>&1 | tee pip_install_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt | |
pip -V 2>&1 | tee pip_install_osx_artifacts_python_${{ matrix.python-version }}/pip_version.txt | |
- name: Install | |
run: pip install esmvalcore 2>&1 | tee pip_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt | |
- name: Verify installation | |
run: | | |
esmvaltool --help | |
esmvaltool version 2>&1 | tee pip_install_osx_artifacts_python_${{ matrix.python-version }}/version.txt | |
- name: Upload artifacts | |
if: ${{ always() }} # upload artifacts even if fail | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PIP_Install_OSX_python_${{ matrix.python-version }} | |
path: pip_install_osx_artifacts_python_${{ matrix.python-version }} |