Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Kogia-sima committed Jan 23, 2021
2 parents aae9caf + 5209876 commit c226f4b
Show file tree
Hide file tree
Showing 45 changed files with 822 additions and 331 deletions.
22 changes: 22 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- 'help wanted'
- 'Status: Blocked'
- 'Status: In Progress'
- 'Status: PR Welcome'
- 'Status: Proposal'
- 'Status: Review Needed'
- 'Type: Bug'
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
29 changes: 29 additions & 0 deletions .github/workflows/badge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Badges

on:
push:
branches:
- master
paths:
- '**/Cargo.toml'

jobs:
update-badges:
name: Update Badges
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Kogia-sima' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Get the Numbers
run: |
echo "dep_counts=$(./scripts/count-dependencies.sh)" >> $GITHUB_ENV
- name: Create Dependency-Count-Badge
uses: schneegans/dynamic-badges-action@v1.0.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: a2128afe12bf05d85a0d68346236a4f5
filename: sailfish-dep-counts.json
label: Dependencies
message: ${{ env.dep_counts }}
color: blueviolet
41 changes: 41 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Coverage

on: [push, pull_request]

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: x86_64-unknown-linux-gnu
toolchain: nightly
override: true
components: rustfmt
- name: Install grcov
run: curl -L https://github.com/mozilla/grcov/releases/download/v0.6.1/grcov-linux-x86_64.tar.bz2 | tar jxf -
- name: Install rust-covfix
run: |
curl -L https://github.com/Kogia-sima/rust-covfix/releases/download/v0.2.2/rust-covfix-linux-x86_64.tar.xz |tar Jxf -
mv rust-covfix-linux-x86_64/rust-covfix ./
- name: Test all crates
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -C panic=abort
RUSTDOCFLAGS: -C panic=abort
run: |
cargo build --all-features --workspace
cargo test --all-features --workspace
- name: collect coverages
run: |
zip -0 ccov.zip `find . \( -name "sailfish*.gc*" -o -name "integration_tests*.gc*" \) -print`
./grcov ccov.zip --llvm --branch -t lcov -o lcov.info --ignore "/*" --ignore "sailfish-tests/*"
- name: fix coverages
run: ./rust-covfix -o lcov.info lcov.info
- name: upload coverage
uses: codecov/codecov-action@v1
with:
file: ./lcov.info
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
toolchain: 1.42.0 # MSRV
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
toolchain: nightly
- os: ubuntu-latest
deps: sudo apt update ; sudo apt install gcc-multilib
target: i686-unknown-linux-gnu
Expand Down
40 changes: 38 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,48 @@
<a name="v0.3.0"></a>
## [v0.3.0](https://github.com/Kogia-sima/sailfish/compare/v0.2.2...v0.3.0) (2020-12-20)

## Breaking changes

* No longer requires `extern crate sailfish_macros` (which raise compilation warnings with v0.3.0)
* Remove `TemplaceOnce::render_to_string` method (already deprecated in v0.2.1)
* Forbid implementing `TemplateOnce` trait by yourself
* Change `RenderError` into enum
* Update error format in `sailfish-compiler`

## New features

* New filters: `json`, `truncate`
* Impl `Send`/`Sync` for `Buffer`

## Fix

* Fix rendering issue on continue/break statements
* Do not panic when buffer size decreased
* Remove unsafe usage of `ptr::add()`
* Properly handle slices with size greater than `isize::MAX`

<a name="v0.2.3"></a>
## [v0.2.3](https://github.com/Kogia-sima/sailfish/compare/v0.2.2...v0.2.3) (2020-11-29)

## Fix

