From c2b46ed2fa6a661bea83cf71384ce3821f21e1db Mon Sep 17 00:00:00 2001 From: Justus Magin Date: Thu, 22 Aug 2024 20:28:53 +0200 Subject: [PATCH 1/3] simple CI --- .github/workflows/ci.yaml | 91 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..ba692e4 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,91 @@ +name: CI +on: + push: + branches: + - "main" + pull_request: + branches: + - "main" + workflow_dispatch: # allows triggering manually + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + detect-ci-trigger: + name: detect ci trigger + runs-on: ubuntu-latest + if: | + github.repository == 'xarray-contrib/xarray-array-testing' + && (github.event_name == 'push' || github.event_name == 'pull_request') + outputs: + triggered: ${{ steps.detect-trigger.outputs.trigger-found }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - uses: xarray-contrib/ci-trigger@v1 + id: detect-trigger + with: + keyword: "[skip-ci]" + + test: + name: ${{ matrix.os }} py${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + needs: detect-ci-trigger + if: needs.detect-ci-trigger.outputs.triggered == 'false' + env: + FORCE_COLOR: 3 + CONDA_ENV_FILE: "ci/requirements/environment.yaml" + defaults: + run: + shell: bash -l {0} + + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + python-version: ["3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup micromamba + uses: mamba-org/setup-micromamba@v1 + with: + environment-file: ci/requirements/environment.yaml + environment-name: tests + cache-environment: true + cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}" + create-args: >- + python=${{matrix.python-version}} + conda + + - name: Install xarray-array-testing + run: | + python -m pip install --no-deps -e . + + - name: Version info + run: | + conda info -a + conda list + + - name: Import xarray-array-testing + run: | + python -c 'import xarray_array_testing' + + - name: Restore cached hypothesis directory + uses: actions/cache@v4 + with: + path: .hypothesis/ + key: cache-hypothesis + enableCrossOsArchive: true + save-always: true + + - name: Run tests + run: | + python -m pytest --cov=xarray_array_testing From 47945a49c2b0202f32bd2752f7fb85801d7bd2c0 Mon Sep 17 00:00:00 2001 From: Justus Magin Date: Thu, 22 Aug 2024 20:29:47 +0200 Subject: [PATCH 2/3] add requirements --- ci/requirements/environment.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/requirements/environment.yaml b/ci/requirements/environment.yaml index 5e0818a..af4f6f8 100644 --- a/ci/requirements/environment.yaml +++ b/ci/requirements/environment.yaml @@ -7,3 +7,6 @@ dependencies: - pre-commit - pytest - pytest-reportlog + - hypothesis + - xarray + - numpy From e7f26c24ceef545d8c9903511b4a8d07444cfaef Mon Sep 17 00:00:00 2001 From: Justus Magin Date: Thu, 22 Aug 2024 20:30:20 +0200 Subject: [PATCH 3/3] package metadata --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 58ffeae..cb76175 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,10 @@ name = "xarray-array-testing" requires-python = ">= 3.12" license = {text = "Apache-2.0"} -dependencies = [] +dependencies = [ + "hypothesis", + "xarray", +] dynamic = ["version"] [build-system]