Skip to content

Commit

Permalink
initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
rehborn committed Aug 30, 2023
0 parents commit 5bd7946
Show file tree
Hide file tree
Showing 13 changed files with 794 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
WAKATIME_JSON=
GH_TOKEN=
GH_ACTOR=

46 changes: 46 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Create and publish a Docker image

on:
push:
branches:
- main
tags:
- 'v*.*.*'
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

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

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
48 changes: 48 additions & 0 deletions .github/workflows/github-activity-svg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Run Github Activity Action

on:
workflow_dispatch:
inputs:
months:
type: choice
description: 'number of months to generate'
options:
- "1"
- "2"
- "3"
- "6"
- "12"
- "24"

# schedule:
# - cron: '0 0,12,18 * * *'

permissions:
contents: read
pages: write
id-token: write

jobs:
generate-and-publish-svg:
name: Generate Activity SVGs and Publish to Github Pages
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: "Run Github Activity SVG Action"
uses: rehborn/github-activity-svg@v1
with:
months: ${{ inputs.months || '3' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_ACTOR: ${{ github.actor }}
WAKATIME_JSON_URL: ${{ secrets.WAKATIME_JSON_URL }}

- name: Upload Web artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./dist/

- name: Deploying Web artifact
uses: actions/deploy-pages@v2
46 changes: 46 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Python Lint and Test
on:
pull_request:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ['3.10']

permissions:
contents: read
pull-requests: write

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pipenv
pipenv install -d --deploy
- name: Run Linter
run: |
{
echo 'MESSAGE<<EOF'
pipenv run pylint main.py --exit-zero
echo EOF
} >> "$GITHUB_ENV"
# Post Results to PR only on pull_request
- name: Post result to PR
if: github.event_name == 'pull_request'
uses: mshick/add-pr-comment@v2
with:
message: ${{ env.MESSAGE }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
dist/
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.10-slim

ENV PYTHONUNBUFFERED 1

# pipenv working directory
ENV WORKON_HOME /root
ENV PIPENV_PIPFILE /app/Pipfile

COPY Pipfile Pipfile.lock main.py /app/

WORKDIR /app

RUN pip install pipenv
RUN pipenv install --deploy

EXPOSE 8000

ENV WORK_DIR /data

ENTRYPOINT ["pipenv", "run", "python", "/app/main.py", "--work-dir", "${WORK_DIR}"]
16 changes: 16 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
drawsvg = "*"
requests = "*"
python-dotenv = "*"
python-dateutil = "*"

[dev-packages]

[requires]
python_version = "3.10"

165 changes: 165 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5bd7946

Please sign in to comment.