-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit f282a0f
Showing
23 changed files
with
892 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.git | ||
**/.dart_tool | ||
.venv/ | ||
.*_cache |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.py] | ||
indent_style = space | ||
indent_size = 4 | ||
max_line_length = 88 | ||
|
||
[Makefile] | ||
indent_style = tab |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Workflow | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: { } | ||
|
||
jobs: | ||
lint: | ||
uses: BlindfoldedSurgery/actions-python/.github/workflows/lint.yml@v1 | ||
with: | ||
python-version: '3.11' | ||
|
||
test: | ||
uses: BlindfoldedSurgery/actions-python/.github/workflows/test.yml@v1 | ||
with: | ||
python-version: '3.11' | ||
|
||
build-container-image: | ||
needs: | ||
- lint | ||
- test | ||
uses: BlindfoldedSurgery/actions-container/.github/workflows/build-image-docker.yml@v2 | ||
with: | ||
push-image: ${{ github.ref_name == github.event.repository.default_branch }} | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-container-image | ||
if: success() && github.ref_name == github.event.repository.default_branch | ||
concurrency: production | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v4 | ||
- name: Substitute environment variables in values.yaml | ||
run: "envsubst < values.yaml > values_sub.yaml && mv values_sub.yaml values.yaml" | ||
env: | ||
IMAGE_NAME: "ghcr.io/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" | ||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | ||
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | ||
- uses: WyriHaximus/github-action-helm3@v3 | ||
with: | ||
exec: helm upgrade location-bot . --install --namespace=telegram-bots --atomic | ||
kubeconfig: '${{ secrets.KUBECONFIG_RAW }}' | ||
|
||
clean: | ||
concurrency: cleanup | ||
needs: [ deploy ] | ||
uses: BlindfoldedSurgery/actions-container/.github/workflows/clean.yml@v2 |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Files and directories created by conventional Python tools. | ||
__pycache__ | ||
.venv | ||
venv | ||
.mypy_cache/ | ||
.ruff_cache/ | ||
.pytest_cache/ | ||
|
||
# IntelliJ IDEA | ||
.idea/ | ||
|
||
.env | ||
|
||
usages.db | ||
state.json | ||
downloads/ |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: location-bot | ||
|
||
type: application | ||
|
||
version: 1.0.0 |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM python:3.11-slim-bookworm AS base | ||
|
||
RUN groupadd --system --gid 500 app | ||
RUN useradd --system --uid 500 --gid app --create-home --home-dir /app -s /bin/bash app | ||
|
||
RUN apt-get update -qq \ | ||
&& apt-get install -y --no-install-recommends \ | ||
curl \ | ||
tini \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives | ||
|
||
# renovate: datasource=pypi depName=poetry | ||
ENV POETRY_VERSION=1.6.1 | ||
ENV POETRY_HOME="/opt/poetry" | ||
ENV POETRY_VIRTUALENVS_IN_PROJECT=false | ||
ENV PATH="$POETRY_HOME/bin:$PATH" | ||
|
||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
USER app | ||
WORKDIR /app | ||
|
||
COPY [ "poetry.toml", "poetry.lock", "pyproject.toml", "./" ] | ||
|
||
RUN poetry install --no-interaction --ansi --only=main --no-root | ||
|
||
FROM base AS prod | ||
|
||
# We don't want the tests | ||
COPY src/az ./src/az | ||
|
||
RUN poetry install --no-interaction --ansi --only-root | ||
|
||
ARG APP_VERSION | ||
ENV APP_VERSION=$APP_VERSION | ||
|
||
ENTRYPOINT [ "tini", "--", "poetry", "run", "python", "-m", "app" ] |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.PHONY: check | ||
check: lint test | ||
|
||
.PHONY: lint | ||
lint: | ||
poetry run black src/ | ||
poetry run ruff check --fix --show-fixes src/ | ||
poetry run mypy src/ | ||
|
||
.PHONY: test | ||
test: | ||
poetry run pytest src/ |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# Location Bot |
Oops, something went wrong.