Skip to content

Commit

Permalink
Merge pull request #20 from MobileTeleSystems/develop
Browse files Browse the repository at this point in the history
[DOP-14482] - release 0.1.5 version
  • Loading branch information
maxim-lixakov authored Mar 27, 2024
2 parents b8cc802 + 3392a20 commit 1233452
Show file tree
Hide file tree
Showing 33 changed files with 787 additions and 260 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Set update schedule for GitHub Actions

version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
labels:
- type:ci
# https://til.simonwillison.net/github/dependabot-python-setup
groups:
github-actions:
patterns:
- '*'
61 changes: 61 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# config for https://github.com/marketplace/actions/github-labeler

- name: attention:help wanted
description: Extra attention is needed
color: bfdadc
from_name: help wanted

- name: attention:invalid
description: This doesn't seem right
color: ea2357
from_name: invalid

- name: ci:skip-changelog
description: Add this label to skip changelog file check
color: 04990f

- name: kind:bug
description: Something isn't working
color: d73a4a
from_name: bug

- name: kind:feature
description: New feature or request
color: 389a3f

- name: kind:improvement
description: Improvement of some existing feature
color: 1a92c2
from_name: enhancement

- name: kind:question
description: Further information is requested
color: 0e857c
from_name: question

- name: resolution:duplicate
description: This issue or pull request already exists
color: cfd3d7
from_name: duplicate

- name: resolution:wontfix
description: This will not be worked on
color: ec103b
from_name: wontfix

- name: type:ci
description: CI-related changes
color: cdb0bd

- name: type:dependency
description: Dependency-related changes
color: 214efe

- name: type:documentation
description: Improvements or additions to documentation
color: 6b9f54
from_name: documentation

- name: type:tests
description: Tests-related changes
color: 5cca5b
27 changes: 27 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Automerge

on:
pull_request_target:

jobs:
automerge:
name: Enable pull request automerge
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'pre-commit-ci[bot]' || github.event.pull_request.user.login == 'dependabot[bot]'

steps:
- uses: alexwilson/[email protected]
with:
github-token: ${{ secrets.AUTOMERGE_TOKEN }}
merge-method: REBASE

autoapprove:
name: Automatically approve pull request
needs: [automerge]
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'pre-commit-ci[bot]' || github.event.pull_request.user.login == 'dependabot[bot]'

steps:
- uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.AUTOMERGE_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Changelog

on:
pull_request:
types: [opened, synchronize, labeled, unlabeled, reopened]
branches-ignore:
- master

env:
DEFAULT_PYTHON: '3.12'

permissions:
contents: read

jobs:
check-changelog:
name: Changelog Entry Check
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.pull_request.labels.*.name, 'ci:skip-changelog') && github.event.pull_request.user.login != 'pre-commit-ci[bot]' && github.event.pull_request.user.login != 'dependabot[bot]'"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-${{ hashFiles('requirements/core.txt', 'requirements/docs.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-${{ hashFiles('requirements/core.txt', 'requirements/docs.txt') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel

- name: Install dependencies
run: |
pip install -I -r requirements.txt -r requirements-docs.txt
- name: Check changelog entry exists
run: |
if [ ! -s docs/changelog/next_release/${{ github.event.pull_request.number }}.*.rst ]; then
echo "Please add corresponding file 'docs/changelog/next_release/<issue number>.<change type>.rst' with changes description"
exit 1
fi
- name: Validate changelog
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
towncrier check --compare-with origin/${{ github.base_ref }}
towncrier --draft
48 changes: 47 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,59 @@ jobs:
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1

- name: Get changelog
run: |
cat docs/changelog/$GITHUB_REF_NAME.rst > changelog.rst
- name: Prepare rST syntax for conversion to Markdown
run: |
# Replace Github links from Sphinx syntax with Markdown
sed -i -E 's/:github:issue:`(.*)`/#\1/g' changelog.rst
sed -i -E 's/:github:pull:`(.*)`/#\1/g' changelog.rst
sed -i -E 's/:github:user:`(.*)`/@\1/g' changelog.rst
sed -i -E 's/:github:org:`(.*)`/@\1/g' changelog.rst
- name: Convert rST to Markdown
uses: docker://pandoc/core:2.9
with:
args: >-
--output=changelog.md
--from=rst
--to=gfm
--wrap=none
changelog.rst
- name: Fixing Markdown syntax after conversion
run: |
# Replace ``` {.python caption="abc"} with ```python caption="abc"
sed -i -E 's/``` \{\.(.*)\}/```\1/g' changelog.md
# Replace ``` python with ```python
sed -i -E 's/``` (\w+)/```\1/g' changelog.md
# Replace \# with #
sed -i -E 's/\\#/#/g' changelog.md
- name: Get release name
id: release-name
run: |
# Release name looks like: 0.7.0 (2023-05-15)
echo -n name= > "$GITHUB_OUTPUT"
cat changelog.md | head -1 | sed -E "s/#+\s*//g" >> "$GITHUB_OUTPUT"
- name: Fix headers
run: |
# Remove header with release name
sed -i -e '1,2d' changelog.md
- name: Create Github release
id: create_release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
name: ${{ steps.release-name.outputs.name }}
body_path: changelog.md
files: |
dist/*
27 changes: 27 additions & 0 deletions .github/workflows/repo-labels-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Repo labels sync

on:
push:
branches:
- develop
paths:
- .github/labels.yml
- .github/workflows/repo-labels-sync.yml
pull_request:
paths:
- .github/labels.yml
- .github/workflows/repo-labels-sync.yml

jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run Labeler
uses: crazy-max/ghaction-github-labeler@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
yaml-file: .github/labels.yml
dry-run: ${{ github.event_name == 'pull_request' }}
23 changes: 15 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ env:

jobs:
tests:
name: Run ${{ matrix.mark }} tests (Python ${{ matrix.python-version }} on ${{ matrix.os }})
name: Run tests (Python ${{ matrix.python-version }}, Pydantic ${{ matrix.pydantic-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.12']
os: [ubuntu-latest]
include:
- python-version: '3.7'
pydantic-version: '1'
os: ubuntu-latest

- python-version: '3.12'
pydantic-version: '2'
os: ubuntu-latest

steps:
- name: Checkout code
Expand All @@ -47,18 +53,18 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python-version }}-tests-${{ hashFiles('requirements*.txt') }}
key: ${{ runner.os }}-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version}}-tests-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ matrix.python-version }}-tests-${{ hashFiles('requirements*.txt') }}
${{ runner.os }}-python-${{ matrix.python-version }}-tests-
${{ runner.os }}-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version}}-tests-${{ hashFiles('requirements*.txt') }}
${{ runner.os }}-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version}}-tests-
${{ runner.os }}-python
${{ runner.os }}-
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel

- name: Install dependencies
run: pip install -I -r requirements.txt -r requirements-test.txt
run: pip install -I -r requirements.txt -r requirements-test.txt "pydantic==${{ matrix.pydantic-version }}.*"

- name: Build package
run: |
Expand All @@ -68,14 +74,15 @@ jobs:
- name: Run tests
run: |
mkdir reports/ || echo "Directory exists"
# required to register package in etl-entities
pip install -e . --no-build-isolation
source .env.local
./run_tests.sh
- name: Upload coverage results
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}-os-${{ matrix.os }}
name: coverage-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }}-os-${{ matrix.os }}
path: reports/*

- name: Shutdown Backend Container
Expand Down
Loading

0 comments on commit 1233452

Please sign in to comment.