Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert cirrus to gha #409

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
95d72d8
initial commit
ESadek-MO Apr 12, 2024
d8ec4e4
change versions
ESadek-MO Apr 12, 2024
31b8641
missed a version check
ESadek-MO Apr 12, 2024
1bac721
fixed some stuff
ESadek-MO Apr 12, 2024
44f4db0
matrix to three nine
ESadek-MO Apr 12, 2024
896c432
matrix to three nine
ESadek-MO Apr 12, 2024
4f0b235
cforge
ESadek-MO Apr 12, 2024
73fa568
Configure for mypy (#407)
stephenworsley Apr 12, 2024
27d3b35
returned all version checks, multi-source
ESadek-MO Apr 13, 2024
da2f1ad
Updated environment lockfiles (#411)
scitools-ci[bot] Apr 15, 2024
c27724e
added cartopy cache
ESadek-MO Apr 15, 2024
fb86bbb
tried to fix versions
ESadek-MO Apr 15, 2024
169c123
doctest
ESadek-MO Apr 15, 2024
1f4a9c6
linkcheck
ESadek-MO Apr 15, 2024
fbe4807
matrix name
ESadek-MO Apr 15, 2024
9cbf1e3
only tests
ESadek-MO Apr 15, 2024
10794c5
killed yml
ESadek-MO Apr 15, 2024
9c021f8
fixed doctest
ESadek-MO Apr 15, 2024
ac954a2
added back condaforge
ESadek-MO Apr 15, 2024
18618fc
add iris-sample-data test dependency (#413)
bjlittle Apr 15, 2024
c5f53b9
Updated environment lockfiles (#414)
scitools-ci[bot] Apr 15, 2024
5768ae8
initial commit
ESadek-MO Apr 12, 2024
475eb56
change versions
ESadek-MO Apr 12, 2024
4271d53
missed a version check
ESadek-MO Apr 12, 2024
95a93b1
fixed some stuff
ESadek-MO Apr 12, 2024
4a378db
matrix to three nine
ESadek-MO Apr 12, 2024
510fb0d
matrix to three nine
ESadek-MO Apr 12, 2024
d538bdd
cforge
ESadek-MO Apr 12, 2024
b90e337
returned all version checks, multi-source
ESadek-MO Apr 13, 2024
084afa9
added cartopy cache
ESadek-MO Apr 15, 2024
a6ddb43
tried to fix versions
ESadek-MO Apr 15, 2024
3e232bb
doctest
ESadek-MO Apr 15, 2024
ecfd5e3
linkcheck
ESadek-MO Apr 15, 2024
6b9f410
matrix name
ESadek-MO Apr 15, 2024
c7b4f80
only tests
ESadek-MO Apr 15, 2024
3fe113b
killed yml
ESadek-MO Apr 15, 2024
ae98c8c
fixed doctest
ESadek-MO Apr 15, 2024
4d1e1c0
added back condaforge
ESadek-MO Apr 15, 2024
d9df3d1
added cartopy cache
ESadek-MO Apr 15, 2024
966f97c
merge conflicts
ESadek-MO Apr 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 0 additions & 130 deletions .cirrus.yml

This file was deleted.

132 changes: 132 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# reference:
# - https://github.com/actions/cache
# - https://github.com/actions/checkout
# - https://github.com/marketplace/actions/setup-miniconda

name: ci-tests

on:
push:
branches:
- "main"
- "v*x"
tags:
- "v*"
pull_request:
branches:
- "*"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: "${{ matrix.session }} (py${{ matrix.python-version }} ${{ matrix.os }}) [${{ matrix.iris-source }}]"

runs-on: ${{ matrix.os }}

defaults:
run:
shell: bash -l {0}

strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11"]
session: ["doctest"]
# conda-forge doesn't fit within nose char limits, change with pytest
iris-source : ["condaforge"]
include:
- os: "ubuntu-latest"
python-version: "3.11"
session: "tests"
iris-source: "condaforge"
- os: "ubuntu-latest"
python-version: "3.11"
session: "tests"
iris-source: "source"
- os: "ubuntu-latest"
python-version: "3.10"
session: "tests"
iris-source: "condaforge"
- os: "ubuntu-latest"
python-version: "3.9"
session: "tests"
iris-source: "condaforge"

env:
IRIS_TEST_DATA_VERSION: "2.24"
ENV_NAME: "ci-tests"

steps:
- name: "checkout"
uses: actions/checkout@v4

- name: "environment configure"
env:
# Maximum cache period (in weeks) before forcing a cache refresh.
CACHE_WEEKS: 2
run: |
echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV}
echo "LOCK_FILE=requirements/locks/py$(echo ${{ matrix.python-version }} | tr -d '.')-linux-64.lock" >> ${GITHUB_ENV}

- name: "data cache"
uses: ./.github/workflows/composite/iris-data-cache
with:
cache_build: 0
env_name: ${{ env.ENV_NAME }}
version: ${{ env.IRIS_TEST_DATA_VERSION }}

- name: "conda package cache"
uses: ./.github/workflows/composite/conda-pkg-cache
with:
cache_build: 0
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}

- name: "conda install"
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
channels: conda-forge,defaults
activate-environment: ${{ env.ENV_NAME }}
auto-update-conda: false
use-only-tar-bz2: true

- name: "conda environment cache"
uses: ./.github/workflows/composite/conda-env-cache
with:
cache_build: 0
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}
install_packages: "cartopy nox pip"

- name: "conda info"
run: |
conda info
conda list

- name: "cartopy cache"
uses: ./.github/workflows/composite/cartopy-cache
with:
cache_build: 0
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}

