diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a8fc679 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,56 @@ +name: Tests + +on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["windows-latest", "ubuntu-latest", "macos-latest"] + python-version: ["3.7", "3.8", "3.9"] + + env: + PYTHON_VERSION: ${{ matrix.python-version }} + PARALLEL: "true" + COVERAGE: "true" + + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + # Setup Python (faster than using Python container) + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v2 + with: + path: .venv + key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + if: steps.cache-poetry.outputs.cache-hit != 'true' + run: | + poetry install --no-interaction --no-root + + - name: Install library + run: | + poetry install --no-interaction + + - name: Run tests + shell: bash -l {0} + run: | + source .venv/bin/activate + pytest tests/ \ No newline at end of file