Skip to content

Commit

Permalink
chore: menambahkan konfigurasi mergify (#16)
Browse files Browse the repository at this point in the history
Signed-off-by: slowy07 <[email protected]>
  • Loading branch information
slowy07 authored Jan 24, 2024
1 parent c14c825 commit 35d195a
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<!-- Checklist semua perubahan yang sesuai. -->

- [ ] Saya menambah algoritma terbaru.
- [ ] Saya menambah fungsi / algoritma.
- [ ] Saya memperbaiki algoritma yang sudah ada.
- [ ] Saya memperbaiki dokumentasi.
- [ ] Saya menambah dokumentasi.
Expand All @@ -25,7 +25,7 @@
<!-- Checklist unit tester / linter yang sesuai. -->

- [ ] pytest
- [ ] flake8
- [ ] pre-commit

## Environment

Expand Down
33 changes: 33 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
pull_request_rules:
# membuat requirement dari automerge dengan sistem
# ketika workflow build passed maka akan dicentang
# ketika target pull request ke main maka akan dicentang
# ketika dikasih label 'ready-to-merge' akan dicentang
- name: testing dengan label ready-to-merge
conditions:
- base=main
- label=ready-to-merge
actions:
comment:
# menambahkan komentar message jika sudah di merge
message: terima kasih atas kontribusinya @{{author}} 🤩
label:
add:
- sudah direview!
# metode dari automerge
merge:
method: squash

# membuat label dengan kondisi jika di dalam pull request
# terdapat file python
- name: python label
conditions:
- or:
- body~=(?m)^\[X\] Saya menambah algoritma terbaru.
- files~=\.py$

actions:
# menambahkan label `python files`
label:
add:
- OpenSeries Python
49 changes: 45 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,55 @@ def adding(num1, num2):
return num1 + num2
```

**Testing**
kemudian testing kode python dengan pytest dan pre-commit

Untuk _lint testing_, kami menyarankan kamu untuk melakukan tes lokal dengan `flake8`:
install terlebih dahulu dari library pre-commit

```bash
pytest . --max-line-length=100 --exclude=example
pip install pre-commit
```

kemudian testing kode python dengan pytest:
jika ada kendala berupa

```
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try 'apt-get or pacman -S yum dnf xbps', where xyz is the package you are trying to
install.
If you wish to install a non-OS-packaged Python package,
create a virtual environment using 'python -m venv path/to/venv'.
Then use path/to/venv/bin/python and path/to/venv/bin/pip.
If you wish to install a non-OS packaged Python application,
it may be easiest to use 'pipx install xyz', which will manage a
virtual environment for you. Make sure you have python-pipx
installed via pacman.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
```

kamu bisa menginstallnya dengan cara

```bash
pip install pre-commit --break-system-packages
```

kemudian lakukan installasi dari pre-commit deangan cara

```bash
pre-commit install
```

kemudian jalankan perintah

```bash
pre-commit run --all-files
```

jika sukses, lakukan testing kode dengan perintah

```bash
pytest . --verbose
Expand Down Expand Up @@ -112,3 +152,4 @@ Pull request akan di-_merge_ jika:

- mengikuti standar dan arahan dari `CONTRIBUTING.md`;
- lulus tes dan cek dari beberapa tes yang sudah kami siapkan.

0 comments on commit 35d195a

Please sign in to comment.