Skip to content

Commit

Permalink
feat: release v0.1.7 πŸš€
Browse files Browse the repository at this point in the history
- migrated to python 3.11 & poetry 1.2+
- updated project dependencies & readme
- DockerfileDev is now containerfile
- improve contribution docs
- it includes development with podman
  • Loading branch information
yozachar committed Nov 22, 2022
1 parent c207519 commit f106d3b
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 207 deletions.
4 changes: 2 additions & 2 deletions .github/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.10"
python-version: "3.11"
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python -
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,6 @@ cython_debug/

# VSCode
.vscode/

# asdf
.tool-versions
149 changes: 90 additions & 59 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,104 @@

![python_ver](https://img.shields.io/badge/python-%5E3.10-blue.svg)

First off, thank you! Please follow along.
> First off, thank you! Please follow along.
> **_You need to fork this repository and clone it, onto your system._**
**You need to _fork_ this repository and _clone_ it, onto your system.**

## Using docker (recommended)
## Using Docker/Podman (recommended)

> Assumes you've already installed & configured latest version of [docker](https://www.docker.com/).
> Assumes you've already installed & configured latest version of [docker](https://www.docker.com/) or [podman](https://podman.io/).
>
> Replace `docker` with `podman` everywhere, if you're using the latter.
1. **Inside the cloned folder**, run:

```console
$ git archive -o 'waka-readme.tar.gz' HEAD
$ docker build . -t 'waka-readme:dev' -f 'DockerfileDev'
$ docker build . -f containerfile -t 'waka-readme:dev'
```

to build an image. (Image is identified as `<name>:<tag>`)

2. Then create containers and use them as dev environments.
- Temporary:

```console
$ docker run --rm -it --name 'WakaReadme' 'waka-readme:dev' bash
```
- Temporary:

- or Persistent
```console
$ docker run --rm -it --name 'WakaReadmeDev' 'waka-readme:dev' bash
```

```console
$ docker run --detach --name 'WakaReadme' 'waka-readme:dev'
$ docker exec -it 'WakaReadme' bash
```
- or Persistent

where `WakaReadme` is the docker container name.
```console
$ docker run --detach --name 'WakaReadmeDev' 'waka-readme:dev'
```

where `WakaReadmeDev` is the docker container name. Then execute `bash` in the container:

```console
$ docker exec -it 'WakaReadmeDev' bash
```

3. For development, you can attach code editor of your choice to this container.
4. Export environnement variables with edits, as required:

```console
// inside container

# export INPUT_GH_TOKEN='<GITHUB TOKEN>' \
&& export INPUT_WAKATIME_API_KEY='<WAKATIME API KEY>' \
&& export INPUT_API_BASE_URL='https://wakatime.com/api' \
&& export INPUT_REPOSITORY='<REPOSITORY SLUG>' \
&& export INPUT_COMMIT_MESSAGE='<COMMIT MESSAGE>' \
&& export INPUT_SHOW_TITLE='True' \
&& export INPUT_BLOCKS='->' \
&& export INPUT_SHOW_TIME='True' \
&& export INPUT_SHOW_TOTAL='True' \
&& export INPUT_TIME_RANGE='last_7_days' \
&& export INPUT_SHOW_MASKED_TIME='True'
```

and execute program with:

```console
# poetry shell
(venv)# python -m main --dev
```
```console
// inside container, create a file `.env`
# micro .env
```

paste (`Ctrl+Shift+V`) the following contents:

```env
INPUT_GH_TOKEN='<GITHUB TOKEN>'
INPUT_WAKATIME_API_KEY='<WAKATIME API KEY>'
INPUT_API_BASE_URL='https://wakatime.com/api'
INPUT_REPOSITORY='<REPOSITORY SLUG>'
INPUT_COMMIT_MESSAGE='<COMMIT MESSAGE>'
INPUT_SHOW_TITLE='True'
INPUT_BLOCKS='->'
INPUT_SHOW_TIME='True'
INPUT_SHOW_TOTAL='True'
INPUT_TIME_RANGE='last_7_days'
INPUT_SHOW_MASKED_TIME='True'
```

and execute program with:

```console
# poetry shell
# set -a && . ./.env && set +a # optional
(venv)# python -m main --dev
```

5. Later, to remove stop and remove the container:

```console
// exit container
# exit
```console
// exit container
# exit

$ docker container stop 'WakaReadmeDev'
$ docker container rm 'WakaReadmeDev'
```

---

$ docker container stop 'WakaReadme'
$ docker container rm 'WakaReadme'
```
> **NOTE** With VSCode on Windows
>
> Add these to `.vscode/settings.json`
>
> ```json
> {
> "terminal.integrated.commandsToSkipShell": [
> "-workbench.action.quickOpenView"
> ]
> }
> ```
>
> To quit the `micro` editor from the vscode terminal.
---
## Manual
Expand All @@ -86,22 +116,23 @@ First off, thank you! Please follow along.

2. Put environment variables in a `.env` file

```env
INPUT_GH_TOKEN='<GITHUB TOKEN>'
INPUT_WAKATIME_API_KEY='<WAKATIME API KEY>'
INPUT_API_BASE_URL='https://wakatime.com/api'
INPUT_REPOSITORY='<REPOSITORY SLUG>'
INPUT_COMMIT_MESSAGE='<COMMIT MESSAGE>'
INPUT_SHOW_TITLE='True'
INPUT_BLOCKS='->'
INPUT_SHOW_TIME='True'
INPUT_SHOW_TOTAL='True'
INPUT_TIME_RANGE='last_7_days'
INPUT_SHOW_MASKED_TIME='True'
```
```env
INPUT_GH_TOKEN='<GITHUB TOKEN>'
INPUT_WAKATIME_API_KEY='<WAKATIME API KEY>'
INPUT_API_BASE_URL='https://wakatime.com/api'
INPUT_REPOSITORY='<REPOSITORY SLUG>'
INPUT_COMMIT_MESSAGE='<COMMIT MESSAGE>'
INPUT_SHOW_TITLE='True'
INPUT_BLOCKS='->'
INPUT_SHOW_TIME='True'
INPUT_SHOW_TOTAL='True'
INPUT_TIME_RANGE='last_7_days'
INPUT_SHOW_MASKED_TIME='True'
```

3. Execute program in development mode with:

```console
(venv)$ python -m main --dev
```
```console
$ set -a && . ./.env && set +a # optional
(venv)$ python -m main --dev
```
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ I am a fan of minimal designs and the profile readme is a great way to show off

[wakapi]: https://wakapi.dev
[hakatime]: https://github.com/mujx/hakatime
[workflow_dispatch]: https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
[waka_plugins]: https://wakatime.com/plugins
[waka_help]: https://wakatime.com/help/editors
[profile_readme]: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme
Expand Down
2 changes: 1 addition & 1 deletion DockerfileDev β†’ containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ENV PYTHONFAULTHANDLER=1 \
ADD waka-readme.tar.gz .

# install poetry & dependencies
RUN apt-get update && apt-get install --no-install-recommends -y curl git \
RUN apt-get update && apt-get install --no-install-recommends -y curl git micro \
&& curl -sSL https://install.python-poetry.org | python - \
&& poetry install --no-root --no-ansi

Expand Down
Loading

0 comments on commit f106d3b

Please sign in to comment.