Skip to content

Commit

Permalink
Migrating CI from cirrus to GHA (#271)
Browse files Browse the repository at this point in the history
* adding gha for tests and wheels

* get wheels to run

* 1st wheels fix

* 2nd fix

* 3rd fix

* 4th fix

* 5th fix

* 6th fix

* 7th fix

* 8th fix

* 9th fix

* 10th fix

* 11th fix

* 12th fix

* 13th fix

* 14th fix

* 15th fix

* 15th fix

* 16th fix

* 18th fix

* 19th fix

* 20th fix

* 21st fix

* 22nd fix

* 23rd fix

* 24th fix

* 25th fix

* 26th fix

* 27th fix

* 28th fix

* 29th fix

* 29th fix

* 30th fix

* 31st fix

* 32nd fix

* 33rd fix

* 34th fix

* 35th fix

* 36th fix

* 37th fix

* 38th fix

* 39th fix

* 40th fix

* 41ST fix

* 42nd fix

* 43rd fix

* 44th fix

* 45th fix

* 45th fix

* 46th fix

* 47th fix

* 48th fix

* 49th fix

* 50th fix

* 51st fix

* 52nd fix

* 53rd fix

* 54th fix

* 55th fix

* 56th fix

* 57th fix

* 58th fix

* 59th fix

* Adding GHA to replace cirrus.yml

* Adding comments for IRIS_SOURCE

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixing the name of the benchmark check

* Fixing the name of the benchmark check again

* Add nearest neighbour regridding (#266)

* add nearest neighbour regridding

* fix tests

* further improvements, reintroduce mask keywords

* fix tests

* change test name

* add tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* flake fix

* update changelog

* address review comments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* flake fix

* address review comments

* parameterise test

* add Raises section to docstrings

* fix docstrings

* fill out __all__

* address review comments

* further test parameterisation.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Fixing the name of the benchmark check

* Making requested changes

* Update .github/workflows/benchmark.yml

Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>

* add comment to benchmark.yml

* Update .github/workflows/benchmark.yml

Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: stephenworsley <49274989+stephenworsley@users.noreply.github.com>
Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>
  • Loading branch information
4 people authored May 23, 2023
1 parent 780fd62 commit 7a98c7d
Show file tree
Hide file tree
Showing 7 changed files with 381 additions and 166 deletions.
151 changes: 0 additions & 151 deletions .cirrus.yml

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# reference:
# - https://github.com/actions/cache
# - https://github.com/actions/checkout

name: benchmark-check

on:
pull_request:

push:
branches:
- "main"
- "v*x"
- "!auto-update-lockfiles"
- "!pre-commit-ci-update-config"
- "!dependabot/*"
tags:
- "v*"

workflow_dispatch:

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

jobs:
benchmark:
name: "performance benchmarks (py${{ matrix.python-version }})"

runs-on: ubuntu-latest

env:
PY_VER: "3.10"
IRIS_TEST_DATA_LOC_PATH: benchmarks
IRIS_TEST_DATA_PATH: benchmarks/iris-test-data
IRIS_TEST_DATA_VERSION: "2.19"
#: If you change the IRIS_SOURCE here you will also need to change it in
#: the noxfile and the tests and wheel workflows.
IRIS_SOURCE: "github:main"
ENV_CACHE_BUILD: "0"
TEST_DATA_CACHE_BUILD: "0"

strategy:
matrix:
python-version: ["3.10"]

steps:
- name: "checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
- if: ${{ github.event_name == 'pull_request' }}
# TODO: remove this, so we can benchmark using GHA's default
# commit - a simulated merge. Requires adapting
# --session="benchmarks(branch)" to accept inputs for both
# commits to compare (instead of deriving one of them).
# Currently, this checks out the HEAD of the pull request.
run: git checkout HEAD^2

- name: Install ASV & Nox
run: |
pip install asv nox
- name: Cache environment directories
uses: actions/cache@v3
with:
path: |
.nox
benchmarks/.asv/env
$CONDA/pkgs
key: ${{ runner.os }}-${{ hashFiles('requirements/') }}-${{ env.ENV_CACHE_BUILD }}-${{ env.IRIS_SOURCE }}

- name: Benchmark script
run: |
if ${{ github.event_name != 'pull_request' }}; then export COMPARE="HEAD~"; else export COMPARE="origin/${{ github.base_ref }}"; fi;
nox --session=tests --install-only
export DATA_GEN_PYTHON=$(realpath $(find .nox -path "*tests/bin/python"))
nox --session="benchmarks(branch)" -- "${COMPARE}"
- name: Archive ASV results
uses: actions/upload-artifact@v3
with:
name: asv-report
path: |
benchmarks/.asv/results
99 changes: 99 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# reference:
# - https://github.com/actions/cache
# - https://github.com/actions/checkout

name: ci-tests

on:
pull_request:

push:
branches:
- "main"
- "v*x"
- "!auto-update-lockfiles"
- "!pre-commit-ci-update-config"
- "!dependabot/*"
tags:
- "v*"

workflow_dispatch:

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

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

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

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

env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
#: If you change the IRIS_SOURCE here you will also need to change it in
#: the noxfile and the benchmark and wheel workflows.
IRIS_SOURCE: "github:main"
IRIS_TEST_DATA_LOC_PATH: tests
IRIS_TEST_DATA_PATH: tests/iris-test-data
IRIS_TEST_DATA_VERSION: "2.19"
ENV_CACHE_BUILD: "0"
TEST_DATA_CACHE_BUILD: "0"

strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.9", "3.10"]
include:
- python-version: "3.10"
coverage: true

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

- name: Install Nox
run: |
pip install nox
- name: Cache environment directories
id: cache-env-dir
uses: actions/cache@v3
with:
path: |
.nox
$CONDA/pkgs
key: ${{ runner.os }}-${{ hashFiles('requirements/') }}-${{ env.ENV_CACHE_BUILD }}-${{ env.IRIS_SOURCE }}-${{ matrix.python-version }}

- name: Cache test data directory
id: cache-test-data
uses: actions/cache@v3
with:
path: |
${{ env.IRIS_TEST_DATA_PATH }}
key:
test-data-${{ env.IRIS_TEST_DATA_VERSION }}-${{ env.TEST_DATA_CACHE_BUILD }}

- name: Fetch the test data
if: steps.cache-test-data.outputs.cache-hit != 'true'
run: |
wget --quiet https://github.com/SciTools/iris-test-data/archive/v${IRIS_TEST_DATA_VERSION}.zip -O iris-test-data.zip
unzip -q iris-test-data.zip
mkdir --parents ${{ github.workspace }}/${IRIS_TEST_DATA_LOC_PATH}
mv iris-test-data-${IRIS_TEST_DATA_VERSION} ${IRIS_TEST_DATA_PATH}
- name: Set test data var
run: |
echo "OVERRIDE_TEST_DATA_REPOSITORY=${{ github.workspace }}/${IRIS_TEST_DATA_PATH}/test_data" >> $GITHUB_ENV
- name: "tests (py${{ matrix.python-version }})"
env:
PY_VER: ${{ matrix.python-version }}
COVERAGE: ${{ matrix.coverage }}
run: |
nox --session tests -- --verbose
Loading

0 comments on commit 7a98c7d

Please sign in to comment.