Skip to content

Commit 98eb502

Browse files
committed
feat: setup environment
initial setup for automated build and release
1 parent 53696bc commit 98eb502

File tree

12 files changed

+1750
-1
lines changed

12 files changed

+1750
-1
lines changed

.github/workflows/main.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
PYTHON_VERSION: "3.10"
11+
POETRY_VERSION: "1.7.1"
12+
13+
jobs:
14+
main:
15+
name: Test and release
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
- name: Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ env.PYTHON_VERSION }}
27+
- name: Cache poetry
28+
id: cache-poetry
29+
uses: actions/cache@v4
30+
with:
31+
path: ~/.local
32+
key: poetry-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }}
33+
- name: Install poetry
34+
if: steps.cache-poetry.outputs.cache-hit != 'true'
35+
uses: snok/install-poetry@v1
36+
with:
37+
version: ${{ env.POETRY_VERSION }}
38+
virtualenvs-in-project: true
39+
- name: Cache venv
40+
id: cache-venv
41+
uses: actions/cache@v4
42+
with:
43+
path: .venv
44+
key: venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }}-${{ hashFiles('poetry.lock') }}
45+
restore-keys: |
46+
venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }}-
47+
- name: Install dependencies
48+
if: steps.cache-venv.outputs.cache-hit != 'true'
49+
run: poetry install --with dev
50+
- name: Run tests
51+
run: poetry run pytest -v
52+
- name: Run type-checking
53+
run: poetry run pyright
54+
- name: Check formatting
55+
run: |
56+
poetry run black --check beet_observer
57+
poetry run isort --check-only beet_observer
58+
- name: Release
59+
if: |
60+
github.repository == 'BPR02/Observer'
61+
&& github.event_name == 'push'
62+
&& github.ref == 'refs/heads/main'
63+
env:
64+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
TWINE_USERNAME: __token__
66+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
67+
run: |
68+
git config --global user.name "github-actions"
69+
git config --global user.email "[email protected]"
70+
poetry run semantic-release version
71+
poetry run twine upload --verbose dist/*
72+
poetry run semantic-release publish

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### macOS ###
2+
.DS_Store
3+
.AppleDouble
4+
.LSOverride
5+
6+
### Python ###
7+
__pycache__/
8+
*.py[cod]
9+
*$py.class
10+
11+
### VS Code ###
12+
.vscode
13+
14+
### Poetry ###
15+
dist/

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# CHANGELOG

CONTRIBUTING.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Contributing
2+
Contributions are welcome! Make sure to first open an issue discussing the problem or the new feature before creating a pull request. This project uses [poetry](https://python-poetry.org/).
3+
4+
## Code Style
5+
The code follows the [black](https://github.com/psf/black) code style. Import statements are sorted with [isort](https://pycqa.github.io/isort/). The project must type-check with [pyright](https://github.com/microsoft/pyright). It is recommend to run the type-checker via the VSCode Python extension (discussed below).
6+
7+
**Format**
8+
```bash
9+
# omit `poetry run` if u have the virtualenv activated
10+
$ poetry run isort beet_observer
11+
$ poetry run black beet_observer
12+
```
13+
14+
**Check**
15+
```bash
16+
# omit `poetry run` if u have the virtualenv activated
17+
$ poetry run black --check beet_observer
18+
$ poetry run isort --check-only beet_observer
19+
```
20+
21+
You can run `poetry self add 'poethepoet[poetry_plugin]'` to get access to an easier set of commands:
22+
```bash
23+
# omit `poetry` if u have the virtualenv activated
24+
$ poetry poe format
25+
$ poetry poe check
26+
```
27+
28+
## IDE
29+
It is recommend to use [VSCode](https://code.visualstudio.com/). The following recommendations are made for python contributions.
30+
31+
### Python
32+
It is recommend to use the official [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) extension. This extension comes with type-checking support alongside automatic formatting and import sorting.
33+
34+
## Commits
35+
When committing code, follow the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) style for writing commit messages:
36+
37+
```md
38+
<type>: <subject>
39+
<BLANK LINE>
40+
<body>
41+
<BLANK LINE>
42+
<footer>
43+
```
44+
45+
### Examples
46+
- feat: added support for multiple overlay definitions
47+
- docs: add usage information
48+
- fix: folder generates in incorrect location
49+
- feat!: added support for multiple overlay definitions
50+
51+
> Note
52+
53+
Here are the types used (adapted from [here](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines)):
54+
55+
56+
### Types
57+
> **type** [*version*]: description
58+
59+
- **feat** [*minor*]: A new feature
60+
- **fix** [*patch*]: A bug fix
61+
- **perf** [*patch*]: A code change that improves performance
62+
- **docs**: Documentation only changes
63+
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
64+
- **refactor**: A code change that neither fixes a bug nor adds a feature
65+
- **test**: Adding missing or correcting existing tests
66+
- **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation
67+
68+
69+
### Extras
70+
- The start of `<body>` or `<footer>` can be `BREAKING CHANGE:` to indicate a **major** version bump
71+
- Keep each line under 100 characters
72+
73+
74+
## Versioning
75+
This project follows the [semantic versioning](https://semver.org/) format for versioning:
76+
- `major` reserved for breaking changes (needs maintainer approval)
77+
- `minor` for new features and larger tweaks (usually changing user experience like adding an option to the config)
78+
- `patch` for bug fixes and smaller tweaks (usually doesn't affect user experience)
79+
80+
> The commit type indicates whether a bump should be `patch` or `minor`. The version will be updated automatically based on the commit.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 BPR
3+
Copyright (c) 2024 BPR02
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Observer
2+
A beet plugin to automatically generate overlays from previous datapacks

beet_observer/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__version__ = "0.0.1"
2+
3+
from .plugin import *

beet_observer/plugin.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from beet import Context
2+
3+
4+
def beet_default(ctx: Context):
5+
return

docs/placeholder.md

Whitespace-only changes.

0 commit comments

Comments
 (0)