Improve CI triggers
name: build
on:
+ pull_request:
push:
+ branches:
+ - 'master'
+ - 'develop'
schedule:
- cron: '0 0 * * *'
env:
# The only way to simulate if-else statement
- CHECKOUT_BRANCH: ${{ github.event_name == 'push' && github.ref || 'develop' }}
+ CHECKOUT_BRANCH: ${{ github.event_name == 'schedule' && 'develop' || github.ref }}
jobs:
@@ -48,9 +52,13 @@ jobs:
matrix:
python-version:
- '3.7'
- - '3.8'
- '3.9'
- '3.10'
+ include:
+ # A flag marks whether full or partial tests should be run
+ # We don't run integration tests on pull requests from outside repos, because they don't have secrets
+ - python-version: '3.8'
+ full_test_suite: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- name: Checkout branch
uses: actions/checkout@v2
@@ -71,7 +79,7 @@ jobs:
python install_all.py -e
- name: Run full tests and code coverage
- if: matrix.python-version == '3.8'
+ if: ${{ matrix.full_test_suite }}
run: |
sentinelhub.config \
--sh_client_id "${{ secrets.SH_CLIENT_ID }}" \
@@ -79,13 +87,13 @@ jobs:
pytest --cov --cov-report=term --cov-report=xml
- name: Run pylint and reduced tests
- if: matrix.python-version != '3.8'
+ if: ${{ !matrix.full_test_suite }}
run: |
make pylint
pytest -m "not sh_integration"
- name: Upload code coverage
- if: matrix.python-version == '3.8'
+ if: ${{ matrix.full_test_suite }}
uses: codecov/codecov-action@v2
with:
files: coverage.xml
