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: Test rainforest master | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
jobs: | |
unit_tests: | |
name: Unit Tests (${{ matrix.python-version }}, ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-latest" ] | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
max-parallel: 6 | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: dev | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install rainforest | |
if: matrix.os != 'macos-latest' | |
working-directory: ${{github.workspace}} | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r test_requirements.txt | |
pip install . | |
- name: Create rainforest_data folder | |
run: | | |
mkdir -p ${{github.workspace}}/rainforest_data | |
- name: Check imports | |
env: | |
AWS_KEY: ${{ secrets.AWS_KEY }} | |
RAINFOREST_DATAPATH: ${{github.workspace}}/rainforest_data | |
working-directory: /tmp/ | |
run: | | |
python -c "import rainforest; print(rainforest.__file__)" | |
- name: Run tests | |
env: | |
AWS_KEY: ${{ secrets.AWS_KEY }} | |
RAINFOREST_DATAPATH: ${{github.workspace}}/rainforest_data | |
working-directory: ${{github.workspace}} | |
run: pytest tests_ci | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |