Skip to content

Commit

Permalink
[DOP-16658] Initialize repo
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Jun 27, 2024
1 parent 2969595 commit 7a7d518
Show file tree
Hide file tree
Showing 128 changed files with 7,948 additions and 9 deletions.
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
__pycache__/
*.py[cod]
*.envx
*.cover
.coverage
.coverage.*
.cache
*.log
.git
.mypy_cache
.pytest_cache
.idea
.vscode
.venv/
venv/
9 changes: 9 additions & 0 deletions .env.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Init Postgres database
POSTGRES_DB=arrakis
POSTGRES_USER=arrakis
POSTGRES_PASSWORD=changeme

# See Backend -> Configuration documentation
ARRAKIS__DATABASE__URL=postgresql+asyncpg://arrakis:changeme@db:5432/arrakis
ARRAKIS__SERVER__LOGGING__PRESET=colored
ARRAKIS__SERVER__DEBUG=false
4 changes: 4 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export ARRAKIS__DATABASE__URL=postgresql+asyncpg://arrakis:changeme@127.0.0.1:5432/arrakis
export ARRAKIS__SERVER__DEBUG=true
export ARRAKIS__SERVER__LOGGING__PRESET=colored
export ARRAKIS_TEST_SERVER_URL=http://localhost:8000
24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- Thank you for your contribution! -->
<!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR -->
<!-- See https://github.com/MobileTeleSystems/arrakis/blob/develop/CONTRIBUTING.rst for help on Contributing -->
<!-- PLEASE DO **NOT** put issue ids in the PR title! Instead, add a descriptive title and put ids in the body -->

## Change Summary

<!-- Please give a short summary of the changes. -->

## Related issue number

<!-- Are there any issues opened that will be resolved by merging this change? -->
<!-- WARNING: please use "fix #123" style references so the issue is closed when this PR is merged. -->

## Checklist

* [ ] Commit message and PR title is comprehensive
* [ ] Keep the change as small as possible
* [ ] Unit and integration tests for the changes exist
* [ ] Tests pass on CI and coverage does not decrease
* [ ] Documentation reflects the changes where applicable
* [ ] `docs/changelog/next_release/<pull request or issue id>.<change type>.rst` file added describing change
(see [CONTRIBUTING.rst](https://github.com/MobileTeleSystems/arrakis/blob/develop/CONTRIBUTING.rst) for details.)
* [ ] My PR is ready to review.
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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:
- '*'
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
labels:
- type:dependency
# https://til.simonwillison.net/github/dependabot-python-setup
groups:
python-packages:
patterns:
- '*'
69 changes: 69 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 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: component:backend
description: Backend-related changes
color: '5319e7'

- name: component:client
description: Client-related changes
color: 75f526

- 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/enable-github-automerge-action@2.0.0
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 }}
40 changes: 40 additions & 0 deletions .github/workflows/cache-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Cleanup caches after merge
on:
pull_request:
types:
- closed
workflow_dispatch:

jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
# `actions:write` permission is required to delete caches
# See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id
actions: write
contents: read

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Cleanup cache
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH --limit 100 --sort size | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Code analysis

on:
push:
branches:
- develop
pull_request:
branches-ignore:
- master
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
# flake8-commas is failing on Python 3.12
DEFAULT_PYTHON: '3.11'

jobs:
linters:
name: Linters
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Install poetry
uses: snok/install-poetry@v1

- name: Cache poetry
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-${{ hashFiles('**/poetry.lock') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-
${{ runner.os }}-python-
- name: Install dependencies
run: |
poetry install --no-root --all-extras --with dev --without docs,test
- name: Run flake8
run: poetry run flake8 arrakis/

- name: Run mypy
run: poetry run mypy ./arrakis --config-file ./pyproject.toml
28 changes: 28 additions & 0 deletions .github/workflows/repo-labels-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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
workflow_dispatch:

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' }}
Loading

0 comments on commit 7a7d518

Please sign in to comment.