- name: "nox cache"
uses: ./.github/workflows/composite/nox-cache
with:
cache_build: 0
env_name: ${{ env.ENV_NAME }}
lock_file: ${{ env.LOCK_FILE }}

- name: "iris ${{ matrix.session }}"
env:
PY_VER: ${{ matrix.python-version }}
IRIS_SOURCE: ${{ matrix.iris-source }}
# IRIS_TEST_DATA_DIR: ${HOME}/iris-test-data
run: |
nox --session ${{ matrix.session }} -- --test-data-dir ${HOME}/iris-test-data/test_data
41 changes: 41 additions & 0 deletions .github/workflows/composite/cartopy-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "cartopy-cache"
description: "create and cache cartopy assets"

#
# Assumes the environment contains the following variables:
# - CONDA
#
inputs:
cache_build:
description: "conda environment cache build number"
required: false
default: "0"
cache_period:
description: "conda environment cache timestamp"
required: true
env_name:
description: "environment name"
required: true

runs:
using: "composite"
steps:
- uses: actions/cache@v3
id: cartopy-cache
with:
path: ~/.local/share/cartopy
key: ${{ runner.os }}-cartopy-${{ inputs.env_name }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }}

- if: steps.cartopy-cache.outputs.cache-hit != 'true'
env:
CARTOPY_SHARE_DIR: ~/.local/share/cartopy
CARTOPY_FEATURE: https://raw.githubusercontent.com/SciTools/cartopy/v0.20.0/tools/cartopy_feature_download.py
shell: bash
run: |
# Require to explicitly activate the environment within the composite action.
source ${{ env.CONDA }}/etc/profile.d/conda.sh >/dev/null 2>&1
conda activate ${{ inputs.env_name }}
wget --quiet ${CARTOPY_FEATURE}
mkdir -p ${CARTOPY_SHARE_DIR}
# Requires a pre-installed version of cartopy within the environment.
python cartopy_feature_download.py physical --output ${CARTOPY_SHARE_DIR} --no-warn
35 changes: 35 additions & 0 deletions .github/workflows/composite/conda-env-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "conda-env-cache"
description: "create and cache the conda environment"

#
# Assumes the environment contains the following variables:
# - CONDA
#
inputs:
cache_build:
description: "conda environment cache build number"
required: false
default: "0"
cache_period:
description: "conda environment cache timestamp"
required: true
env_name:
description: "environment name"
required: true
install_packages:
description: "conda packages to install into environment"
required: true

runs:
using: "composite"
steps:
- uses: actions/cache@v3
id: conda-env-cache
with:
path: ${{ env.CONDA }}/envs/${{ inputs.env_name }}
key: ${{ runner.os }}-conda-env-${{ inputs.env_name }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }}

- if: steps.conda-env-cache.outputs.cache-hit != 'true'
shell: bash
run: |
conda install --quiet --name ${{ inputs.env_name }} ${{ inputs.install_packages }}
22 changes: 22 additions & 0 deletions .github/workflows/composite/conda-pkg-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "conda-pkg-cache"
description: "cache the conda environment packages"

inputs:
cache_build:
description: "conda environment cache build number"
required: false
default: "0"
cache_period:
description: "conda environment cache timestamp"
required: true
env_name:
description: "environment name"
required: true

runs:
using: "composite"
steps:
- uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-pkgs-${{ inputs.env_name }}-p${{ inputs.cache_period }}-b${{ inputs.cache_build }}
Loading
Loading