diff --git a/.github/workflows/_test.yaml b/.github/workflows/_test.yaml new file mode 100644 index 00000000..f155a53f --- /dev/null +++ b/.github/workflows/_test.yaml @@ -0,0 +1,86 @@ +name: test + +on: + workflow_call: + inputs: + os: + required: true + type: string + python-version: + required: true + type: string + # secrets: inherit + +jobs: + test: + name: Pytest on ${{ inputs.os }} with Python ${{ inputs.python-version }} + runs-on: ${{ inputs.os }} + timeout-minutes: 60 + defaults: + run: + shell: bash -l {0} + env: + DISPLAY: ":99.0" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAMBA_NO_BANNER: 1 + SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: "100" + - uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-version }} + - uses: conda-incubator/setup-miniconda@v2 + with: + miniconda-version: "latest" + - name: Fetch unshallow + run: git fetch --prune --tags --unshallow + - name: conda setup + run: | + conda install -n base -c conda-forge mamba --no-update-deps + conda install -c conda-forge "nodejs=15.3.0" --no-update-deps + conda create -n test-environment + conda activate test-environment + conda config --env --append channels pyviz/label/dev --append channels conda-forge + conda config --env --remove channels defaults + conda install python=${{ inputs.python-version }} pyctdev + echo $(python --version | tr ' [:upper:]' '=[:lower:]') > $CONDA_PREFIX/conda-meta/pinned + - name: doit develop_install + run: | + conda activate test-environment + doit develop_install -o tests -o examples -o recommended --conda-mode=mamba + - name: patch fiona/geostack on Python 3.7 / Macos + if: contains(inputs.os, 'macos') && inputs.python-version == '3.7' + run: | + conda activate test-environment + mamba install "fiona=1.8" "gdal=3.3" + - name: doit env_capture + run: | + conda activate test-environment + doit env_capture + - name: download test data + run: | + conda activate test-environment + bokeh sampledata + geoviews fetch-data --path=examples + - name: git describe + run: | + git describe + - name: doit test_flakes + run: | + conda activate test-environment + doit test_flakes + - name: doit test_unit + run: | + conda activate test-environment + doit test_unit + - name: test examples + run: | + conda activate test-environment + doit test_examples + - name: codecov + if: github.event_name == 'push' + run: | + conda activate test-environment + codecov diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a5b6293a..e4f095fe 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,88 +7,18 @@ on: branches: - '*' workflow_dispatch: - schedule: - - cron: '0 18 * * SUN' + # schedule: + # - cron: '0 18 * * SUN' jobs: test_suite: - name: Pytest on ${{ matrix.os }} with Python ${{ matrix.python-version }} - runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - python-version: - - if: github.event.schedule == '0 18 * * SUN' - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] - - if: github.event.schedule != '0 18 * * SUN' - python-version: ['3.7', '3.9', '3.11'] - timeout-minutes: 60 - defaults: - run: - shell: bash -l {0} - env: - DISPLAY: ":99.0" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MAMBA_NO_BANNER: 1 - SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: "100" - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - uses: conda-incubator/setup-miniconda@v2 - with: - miniconda-version: "latest" - - name: Fetch unshallow - run: git fetch --prune --tags --unshallow - - name: conda setup - run: | - conda install -n base -c conda-forge mamba --no-update-deps - conda install -c conda-forge "nodejs=15.3.0" --no-update-deps - conda create -n test-environment - conda activate test-environment - conda config --env --append channels pyviz/label/dev --append channels conda-forge - conda config --env --remove channels defaults - conda install python=${{ matrix.python-version }} pyctdev - echo $(python --version | tr ' [:upper:]' '=[:lower:]') > $CONDA_PREFIX/conda-meta/pinned - - name: doit develop_install - run: | - conda activate test-environment - doit develop_install -o tests -o examples -o recommended --conda-mode=mamba - - name: patch fiona/geostack on Python 3.7 / Macos - if: contains(matrix.os, 'macos') && matrix.python-version == '3.7' - run: | - conda activate test-environment - mamba install "fiona=1.8" "gdal=3.3" - - name: doit env_capture - run: | - conda activate test-environment - doit env_capture - - name: download test data - run: | - conda activate test-environment - bokeh sampledata - geoviews fetch-data --path=examples - - name: git describe - run: | - git describe - - name: doit test_flakes - run: | - conda activate test-environment - doit test_flakes - - name: doit test_unit - run: | - conda activate test-environment - doit test_unit - - name: test examples - run: | - conda activate test-environment - doit test_examples - - name: codecov - if: github.event_name == 'push' - run: | - conda activate test-environment - codecov + # python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.9', '3.11'] + uses: ./.github/workflows/_test.yaml + with: + os: "${{ matrix.os }}" + python-version: "${{ matrix.python-version }}"