use a session instead of requests directly #47
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: tests | |
on: | |
push: | |
pull_request: | |
# schedule: | |
# - cron: '00 4 * * *' # daily at 4AM | |
jobs: | |
build: | |
name: Test conftrack with Python ${{ matrix.python-version }} (${{ matrix.dependencies }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9"] | |
dependencies: ["pip", "conda"] | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Set env vars | |
run: | | |
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} # just the repo, as opposed to org/repo | |
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV | |
- name: Checkout the code | |
uses: actions/checkout@v2 | |
- name: Start MongoDB | |
uses: supercharge/mongodb-github-action@1.6.0 | |
- name: Set up Python ${{ matrix.python-version }} with conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: ${{ env.REPOSITORY_NAME }}-py${{ matrix.python-version }} | |
auto-update-conda: true | |
miniconda-version: "latest" | |
python-version: ${{ matrix.python-version }} | |
- name: Install auxiliary dependencies | |
run: | | |
set -vxeo pipefail | |
python3 -m pip install --upgrade pip wheel | |
- name: Install dependencies with ${{ matrix.dependencies }} | |
if: matrix.dependencies == 'pip' | |
run: | | |
set -vxeo pipefail | |
python3 -m pip install -r requirements.txt | |
python3 -m pip install -r requirements-dev.txt | |
- name: Install dependencies with ${{ matrix.dependencies }} | |
if: matrix.dependencies == 'conda' | |
run: | | |
set -vxeo pipefail | |
conda install -y -c conda-forge six mongoquery doct jsonschema mock pymongo pytest pyyaml requests tornado ujson | |
- name: Install the package | |
run: | | |
set -vxeo pipefail | |
python3 -m pip install . -vv --no-deps | |
- name: Check installed dependencies | |
run: | | |
set -vxeo pipefail | |
conda env list | |
pip list | |
conda list | |
- name: Test with pytest | |
run: | | |
set -vxeuo pipefail | |
pytest -s -vv |