CI Upstream #1640
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: CI Upstream | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, reopened, synchronize, labeled] | |
branches: | |
- main | |
paths: | |
- ".github/workflows/upstream-dev-ci.yaml" | |
- "ci/upstream-dev-env.yml" | |
- "flox/*" | |
schedule: | |
- cron: "0 0 * * *" # Daily “At 00:00” UTC | |
workflow_dispatch: # allows you to trigger the workflow run manually | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
upstream-dev: | |
name: upstream-dev | |
runs-on: ubuntu-latest | |
if: ${{ | |
(contains(github.event.pull_request.labels.*.name, 'test-upstream') && github.event_name == 'pull_request') | |
|| github.event_name == 'workflow_dispatch' | |
|| github.event_name == 'schedule' | |
}} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags. | |
- name: Set environment variables | |
run: | | |
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV | |
- name: Set up conda environment | |
uses: mamba-org/setup-micromamba@v2 | |
with: | |
environment-name: flox-tests | |
init-shell: bash | |
# cache-environment: true | |
# micromamba list does not list pip dependencies, so install mamba | |
create-args: >- | |
mamba | |
pip | |
python=${{ matrix.python-version }} | |
pytest-reportlog | |
- name: Install upstream dev dependencies | |
run: | | |
# install cython for building cftime without build isolation | |
micromamba install -f ci/upstream-dev-env.yml | |
micromamba remove --force numpy scipy pandas cftime | |
python -m pip install \ | |
-i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ | |
--no-deps \ | |
--pre \ | |
--upgrade \ | |
numpy \ | |
scipy \ | |
pandas \ | |
xarray | |
# without build isolation for packages compiling against numpy | |
# TODO: remove once there are `numpy>=2.0` builds for cftime | |
python -m pip install \ | |
--no-deps \ | |
--upgrade \ | |
--no-build-isolation \ | |
git+https://github.com/Unidata/cftime | |
python -m pip install \ | |
git+https://github.com/dask/dask \ | |
git+https://github.com/ml31415/numpy-groupies | |
- name: Install flox | |
run: | | |
python -m pip install --no-deps -e . | |
- name: List deps | |
run: | | |
# micromamba list does not list pip dependencies | |
mamba list | |
- name: Run Tests | |
if: success() | |
id: status | |
run: | | |
pytest -rf -n auto --cov=./ --cov-report=xml \ | |
--report-log output-${{ matrix.python-version }}-log.jsonl | |
- name: Generate and publish the report | |
if: | | |
failure() | |
&& steps.status.outcome == 'failure' | |
&& github.event_name == 'schedule' | |
&& github.repository_owner == 'xarray-contrib' | |
uses: xarray-contrib/issue-from-pytest-log@v1 | |
with: | |
log-path: output-${{ matrix.python-version }}-log.jsonl |