Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuri6037 authored Sep 25, 2023
0 parents commit 06e2b43
Show file tree
Hide file tree
Showing 7 changed files with 280 additions and 0 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/development.yml
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 }}
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
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 }})"
14 changes: 14 additions & 0 deletions .gitignore
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
19 changes: 19 additions & 0 deletions Cargo.toml
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]

27 changes: 27 additions & 0 deletions LICENSE.txt
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.
3 changes: 3 additions & 0 deletions README.MD
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
28 changes: 28 additions & 0 deletions src/lib.rs
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.

0 comments on commit 06e2b43

Please sign in to comment.