-
Notifications
You must be signed in to change notification settings - Fork 5
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
Sergey Rybakov
committed
Aug 15, 2023
1 parent
0638320
commit 770b679
Showing
5 changed files
with
25 additions
and
312 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 |
---|---|---|
|
@@ -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/[email protected] | ||
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' |
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 |
---|---|---|
|
@@ -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/[email protected] | ||
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 | ||
|
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
Oops, something went wrong.