[pre-commit.ci] pre-commit autoupdate #98
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: CI - Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'master' | |
- 'push-action/**' # Allow pushing to protected branches (using CasperWA/push-protected) | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U setuptools wheel | |
#while IFS="" read -r line || [ -n "${line}" ]; do | |
# if [[ "${line}" =~ ^pre-commit.*$ ]]; then | |
# pre_commit="${line}" | |
# fi | |
#done < requirements_dev.txt | |
#while IFS="" read -r line || [ -n "${line}" ]; do | |
# if [[ "${line}" =~ ^invoke.*$ ]]; then | |
# invoke="${line}" | |
# fi | |
#done < requirements_docs.txt | |
pip install -e .[dev] | |
# pip install ${pre_commit} ${invoke} | |
- name: Test with pre-commit | |
run: SKIP=pylint,pylint-tests pre-commit run --all-files | |
pylint-safety: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U setuptools wheel | |
pip install -e .[dev] | |
pip install safety | |
- name: Run pylint | |
run: pylint --rcfile=pyproject.toml --ignore-paths=tests/ --extension-pkg-whitelist='pydantic' --generated-members=dlite.* *.py dlite_cuds | |
# - name: Run pylint - tests | |
# run: pylint --rcfile=pyproject.toml --extension-pkg-whitelist='pydantic' --generated-members=dlite.* --disable=import-outside-toplevel,redefined-outer-name,import-error tests --recursive=yes | |
# Ignore ID 44715 for now. | |
# See this NumPy issue for more information: https://github.com/numpy/numpy/issues/19038 | |
# Ignore ID 51668 for now. | |
# This is a subdependency. | |
# Ignore ID 48547, because of RDFLIB. | |
- name: Run safety | |
run: pip freeze | safety check --stdin --ignore 44715 --ignore 51668 --ignore 48547 | |
pytest: | |
name: pytest (${{ matrix.os[1] }}-py${{ matrix.python-version }}) | |
runs-on: ${{ matrix.os[0] }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ["ubuntu-latest", "linux"] | |
- ["windows-latest", "windows"] | |
python-version: ["3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install linux system dependencies | |
if: matrix.os[1] == 'linux' | |
run: echo "No dependencies defined." | |
- name: Install windows system dependencies | |
if: matrix.os[1] == 'windows' | |
run: echo "No dependencies defined." | |
shell: bash | |
- name: Install Python dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U setuptools wheel | |
pip install -e .[dev] | |
- name: Test with pytest | |
run: pytest -vvv --cov-report=xml | |
- name: Upload coverage to Codecov | |
if: matrix.python-version == '3.9' && github.repository == 'team4.0/dlite-cuds' | |
uses: codecov/codecov-action@v3 | |
with: | |
files: coverage.xml | |
flags: ${{ matrix.os[1] }} | |
build-package: | |
name: Build distribution package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U setuptools wheel build | |
- name: Check building distribution | |
run: python -m build | |
docs: | |
name: Documentation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U setuptools wheel | |
pip install -e .[doc] | |
- name: Build | |
run: | | |
invoke create-api-reference-docs --pre-clean | |
invoke create-docs-index | |
if [ -n "$(git status --porcelain docs/api_reference docs/index.md)" ]; then | |
echo -e "\u274c Discrepancies found !" | |
echo -e "The following files in the documentation must be committed:" | |
git status --porcelain docs/api_reference docs/index.md | |
echo -e "\nRun:\n" | |
echo " invoke create-api-reference-docs --pre-clean" | |
echo -e " invoke create-docs-index\n" | |
echo "And commit the changed files." | |
exit 1 | |
fi | |
mkdocs build --strict |