generated from BlockProject3D/template.rust-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 06e2b43
Showing
7 changed files
with
280 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
name: Development | ||
|
||
on: | ||
- push | ||
- workflow_dispatch | ||
|
||
jobs: | ||
test-build: | ||
name: Build & Test | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-20.04 | ||
- macos-11 | ||
- windows-2019 | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Build | ||
run: cargo build --all-features | ||
- name: Test | ||
uses: bp3d-actions/cargo@main | ||
with: | ||
check-name: cargo test (${{ matrix.os }}) | ||
command: test | ||
args: --all-features --no-fail-fast | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
clippy: | ||
name: Check | Clippy | ||
if: ${{ always() }} | ||
needs: test-build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: clippy | ||
- name: Run check | ||
uses: bp3d-actions/clippy-check@main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --all-features | ||
|
||
audit: | ||
name: Check | Audit | ||
if: ${{ always() }} | ||
needs: test-build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Install Audit Tool | ||
run: cargo install cargo-audit | ||
- name: Run check | ||
uses: bp3d-actions/audit-check@main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
fmt: | ||
name: Format Code | ||
if: ${{ always() && github.ref != 'refs/heads/master' }} | ||
needs: | ||
- clippy | ||
- audit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
- name: Run code formatter | ||
uses: bp3d-actions/rustfmt-check@main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
version: | ||
name: Get Version | ||
needs: test-build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
name: ${{ steps.version.outputs.name }} | ||
version: ${{ steps.version.outputs.version }} | ||
isnew: ${{ steps.version.outputs.isnew }} | ||
ispre: ${{ steps.version.outputs.ispre }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Get Version | ||
id: version | ||
uses: bp3d-actions/cargo-version@main | ||
with: | ||
mode: get | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
create-pre-release: | ||
name: Create Pre Release | ||
needs: version | ||
if: github.ref == 'refs/heads/develop' && needs.version.outputs.isnew == 'true' && needs.version.outputs.ispre == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Setup cargo | ||
run: cargo login ${{ secrets.RELEASE_TOKEN }} | ||
- name: Publish | ||
run: cargo publish | ||
- name: Create | ||
uses: ncipollo/release-action@main | ||
with: | ||
tag: ${{ needs.version.outputs.version }} | ||
commit: ${{ github.ref }} | ||
prerelease: true | ||
name: ${{ needs.version.outputs.name }} release ${{ needs.version.outputs.version }} | ||
body: "[Link to crates.io](https://crates.io/crates/${{ needs.version.outputs.name }})" | ||
|
||
create-release-pr: | ||
name: Create Release Pull Request | ||
needs: version | ||
if: needs.version.outputs.isnew == 'true' && needs.version.outputs.ispre == 'false' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Create Pull Request | ||
uses: repo-sync/pull-request@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
destination_branch: master | ||
pr_title: Release ${{ needs.version.outputs.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
version: | ||
name: Get Version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
name: ${{ steps.version.outputs.name }} | ||
version: ${{ steps.version.outputs.version }} | ||
isnew: ${{ steps.version.outputs.isnew }} | ||
ispre: ${{ steps.version.outputs.ispre }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Get Version | ||
id: version | ||
uses: bp3d-actions/cargo-version@main | ||
with: | ||
mode: get | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
create-release: | ||
name: Release | ||
needs: version | ||
if: needs.version.outputs.isnew == 'true' && needs.version.outputs.ispre == 'false' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Setup cargo | ||
run: cargo login ${{ secrets.RELEASE_TOKEN }} | ||
- name: Publish | ||
run: cargo publish | ||
- name: Create | ||
uses: ncipollo/release-action@main | ||
with: | ||
tag: ${{ needs.version.outputs.version }} | ||
commit: ${{ github.ref }} | ||
prerelease: false | ||
name: ${{ needs.version.outputs.name }} release ${{ needs.version.outputs.version }} | ||
body: "[Link to crates.io](https://crates.io/crates/${{ needs.version.outputs.name }})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Binary directory | ||
target | ||
|
||
# Temporary CI file | ||
versionfile.txt | ||
|
||
# IDE files | ||
.idea | ||
.vscode | ||
|
||
# Apple specific | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "test" | ||
version = "0.0.1" | ||
authors = ["Yuri Edward <[email protected]>"] | ||
edition = "2021" | ||
description = "A library template." | ||
license = "BSD-3-Clause" | ||
repository = "https://github.com/BlockProject3D/template.rust-lib" | ||
readme = "./README.MD" | ||
keywords = [] | ||
categories = [] | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
|
||
|
||
[features] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2021, BlockProject 3D | ||
|
||
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 of BlockProject 3D 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 THE COPYRIGHT OWNER OR | ||
CONTRIBUTORS 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
![logo](https://avatars.githubusercontent.com/u/45798939?s=200&v=4) | ||
|
||
# Rust library template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2021, BlockProject 3D | ||
// | ||
// 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 of BlockProject 3D 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 THE COPYRIGHT OWNER OR | ||
// CONTRIBUTORS 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. | ||
|