Skip to content

Commit

Permalink
Merge pull request #148 from ngyn-rs/dev
Browse files Browse the repository at this point in the history
v0.4.3 - Response Interpretation and API Improvements
  • Loading branch information
elcharitas authored Aug 12, 2024
2 parents 55294fd + 8ca81e0 commit 14f1639
Show file tree
Hide file tree
Showing 32 changed files with 469 additions and 230 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: PR Workflow
on:
pull_request:
types: ready_for_review
types: [ready_for_review]
push:
branches:
- dev
Expand Down
54 changes: 28 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
name: Gituhb release
name: Release
on:
push:
branches: main
branches: [main]

jobs:
release:
name: Perform release
crates_io_publish:
name: Publish (crates.io)
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 25
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: Cocogitto release
id: release
uses: oknozor/cocogitto-action@v3
- name: cargo-release Cache
id: cargo_release_cache
uses: actions/cache@v3
with:
release: true
check-latest-tag-only: true
git-user: ${{ github.actor}}
git-user-email: ${{ github.actor_id }}+${{ github.actor}}@users.noreply.github.com
path: ~/.cargo/bin/cargo-release
key: ${{ runner.os }}-cargo-release

- name: Print version
run: "echo '${{ steps.release.outputs.version }}'"
- run: cargo install cargo-release
if: steps.cargo_release_cache.outputs.cache-hit != 'true'

- name: Generate Changelog
run: cog changelog --at ${{ steps.release.outputs.version }} -t full_hash > GITHUB_CHANGELOG.md
- name: cargo login
run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }}

- name: Upload github release
uses: softprops/action-gh-release@v1
with:
body_path: GITHUB_CHANGELOG.md
tag_name: ${{ steps.release.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
# allow-branch HEAD is because GitHub actions switches
# to the tag while building, which is a detached head
- name: "cargo release publish"
run: |-
cargo release \
publish \
--workspace \
--all-features \
--allow-branch HEAD \
--no-confirm \
--no-verify \
--execute
57 changes: 57 additions & 0 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Bump Version on PR (Rust Workspace)

on:
pull_request:
types: [opened]
branches:
- main

jobs:
bump_version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}

- name: Extract version from PR title
id: extract_version
uses: actions/github-script@v6
with:
script: |
const prTitle = context.payload.pull_request.title;
const versionMatch = prTitle.match(/v(\d+\.\d+\.\d+)/);
if (!versionMatch) {
core.setFailed('No valid semver version found in PR title');
} else {
// if pr title contains "minor" or "major" we bump accordingly
if (prTitle.includes('minor')) {
core.setOutput('version', 'minor');
} else if (prTitle.includes('major')) {
core.setOutput('version', 'major');
} else {
core.setOutput('version', `custom ${versionMatch[1]}`);
}
}
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Bump workspace version
run: |
cargo install cargo-workspaces
cargo workspaces version ${{ steps.extract_version.outputs.version }} --all --allow-branch dev
- name: Commit and push changes
uses: EndBug/add-and-commit@v9
with:
message: "Bump version to ${{ steps.extract_version.outputs.version }}"
add: "*/Cargo.toml"
push: true
branch: dev
default_author: github_actor
github_token: ${{ secrets.GITHUB_TOKEN }}
25 changes: 13 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "ngyn"
version = "0.4.2"
version = "0.4.3"
edition = "2021"
description = "Modular backend framework for web applications"
license = "MIT"
rust-version = "1.63"
rust-version = "1.75"

[lib]
path = "src/lib.rs"
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pub mod prelude {
pub use ngyn_shared::{
core::NgynEngine,
server::{
Body, FullResponse, NgynContext, NgynRequest, NgynResponse, Param, Query, Transducer,
Transformer,
Body, CommonResponse, FullResponse, NgynContext, NgynRequest, NgynResponse, Param,
Query, Transducer, Transformer,
},
traits::{NgynGate, NgynInjectable, NgynMiddleware},
};
Expand Down
1 change: 1 addition & 0 deletions crates/hyper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2021"
description = "Hyper Platform for ngyn web framework"
license = "MIT"
rust-version = "1.75"

[dependencies]
http-body-util = "0.1"
Expand Down
3 changes: 2 additions & 1 deletion crates/macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[package]
name = "ngyn_macros"
version = "0.4.2"
version = "0.4.3"
edition = "2021"
description = "Modular backend framework for web applications"
license = "MIT"
rust-version = "1.75"

[dependencies]
http = "1.1"
Expand Down
3 changes: 0 additions & 3 deletions crates/macros/src/core/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ pub(crate) fn module_macro(args: TokenStream, input: TokenStream) -> TokenStream
fn new() -> Self {
#init_module
}
fn name(&self) -> &str {
stringify!(#ident)
}
fn get_controllers(&self) -> Vec<std::sync::Arc<Box<dyn ngyn::shared::traits::NgynController + 'static>>> {
use ngyn::shared::traits::NgynInjectable;
let mut controllers: Vec<std::sync::Arc<Box<dyn ngyn::shared::traits::NgynController + 'static>>> = vec![#(#add_controllers),*];
Expand Down
3 changes: 2 additions & 1 deletion crates/shared/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[package]
name = "ngyn_shared"
version = "0.4.2"
version = "0.4.3"
edition = "2021"
description = "Modular backend framework for web applications"
license = "MIT"
rust-version = "1.75"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
Loading

0 comments on commit 14f1639

Please sign in to comment.