# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
#
name: Test

on:
  pull_request:
    branches: ["**"]
  push:
    branches: [main, master]
    tags: ["**"]

defaults:
  run:
    shell: bash

jobs:
  test_jupyterhub:
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10

    env:
      # NOTE: UTF-8 content may be interpreted as ascii and causes errors
      #       without this.
      LANG: C.UTF-8
      MOZ_HEADLESS: 1

    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, ubuntu-20.04]
        group: ["docs", "nbextensions", "python"]
        python: ["3.6", "3.7", "3.8", "3.9"]
        exclude:
          - python: "3.6"
            group: docs
          - python: "3.7"
            group: docs
          - python: "3.8"
            group: docs
    steps:
      # This is how you set an environment variable in a GitHub workflow that
      # will be available in following steps as if you would used `export
      # MY_ENV=my-value`.
      - name: Configure environment variables from job flags
        run: |
          if [ "${{ matrix.group }}" == "docs" ]; then
              echo "GROUP=docs" >> $GITHUB_ENV
          fi
          if [ "${{ matrix.group }}" == "nbextensions" ]; then
              echo "GROUP=nbextensions" >> $GITHUB_ENV
          fi
          if [ "${{ matrix.group }}" == "python" ]; then
              echo "GROUP=python" >> $GITHUB_ENV
          fi
      - uses: actions/checkout@v2
      # NOTE: actions/setup-python@v2 can make use of a cache within the GitHub
      #       Action virtual environment and setup extremely fast. 3.9 isn't
      #       available in this cache as of November 2020.
      - name: Install Python ${{ matrix.python }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python }}
      - name: Install Python dependencies
        run: |
          pip install -U pip wheel setuptools
          python tasks.py install --group="$GROUP"
          pip freeze
      - name: Run pytest
        run: |
          python tasks.py tests --group="$GROUP"
      # - name: Submit codecov report
      #   run: |
      #     codecov
Add github actions workflow v1
Add github actions workflow v1
