chore: monthly updates for July'23
- migrate to `pdm` from `poetry` - update dependencies - improvises `dockerfile` (drops `containerfile`) - only `python` & `pip` are required in ci/cd - adds `compose.yml` - simplifies local & containerized development
This commit is contained in:
161
CONTRIBUTING.md
161
CONTRIBUTING.md
@@ -1,142 +1,69 @@
|
||||
# Contributing
|
||||
|
||||

|
||||

|
||||
|
||||
> 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.** Inside the cloned folder, create a `.env` file with the following contents (without `# comments`):
|
||||
|
||||
## Using Docker/Podman (recommended)
|
||||
```ini
|
||||
INPUT_GH_TOKEN=EXAMPLE_GITHUB_PAT # required (for development)
|
||||
INPUT_WAKATIME_API_KEY=EXAMPLE-WAKATIME-API-KEY # required
|
||||
INPUT_API_BASE_URL=https://wakatime.com/api # required
|
||||
INPUT_REPOSITORY=GITHUB_USERNAME/REPOSITORY_NAME # required
|
||||
INPUT_COMMIT_MESSAGE=Updated WakaReadme graph with new metrics
|
||||
INPUT_SHOW_TITLE=true
|
||||
INPUT_SECTION_NAME=waka
|
||||
INPUT_BLOCKS=->
|
||||
INPUT_SHOW_TIME=true
|
||||
INPUT_SHOW_TOTAL=true
|
||||
INPUT_TIME_RANGE=last_7_days
|
||||
INPUT_SHOW_MASKED_TIME=false
|
||||
INPUT_LANG_COUNT=0
|
||||
INPUT_STOP_AT_OTHER=true
|
||||
```
|
||||
|
||||
> Assumes you've already installed & configured latest version of [docker](https://www.docker.com/) or [podman](https://podman.io/).
|
||||
**NEVER commit this `.env` file!**
|
||||
|
||||
## Using containers (recommended)
|
||||
|
||||
> Assumes that you already have latest version of either [`podman`](https://podman.io/) or [`docker`](https://www.docker.com/) (with [`compose`](https://docs.docker.com/compose/)) installed & configured.
|
||||
>
|
||||
> Replace `docker` with `podman` everywhere, if you're using the latter.
|
||||
> Replace `podman` with `docker` everywhere, if you're using the latter.
|
||||
|
||||
1. **Inside the cloned folder**, run:
|
||||
|
||||
```console
|
||||
$ git archive -o 'waka-readme.tar.gz' HEAD
|
||||
$ 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 'WakaReadmeDev' 'waka-readme:dev' bash
|
||||
```
|
||||
|
||||
- or Persistent
|
||||
|
||||
```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, 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_SECTION_NAME='waka'
|
||||
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
|
||||
(waka-readme-py3_11)# python -m main --dev
|
||||
(waka-readme-py3_11)# python -m unittest discover # run tests
|
||||
```
|
||||
|
||||
5. Later, to remove stop and remove the container:
|
||||
|
||||
```console
|
||||
// exit container
|
||||
# exit
|
||||
|
||||
$ docker container stop 'WakaReadmeDev'
|
||||
$ docker container rm 'WakaReadmeDev'
|
||||
```
|
||||
```sh
|
||||
# Build
|
||||
$ podman-compose -p waka-readme -f ./docker-compose.yml up -d
|
||||
# Logs
|
||||
$ podman logs WakaReadmeDev
|
||||
# Cleanup
|
||||
$ podman-compose -p waka-readme -f ./docker-compose.yml down
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
> **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.
|
||||
## Using virtual environments
|
||||
|
||||
---
|
||||
> Assumes you've already installed & configured latest version of [python](https://www.python.org/) and [pdm](https://pdm.fming.dev/latest/).
|
||||
|
||||
## Manual
|
||||
|
||||
> Assumes you've already installed & configured latest version of [python](https://www.python.org/) and [poetry](https://python-poetry.org/).
|
||||
|
||||
1. Inside the cloned folder run:
|
||||
1. Inside the cloned folder run the following commands to install dependencies
|
||||
|
||||
```console
|
||||
$ poetry shell
|
||||
(waka-readme-py3_11)$ poetry install
|
||||
$ pdm install
|
||||
$ eval $(pdm venv activate)
|
||||
```
|
||||
|
||||
to create and activate a virtual environnement and install dependencies.
|
||||
in a virtual environnement and activate it. In windows use the following
|
||||
|
||||
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_SECTION_NAME='waka'
|
||||
INPUT_BLOCKS='->'
|
||||
INPUT_SHOW_TIME='True'
|
||||
INPUT_SHOW_TOTAL='True'
|
||||
INPUT_TIME_RANGE='last_7_days'
|
||||
INPUT_SHOW_MASKED_TIME='True'
|
||||
```ps1
|
||||
> Invoke-Expression (pdm venv activate)
|
||||
```
|
||||
|
||||
3. Execute program in development mode with:
|
||||
to activate virtual environment.
|
||||
|
||||
2. To test or execute the program in development, run:
|
||||
|
||||
```console
|
||||
(waka-readme-py3_11)$ set -a && . ./.env && set +a # optional
|
||||
(waka-readme-py3_11)$ python -m main --dev
|
||||
(waka-readme-py3_11)$ python -m unittest discover # run tests
|
||||
(waka-readme-py3_11)$ python -m main --dev # execute program in dev mode
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user