diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index bbe5182..a20c5c5 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -5,137 +5,9 @@ on: branches-ignore: - 'refs/tags/v' -env: - PYTHON_IMAGE: 3.9 - PYTHON_PACKAGE_NAME: deker - jobs: - setup: - runs-on: ubuntu-latest - timeout-minutes: 60 - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: ${{ env.PYTHON_IMAGE }} - - - name: Install poetry - uses: snok/install-poetry@v1.3.4 - with: - virtualenvs-create: true - virtualenvs-in-project: true - - - name: Install dependencies - run: poetry install - - - name: Cache virtual environment - uses: actions/cache@v2 - with: - path: .venv - key: ${{ runner.os }}-venv-${{ env.PYTHON_IMAGE }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }} - - linters: - needs: setup - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: ${{ env.PYTHON_IMAGE }} - - - name: Load virtual environment - uses: actions/cache@v2 - with: - path: .venv - key: ${{ runner.os }}-venv-${{ env.PYTHON_IMAGE }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }} - - - name: Run linters and checks - run: | - source .venv/bin/activate - isort ./${{ env.PYTHON_PACKAGE_NAME }} - black ./${{ env.PYTHON_PACKAGE_NAME }} - flake8 ./${{ env.PYTHON_PACKAGE_NAME }} - mypy ./${{ env.PYTHON_PACKAGE_NAME }} --install-types --non-interactive --config-file pyproject.toml - doc8 --config pyproject.toml ./docs/deker - env: - PIP_DISABLE_PIP_VERSION_CHECK: 1 - - - name: Save linter reports - if: always() - uses: actions/upload-artifact@v2 - with: - name: linter-reports - path: report.xml - - tests: - needs: setup - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ env.PYTHON_IMAGE }} - - - name: Load virtual environment - uses: actions/cache@v2 - with: - path: .venv - key: ${{ runner.os }}-venv-${{ env.PYTHON_IMAGE }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }} - - - name: Run shuffled tests - run: | - source .venv/bin/activate - pytest --random-order --junitxml=tests.xml - env: - PIP_DISABLE_PIP_VERSION_CHECK: 1 - - - name: Save test reports - if: always() - uses: actions/upload-artifact@v2 - with: - name: test-reports - path: tests.xml - - coverage: - needs: setup - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ env.PYTHON_IMAGE }} - - - name: Load virtual environment - uses: actions/cache@v2 - with: - path: .venv - key: ${{ runner.os }}-venv-${{ env.PYTHON_IMAGE }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }} - - - name: Run coverage - run: | - source .venv/bin/activate - coverage run -m pytest --junitxml=report.xml - coverage report --fail-under=96 - coverage xml - env: - PIP_DISABLE_PIP_VERSION_CHECK: 1 - - - name: Save coverage reports - if: always() - uses: actions/upload-artifact@v2 - with: - name: coverage-reports - path: coverage.xml + checks: + uses: openweathermap/deker-actions/.github/workflows/checks.yml@master + with: + package-name: deker + python-version: '3.9' diff --git a/.github/workflows/on_release.yml b/.github/workflows/on_release.yml index ea6286a..d487ca4 100644 --- a/.github/workflows/on_release.yml +++ b/.github/workflows/on_release.yml @@ -6,125 +6,36 @@ on: - 'v[1-9]+.[0-9]+.[0-9]+' env: - PYTHON_IMAGE: 3.9 + PACKAGE_NAME: deker jobs: tox_tests: - runs-on: ubuntu-latest - container: - image: ghcr.io/openweathermap/deker/deker-embedded/tox:latest - env: - PACKAGE_VERSION: ${{ github.REF_NAME }} - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: Set python versions - run: pyenv global 3.9 3.10 3.11 - - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install tools - run: | - env - pip install tox poetry - env: - PIP_DISABLE_PIP_VERSION_CHECK: 1 - - - name: Make requirements file - run: poetry export --without-hashes > requirements.txt - - - name: Run tox tests - run: | - export PIP_EXTRA_INDEX_URL=https://test.pypi.org/simple - env - tox - env: - PIP_DISABLE_PIP_VERSION_CHECK: 1 - PACKAGE_VERSION: ${{ github.REF_NAME }} + uses: openweathermap/deker-actions/.github/workflows/tox.yml@master + with: + package-name: $PACKAGE_NAME build_docs: needs: tox_tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: ${{ env.PYTHON_IMAGE }} - - - name: Install poetry - uses: snok/install-poetry@v1.3.4 - with: - virtualenvs-create: true - virtualenvs-in-project: true - - - name: Install dependencies - run: | - poetry install - source .venv/bin/activate - doc8 --config pyproject.toml docs/deker - cd ./docs - make html - awk 'NR >= 35 && NR <= 40' _build/html/index.html - - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 - with: - path: docs/_build/html + uses: openweathermap/deker-actions/.github/workflows/docs_build.yml@master publish_docs: needs: build_docs - runs-on: ubuntu-latest - permissions: - contents: read - pages: write - id-token: write - concurrency: - group: "pages" - cancel-in-progress: false - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Deploy to GitHub Pages - uses: actions/deploy-pages@v2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages - force: true - directory: docs/_build/html + uses: openweathermap/deker-actions/.github/workflows/docs_publish.yml@master build_sdist: - needs: build_docs + needs: [tox_tests, build_docs] name: Build source distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Build sdist - run: | - pip install poetry-dynamic-versioning - pip install poetry - poetry dynamic-versioning enable - poetry build -f sdist - - - uses: actions/upload-artifact@v3 - with: - path: dist/*.tar.gz + uses: openweathermap/deker-actions/.github/workflows/build.yml@master upload_pypi: - needs: [build_sdist, publish_docs] + name: Publish source distribution + needs: build_sdist runs-on: ubuntu-latest permissions: id-token: write environment: name: pypi - url: https://pypi.org/p/deker + url: https://pypi.org/p/$PACKAGE_NAME steps: - uses: actions/download-artifact@v3 diff --git a/.github/workflows/on_test_release.yml b/.github/workflows/on_test_release.yml index 9481737..715fee7 100644 --- a/.github/workflows/on_test_release.yml +++ b/.github/workflows/on_test_release.yml @@ -5,34 +5,23 @@ on: tags-ignore: - 'v[1-9]+.[0-9]+.[0-9]+' +env: + PACKAGE_NAME: deker + jobs: build_sdist: - name: Build source distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Build sdist - run: | - pip install poetry-dynamic-versioning - pip install poetry - poetry dynamic-versioning enable - poetry build -f sdist - - - uses: actions/upload-artifact@v3 - with: - path: dist/*.tar.gz + name: Build test source distribution + uses: openweathermap/deker-actions/.github/workflows/build.yml@master upload_test_pypi: + name: Upload test source distribution needs: build_sdist runs-on: ubuntu-latest permissions: id-token: write environment: name: testpypi - url: https://test.pypi.org/p/deker + url: https://test.pypi.org/p/$PACKAGE_NAME steps: - uses: actions/download-artifact@v3 @@ -42,7 +31,7 @@ jobs: name: artifact path: dist - - name: Publish package distributions to PyPI + - name: Publish test source distributions to Test-PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ diff --git a/docs/conf.py b/docs/conf.py index a307f8c..99b6144 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -94,7 +94,7 @@ # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. -htmlhelp_basename = "Dekerdoc" +htmlhelp_basename = "deker-doc" # -- Custom Settings ------------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index bc997cf..32f5e97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,6 @@ deepdiff = "6.3.0" pytest-mock = "3.10.0" xarray = "^2023.5.0" bandit = "1.7.5" -tox = "4.6.3" [tool.poetry.group.docs.dependencies] docutils = "0.17" @@ -400,61 +399,3 @@ exclude_lines = [ "except ModuleNotFoundError", "except Exception" ] - -[tool.tox] # tox -legacy_tox_ini = """ -[tox] -requires = - tox>=4 -env_list = {py39,py310,py311}-lint, py{39,310,311}-test - -[testenv:{py39,py310,py311}-test] -description = run unit tests -deps = - deepdiff==6.3.0 - coverage==7.1.0 - pytest==7.2.1 - pytest-sugar==0.9.6 - pytest-mock==3.10.0 - pytest-random-order==1.1.0 - xarray>=2023.5.0 - -commands = - coverage run -m pytest {posargs:tests} --random-order - coverage report --fail-under=96 - -set_env = - PIP_EXTRA_INDEX_URL = {env:PIP_EXTRA_INDEX_URL} - -[testenv:{py39,py310,py311}-lint] -ignore_base_python_conflict = true -description = run linters -deps = black==23.1.0 - Flake8-pyproject==1.2.3 - darglint==1.8.1 - doc8==0.11.2 - flake8==5.0.4 - flake8-bugbear==23.1.20 - flake8-docstrings==1.7.0 - flake8-import-order==0.18.2 - flake8-pytest-style==1.7.0 - isort==5.12.0 - mypy==1.0.0 - mypy-extensions==1.0.0 - pep8-naming==0.13.3 - bandit==1.7.5 - ssort==0.11.6 - deepdiff==6.3.0 - xarray>=2023.5.0 - -commands = ssort {posargs:deker} - isort {posargs:deker} - black {posargs:deker} - flake8 {posargs:deker} - bandit -r {posargs:deker} -c pyproject.toml - mypy {posargs:deker} --install-types --non-interactive --config-file pyproject.toml - doc8 {posargs:docs/deker} --config=pyproject.toml - -set_env = - PIP_EXTRA_INDEX_URL = {env:PIP_EXTRA_INDEX_URL} -"""