-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci - start adding coverage using DSP 2043 mocks
requires xfail due to DMTF/Redfish-Service-Validator#589
- Loading branch information
Showing
6 changed files
with
381 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: CodeCov | ||
on: [push, pull_request] | ||
jobs: | ||
run: | ||
name: test ${{ matrix.os }} / ${{ matrix.python }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
python: ["3.11","3.12"] | ||
env: | ||
OS: ${{ matrix.os }} | ||
PYTHON: ${{ matrix.python }} | ||
steps: | ||
- uses: actions/checkout@master | ||
- uses: pdm-project/setup-pdm@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: install deps | ||
run: | | ||
pdm use -f $PYTHON | ||
pdm install -d | ||
- name: Setup description documents | ||
run: | | ||
pdm run pytest --cov=tests/test_description_documents --cov-report=xml:./coverage/reports/coverage-description_documents-tests.xml tests/description_documents_test.py | ||
- name: Generate coverage report (DSP 2043) | ||
run: | | ||
pdm run pytest --cov=src/aiopenapi3_redfish/ --cov-report=xml:./coverage/reports/coverage-dsp2043.xml tests/dsp2043_test.py::test_dsp2043_file | ||
pdm run pytest --cov=tests/test_dsp2043.py --cov-report=xml:./coverage/reports/coverage-dsp2043-tests.xml tests/dsp2043_test.py::test_dsp2043_file | ||
- name: Upload coverage to Codecov (core) | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
directory: ./coverage/reports/ | ||
files: coverage-dsp2043.xml | ||
env_vars: OS,PYTHON | ||
fail_ci_if_error: false | ||
flags: core | ||
name: codecov-aiopenapi3_redfish | ||
verbose: true | ||
- name: Upload coverage to Codecov (tests) | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
directory: ./coverage/reports/ | ||
files: coverage-description_documents-tests.xml,coverage-dsp2043-tests.xml | ||
env_vars: OS,PYTHON | ||
fail_ci_if_error: false | ||
flags: tests | ||
name: codecov-aiopenapi3_redfish-tests | ||
verbose: true |
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
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
import aiopenapi3_redfish | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def description_documents(): | ||
return Path(aiopenapi3_redfish.__file__).parent / "description_documents" |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import io | ||
import zipfile | ||
|
||
import httpx | ||
|
||
|
||
def test_DSP8010(description_documents): | ||
if (p := description_documents / "DSP8010" / "2024.1").exists(): | ||
return | ||
|
||
p.mkdir(exist_ok=True) | ||
|
||
zip = zipfile.Path( | ||
zipfile.ZipFile( | ||
io.BytesIO( | ||
httpx.get("https://www.dmtf.org/sites/default/files/standards/documents/DSP8010_2024.1.zip").content | ||
) | ||
) | ||
) | ||
for i in zip.glob("openapi/*.yaml"): | ||
(p / i.name).write_text(i.read_text()) | ||
|
||
|
||
def test_Swordfish(description_documents): | ||
if (p := description_documents / "Swordfish" / "v1.2.6").exists(): | ||
return | ||
|
||
p.mkdir(exist_ok=True) | ||
|
||
zip = zipfile.Path( | ||
zipfile.ZipFile( | ||
io.BytesIO( | ||
httpx.get( | ||
"https://www.snia.org/sites/default/files/technical-work/swordfish/release/v1.2.6/zip/Swordfish_v1.2.6.zip" | ||
).content | ||
) | ||
) | ||
) | ||
schema = zipfile.Path(io.BytesIO((zip / "Swordfish_v1.2.6_Schema.zip").read_bytes())) | ||
|
||
for i in schema.glob("yaml/*.yaml"): | ||
(p / i.name).write_text(i.read_text()) |
Oops, something went wrong.