diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e340a8c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: GitHub Actions - Tests +on: [push] +jobs: + tests: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Miniconda Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + # TODO: The below setp only chaches conda packages, need to cache pip seperatly + - name: Cache conda + uses: actions/cache@v2 + env: + # Increase this value to reset cache if environment.yml has not changed + CACHE_NUMBER: 0 + with: + path: ~/conda_pkgs_dir + key: conda-${{ env.CACHE_NUMBER }}-${{hashFiles('environment.yml') }} + - name: Cache pip + uses: actions/cache@v2 + env: + # Increase this value to reset cache if environment.yml has not changed + CACHE_NUMBER: 0 + with: + path: ~/pip + key: pip-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} + - name: Install Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: 3.8 + activate-environment: botty + channel-priority: strict + environment-file: environment.yml + use-only-tar-bz2: true # Needed for caching + - name: Activate conda + shell: powershell + run: | + C:\Miniconda\condabin\conda.bat init powershell + set PYTHONPATH=./src + - name: Pytest + shell: powershell + run: | + C:\Miniconda\condabin\conda.bat activate botty + python -c "import sys; print(sys.version)" + pytest -v -s diff --git a/development.md b/development.md index cfcb9eb..6428247 100644 --- a/development.md +++ b/development.md @@ -30,12 +30,9 @@ For changelog run: `git log ..HEAD --oneline --decorate` All automated tests can be found within the **/test/*** folder. The file and folder structure is supposed to mimic the src folder. ```bash conda activate botty -# not sure why the PYTHONPATH is not working from pytest.ini (happy if someone would fix that) -set PYTHONPATH=./src -# To run all tests: -pytest +# To run all tests: (-s to see stdout, -v for verbose) +pytest -s -v # To see std output: -pytest -s # To run a specific test: pytest test/smoke_test.py ``` diff --git a/environment.yml b/environment.yml index c94956a..05571c4 100644 --- a/environment.yml +++ b/environment.yml @@ -19,3 +19,4 @@ dependencies: - requests - pytest - pytest-env + - pytest-pythonpath diff --git a/pytest.ini b/pytest.ini index 4bad3a2..4b00161 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,3 +2,4 @@ env = PYTHONPATH=./src RUN_ENV=test +python_paths = ./src