Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add changelog and changelog CI #58

Merged
merged 9 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .github/workflows/clippy.yml

This file was deleted.

11 changes: 7 additions & 4 deletions .github/workflows/fmt.yml → .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
on: pull_request

name: Rustfmt
on:
pull_request:
types: [opened, synchronize, edited, review_requested, ready_for_review]
name: PR
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
format:
Expand All @@ -15,4 +18,4 @@ jobs:
- uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
mode: review
mode: review
23 changes: 23 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches:
- "*"
name: Push

jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Clippy
run: cargo clippy --all-targets --all-features
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/push_on_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Push on main
on:
push:
branches:
- 'master'

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
changelog:
name: Generate changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v3
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}

- name: Commit
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
set +e
git add CHANGELOG.md
git commit --no-verify -m "Update changelog"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git ${{ env.BRANCH_NAME }}
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on: [release]
jobs:
changelog:
name: Generate changelog
runs-on: ubuntu-latest
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v3
id: git-cliff
with:
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGES.md
GITHUB_REPO: ${{ github.repository }}

# use release body in the same job
- name: Upload the binary releases
uses: svenstaro/upload-release-action@v2
with:
file: binary_release.zip
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
body: ${{ steps.git-cliff.outputs.content }}

# use release body in another job
upload:
name: Upload the release
needs: changelog
runs-on: ubuntu-latest
steps:
- name: Upload the binary releases
uses: svenstaro/upload-release-action@v2
with:
file: binary_release.zip
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
body: ${{ needs.changelog.outputs.release_body }}
109 changes: 109 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.0] - 2024-05-19

### Feature

- Introduce pwl, remove lazy static where used. (#47)
- Refactor Creature response according to new db and remastered (#48)
- Introduce Creature Role (#49)
- Refactor DB communication, remove moka cache (#51)

## [1.2.0] - 2024-01-17

### Feature

- Allow variants on encounter generation (#37)

### Fixed

- Change default from any to no alignment (#39)
- Any not converted correctly from db string (#40)

## [1.0.0] - 2023-11-16

### Added

- Add gunicorn support, expand config usage, fix docker image
- Add encounter info: encounter difficulty, exp and difficulty thresholds
- Add endpoint to fetch creature fields (family, rarity, size, alignment), page size must be greater or equal than 1, generalize fetch_keys redis_handler method
- Add method to procedurally create endpoints ending with or without /
- Add weak and elite endpoints
- Add melee, ranged, spell caster and sources fields. add melee, ranged and spell caster filters (#14)
- Add health controller
- Add get filter routers, use dbcache filters field, separate a little bit the cache logic and router initialization
- Add elite and weak modifier. Complete bestiary
- Add swagger at swagger-ui endpoint
- Add get_encounter_info logic

### Changed

- Flake8 refactor
- Introduce list validation, change endpoint name to a more Rest like naming scheme
- Expand Creature object
- Bump version
- Refactor following ruff guidelines (#13)
- Refactor from rocket to actix-web
- Run clippy linter, add pre-commit, add Dockerfile
- Update bestiary swagger, refactor id endpoint
- Allow cors, optimize dockerignore, fix Dockerfile
- Rename difficulty to challenge, return metadata enums in UPPERCASE
- Return enum fields in caps and null as vec result when enc gen failed with error. Remove various debug
- Rename encounter_challenge to challenge, format any
- Refactor get single creature to not call redis each time
- Update readme
- Add valid rust actions
- 1.0.0 release (#32)

### Feature

- Backend is now deployment ready using docker and fly.io
- Implement random encounter generator, redis_handler can now fetch ids that pass filters
- Allow encounter generation with no filter, difficulty is randomized and the rest ignored
- Introduce get creature API, add filter name to list API
- Add sort and label filters (#6)
- Add level and hp (min, max) filters (#9)
- Refactor using rust
- Implement cache (that needs to be refactored, it's ported 1:1 from python code)
- Implement full feature routing for bestiary list, with filters and default values.
- Allow request without pagination
- Implement encounter generation in rust (#16)
- Refactor cache to make it more rusty. This has the problem that it will have a slow first call every 24hours for one unlucky user
- Parse sources and return them correctly
- Parse complex sources strings
- Implement traits (#19)
- Implement creature types (#21)
- Implement multiple filter values (#23)
- Implement cache control (#25)
- Implement SQLite db (#28)
- Implement source endpoint (#30)
- Implement generator filtering by number of creatures (#31)

### Fixed

- Now get_bestiary returns json instead of string
- Handle difference between negative levels when calculating encounter info
- Next element wrong address
- Allow CORS calls
- Simplify calculate_encounter_difficulty, fix logical bug with trivial difficulty
- Populate new_ids_dict correctly (#7)
- Side effect on creature cache (#11)
- Refactor to handle correctly json body on post
- Use of scan instead of keys, that raised an error when the number of keys is high
- Creature_id endpoint overriding rarities, families, size, alignment etc
- Encounter info returning impossible on trivial encounters
- Pagination taking more element than requested
- Ln string not in caps
- Encounter info broken with negative enemies
- Set filtering was doing union operation instead of intersection
- Filter correctly vectors containing integer with value < -1

[1.3.0]: https://github.com///compare/v1.2.0..v1.3.0
[1.2.0]: https://github.com///compare/v1.0.0..v1.2.0

<!-- generated by git-cliff -->
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Browse and filter a list of all creatures.
- Balance encounters based on your party size and level.
- Generate random encounters based on your requirements.
- Support for both remaster and legacy content.
- More to come...

## Requirements
Expand All @@ -28,7 +29,7 @@ Built using:
## Installation guide - Local

1. Install [Rust](https://www.rust-lang.org/tools/install) on your machine.
2. Populate the SQLite database.
2. Populate the SQLite database (public release date TBA).
3. Clone this repository:

```
Expand Down
78 changes: 78 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# git-cliff ~ configuration file
# https://git-cliff.org/docs/configuration

[changelog]
# changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
"""
body = """
{% if version -%}
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else -%}
## [Unreleased]
{% endif -%}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
# template for the changelog footer
footer = """
{% for release in releases -%}
{% if release.version -%}
{% if release.previous.version -%}
[{{ release.version | trim_start_matches(pat="v") }}]: \
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
/compare/{{ release.previous.version }}..{{ release.version }}
{% endif -%}
{% else -%}
[unreleased]: https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
/compare/{{ release.previous.version }}..HEAD
{% endif -%}
{% endfor %}
<!-- generated by git-cliff -->
"""
# remove the leading and trailing whitespace from the templates
trim = true

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^.*: add", group = "Added" },
{ message = "^.*: support", group = "Added" },
{ message = "^.*: remove", group = "Removed" },
{ message = "^.*: delete", group = "Removed" },
{ message = "^feat", group = "Feature"},
{ message = "^doc", group = "Documentation"},
{ message = "^test", group = "Fixed" },
{ message = "^fix", group = "Fixed" },
{ message = "^.*: fix", group = "Fixed" },
{ message = "^.*", group = "Changed" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = true
# regex for matching git tags
tag_pattern = "v[0-9].*"
# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
# regex for ignoring tags
ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
Loading