-
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.
Merge pull request #26 from watchdogpolska/dev_ext
v1.0.01: code update
- Loading branch information
Showing
18 changed files
with
187 additions
and
63 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,60 @@ | ||
--- | ||
# yamllint disable rule:line-length | ||
name: Docker Build and Push | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
# yamllint disable rule:line-length | ||
if: github.event.pull_request.merged == true && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') | ||
# yamllint enable rule:line-length | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get version from script | ||
id: get_version | ||
working-directory: ./ | ||
run: | | ||
echo "version=$(python version.py)" >> $GITHUB_ENV | ||
- name: Get deployment env | ||
id: get_deployment | ||
run: | | ||
if [[ $GITHUB_REF == *"master"* ]]; then | ||
DEPLOYMENT="prod" | ||
elif [[ $GITHUB_REF == *"dev"* ]]; then | ||
DEPLOYMENT="staging" | ||
else | ||
DEPLOYMENT=${GITHUB_REF#refs/heads/} | ||
fi | ||
echo "deployment=$DEPLOYMENT" >> $GITHUB_ENV | ||
env | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PAT }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./Dockerfile.production | ||
push: true | ||
# yamllint disable rule:line-length | ||
tags: | | ||
${{ secrets.DOCKER_USERNAME }}/${{ vars.REPO_NAME }}:latest-${{ env.deployment }} | ||
${{ secrets.DOCKER_USERNAME }}/${{ vars.REPO_NAME }}:${{ env.version }}-${{ env.deployment }} |
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 |
---|---|---|
@@ -1,28 +1,25 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
--- | ||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- dev | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.6 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.6" | ||
- name: Install package manger | ||
run: pip install -U pip wheel | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
- name: Test with pytest | ||
run: python test.py | ||
- uses: actions/checkout@v3 | ||
- name: Pull python image | ||
run: docker pull python:3.10-slim | ||
- name: Build app container | ||
run: docker compose build daemon | ||
- name: Run app container | ||
run: docker compose up -d daemon | ||
- name: Run pre-commit hooks | ||
uses: pre-commit/[email protected] | ||
- name: Run tests | ||
run: docker compose run daemon python test.py |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# autogenerated pyup.io config file | ||
--- | ||
# autogenerated pyup.io config file | ||
# see https://pyup.io/docs/configuration/ for all available options | ||
|
||
schedule: every month |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM python:3.10-slim as build | ||
LABEL maintainer="adam.dobrawy{at}siecobywatelska.pl" | ||
|
||
WORKDIR /usr/src/app | ||
COPY requirements.txt ./ | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends g++ git make nano \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& pip install --no-cache-dir --upgrade pip \ | ||
&& pip install --no-cache-dir -r requirements.txt \ | ||
&& apt-get remove -y g++ && apt-get autoremove -y | ||
ENV PYTHONUNBUFFERED=1 | ||
COPY . . | ||
CMD [ "python", "./daemon.py" ] |
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,23 @@ | ||
start: | ||
docker-compose up | ||
|
||
stop: | ||
docker-compose stop | ||
|
||
clean: | ||
docker-compose down | ||
|
||
build: | ||
docker-compose build | ||
|
||
test: | ||
docker-compose run --rm daemon python test.py | ||
|
||
lint: # lint currently staged files | ||
pre-commit run | ||
|
||
lint-all: # lint all files in repository | ||
pre-commit run --all-files | ||
|
||
code-syle-check: | ||
docker-compose run daemon pre-commit run --all-files |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Flask==1.1.1 | ||
Flask==3.0.2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pre-commit==1.21.0 | ||
pre-commit==3.7.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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
requests==2.22.0 | ||
mail-parser==3.9.3 | ||
html2text==2019.8.11 | ||
requests==2.31.0 | ||
mail-parser==3.15.0 | ||
html2text==2024.2.26 | ||
# pypi talon to be replaced - last update 2017 | ||
talon==1.4.4 | ||
ipdb==0.13.9 | ||
sentry-sdk==1.5.1 | ||
# forked talon - scikit version does not match training data | ||
# git+https://github.com/PiotrIw/talon.git@master | ||
ipdb==0.13.13 | ||
sentry-sdk==1.43.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
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 @@ | ||
__version__ = "1.0.01" | ||
|
||
if __name__ == "__main__": | ||
print(f"v{__version__}") |