Skip to content

Commit

Permalink
doc: add changelog and changelog CI (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
RakuJa authored Jun 1, 2024
1 parent a506f49 commit 69b4bce
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 18 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/clippy.yml

This file was deleted.

10 changes: 7 additions & 3 deletions .github/workflows/fmt.yml → .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
on: pull_request
on:
pull_request:
types: [opened, synchronize, edited, review_requested, ready_for_review]
name: PR

name: Rustfmt
permissions:
contents: read

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

permissions:
contents: read

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 }}
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
on:
release:
types:
- published

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: Create Changelog Branch
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
set +e
git switch -c update_changelog
git add CHANGELOG.md
git commit --no-verify -m "Update changelog after release"
git push -f https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git update_changelog
- name: Create Changelog Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update changelog after release
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
signoff: false
base: master
branch: update_changelog
delete-branch: true
title: 'Update changelog after release'
body: |
Automatic changelog update using git cliff
- Auto-generated after latest release
:artificial_satellite: :rocket: :newspaper:
labels: |
documentation
assignees: RakuJa
reviewers: RakuJa
draft: false
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
77 changes: 77 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 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" },
]
# 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 = ""
# 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"

0 comments on commit 69b4bce

Please sign in to comment.