* Use `std::result::Result` in derive macro to allow custom Result types (#34)

<a name="v0.2.2"></a>
## [v0.2.2](https://github.com/Kogia-sima/sailfish/compare/v0.2.1...v0.2.2) (2020-11-11)

## Fix

* Update proc-macro2 version (#32)

<a name="v0.2.1"></a>
## [v0.2.1](https://github.com/Kogia-sima/sailfish/compare/v0.2.0...v0.2.1) (2020-07-17)
## [v0.2.1](https://github.com/Kogia-sima/sailfish/compare/v0.2.0...v0.2.1) (2020-08-04)

### Features

* Add trim filter

### Bug fix
### Fix

* Fix incorrect syntax highlighting in vim
* Avoid capacity overflow in `Buffer::with_capacity`
Expand Down
48 changes: 44 additions & 4 deletions Cargo.lock

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

21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Simple, small, and extremely fast template engine for Rust

[![Tests](https://github.com/Kogia-sima/sailfish/workflows/Tests/badge.svg)](https://github.com/Kogia-sima/sailfish/actions?query=workflow%3ATests)
[![Version](https://img.shields.io/crates/v/sailfish)](https://crates.io/crates/sailfish)
![Dependency counts](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Kogia-sima/a2128afe12bf05d85a0d68346236a4f5/raw/sailfish-dep-counts.json)
[![dependency status](https://deps.rs/repo/github/Kogia-sima/sailfish/status.svg)](https://deps.rs/repo/github/Kogia-sima/sailfish)
[![Rust 1.42](https://img.shields.io/badge/rust-1.42+-lightgray.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.42.html)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Kogia-sima/sailfish/blob/master/LICENSE)

[User Guide](https://sailfish.netlify.app/en/) | [API Docs](https://docs.rs/sailfish) | [Examples](./examples)
Expand All @@ -15,12 +18,12 @@ Simple, small, and extremely fast template engine for Rust
## ✨ Features

- Simple and intuitive syntax inspired by [EJS](https://ejs.co/)
- Builtin filters
- Relatively small number of dependencies (<15 crates in total)
- Include another template file inside template
- Built-in filters
- Minimal dependencies (<15 crates in total)
- Extremely fast (See [benchmarks](https://github.com/djc/template-benchmarks-rs))
- Better error message
- Syntax highlighting support ([vscode](./syntax/vscode), [vim](./syntax/vim))
- Automatically re-compile sources when template file is updated.
- Works on Rust 1.42 or later

## 🐟 Example
Expand All @@ -29,8 +32,7 @@ Dependencies:

```toml
[dependencies]
sailfish = "0.3.0"
sailfish-macros = "0.3.0"
sailfish = "0.3.1"
```

Template file (templates/hello.stpl):
Expand All @@ -48,9 +50,6 @@ Template file (templates/hello.stpl):
Code:

```rust
#[macro_use]
extern crate sailfish_macros; // enable derive macro

use sailfish::TemplateOnce;

#[derive(TemplateOnce)]
Expand All @@ -61,8 +60,8 @@ struct HelloTemplate {

fn main() {
let ctx = HelloTemplate {
messages: vec![String::from("foo"), String::from("bar")]
}
messages: vec![String::from("foo"), String::from("bar")],
};
println!("{}", ctx.render_once().unwrap());
}
```
Expand All @@ -78,7 +77,7 @@ You can find more examples in [examples](./examples) directory.

🇯🇵 **Ryohei Machida**

* Github: [@Kogia-sima](https://github.com/Kogia-sima)
* GitHub: [@Kogia-sima](https://github.com/Kogia-sima)

## 🤝 Contributing

Expand Down
30 changes: 30 additions & 0 deletions THIRD_PARTY
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Sailfish contains some third-party content.

-------------------------------------------------------------------------------

* Some test data come from TechEmpower Framework Benchmarks

Copyright (c) 2020, TechEmpower, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name TechEmpower, Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL TECHEMPOWER, INC. BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion benches/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
benchmark programs were removed in favor of https://github.com/djc/template-benchmarks-rs
benchmark programs were removed in favour of https://github.com/djc/template-benchmarks-rs
15 changes: 15 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
coverage:
status:
project:
default:
threshold: 3%
branches:
- master
only_pulls: false

patch:
default:
target: auto
branches:
- master
only_pulls: true
Loading

0 comments on commit c226f4b

Please sign in to comment.