-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
057bdec
commit b36b52e
Showing
1 changed file
with
101 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ on: | |
- dev | ||
pull_request: ~ | ||
schedule: | ||
- cron: '0 0 * * *' | ||
- cron: "0 0 * * *" | ||
|
||
env: | ||
DEFAULT_PYTHON: 3.11 | ||
|
@@ -17,8 +17,10 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
pip_cache_dir: ${{ steps.pip-cache.outputs.dir }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
@@ -30,19 +32,51 @@ jobs: | |
|
||
- name: Get pip cache directory path | ||
id: pip-cache | ||
run: echo "PIP_CACHE_DIR=$(pip cache dir)" >> $GITHUB_ENV | ||
run: echo "dir=$(pip cache dir)" >> $GITHUB_ENV | ||
|
||
- name: Cache pip dependencies | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ env.PIP_CACHE_DIR }} | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} | ||
path: ${{ env.dir }} | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements_test.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install project dependencies | ||
run: | | ||
pip install . | ||
pip install -r requirements.txt | ||
- name: Install test dependencies | ||
run: | | ||
pip install -r requirements_test.txt | ||
unit-tests: | ||
needs: prepare | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
|
||
- name: Get pip cache directory path | ||
id: pip-cache | ||
run: echo "dir=$(pip cache dir)" >> $GITHUB_ENV | ||
|
||
- name: Cache pip dependencies | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ env.dir }} | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements_test.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install project dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Install test dependencies | ||
run: | | ||
|
@@ -52,10 +86,71 @@ jobs: | |
run: | | ||
pytest --cov=asusrouter --cov-report=xml:unit-tests-cov.xml -k 'not test_devices' | ||
- name: Upload coverage to artifacts | ||
uses: actions/[email protected] | ||
with: | ||
name: unit-tests-cov | ||
path: unit-tests-cov.xml | ||
|
||
device-tests: | ||
needs: prepare | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
|
||
- name: Get pip cache directory path | ||
id: pip-cache | ||
run: echo "dir=$(pip cache dir)" >> $GITHUB_ENV | ||
|
||
- name: Cache pip dependencies | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ env.dir }} | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements_test.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install project dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Install test dependencies | ||
run: | | ||
pip install -r requirements_test.txt | ||
- name: Run real-data tests | ||
run: | | ||
pytest --cov=asusrouter --cov-report=xml:real-data-tests-cov.xml tests/test_devices.py --log-cli-level=INFO | ||
- name: Upload coverage to artifacts | ||
uses: actions/[email protected] | ||
with: | ||
name: real-data-tests-cov | ||
path: real-data-tests-cov.xml | ||
|
||
codecov: | ||
needs: [unit-tests, device-tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Download coverage from artifacts | ||
uses: actions/[email protected] | ||
with: | ||
name: unit-tests-cov | ||
path: . | ||
- uses: actions/[email protected] | ||
with: | ||
name: real-data-tests-cov | ||
path: . | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
|