Skip to content

Commit 091ebc7

Browse files
committed
done
1 parent 6113e63 commit 091ebc7

File tree

10 files changed

+316
-20
lines changed

10 files changed

+316
-20
lines changed

.env

Whitespace-only changes.

.github/workflows/cli.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Before usage
2+
# - Change name of output files
3+
# - Change lint command if needed
4+
5+
name: Release CLI
6+
7+
on:
8+
push:
9+
tags:
10+
- "v*.*.*"
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
BINARY_NAME: change_me
15+
16+
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install stable Rust
23+
uses: dtolnay/rust-toolchain@stable
24+
with:
25+
components: clippy
26+
27+
- name: Cache Rust dependencies
28+
uses: Swatinem/[email protected]
29+
with:
30+
env-vars: "CARGO RUST"
31+
cache-on-failure: true
32+
33+
- name: lint
34+
run: cargo clippy # instruct some packages if needed
35+
36+
build-and-release:
37+
name: Build and Release
38+
runs-on: ${{ matrix.os }}
39+
needs: [lint]
40+
strategy:
41+
matrix:
42+
include:
43+
# linux x64
44+
- os: ubuntu-latest
45+
target: x86_64-unknown-linux-gnu
46+
artifact_name: change_me
47+
asset_name: change_me-linux-amd64
48+
49+
# linux arm
50+
- os: ubuntu-latest
51+
target: aarch64-unknown-linux-gnu
52+
artifact_name: change_me
53+
asset_name: change_me-linux-arm
54+
55+
# windows x64
56+
- os: windows-latest
57+
target: x86_64-pc-windows-gnu
58+
artifact_name: change_me.exe
59+
asset_name: change_me-windows-amd64.exe
60+
61+
# windows arm
62+
- os: windows-latest
63+
target: aarch64-pc-windows-msvc
64+
artifact_name: change_me.exe
65+
asset_name: change_me-windows-arm.exe
66+
67+
# macos x64
68+
- os: macos-latest
69+
target: x86_64-apple-darwin
70+
artifact_name: change_me
71+
asset_name: change_me-macos-amd64
72+
73+
# macos arm
74+
- os: macos-latest
75+
target: aarch64-apple-darwin
76+
artifact_name: change_me
77+
asset_name: change_me-macos-arm
78+
79+
steps:
80+
- uses: actions/checkout@v4
81+
82+
- name: Install Rust
83+
run: rustup toolchain install stable --profile minimal
84+
85+
- name: Add target
86+
run: rustup target add ${{ matrix.target }}
87+
88+
- name: Install Linux ARM dependencies
89+
if: matrix.target == 'aarch64-unknown-linux-gnu'
90+
run: |
91+
sudo apt-get update
92+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
93+
94+
- name: Set linker for Linux ARM
95+
if: matrix.target == 'aarch64-unknown-linux-gnu'
96+
run: |
97+
echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config.toml
98+
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml
99+
100+
- uses: Swatinem/rust-cache@v2
101+
with:
102+
prefix-key: "v0-rust"
103+
shared-key: "${{ matrix.target }}"
104+
cache-on-failure: "true"
105+
cache-all-crates: "true"
106+
workspaces: |
107+
. -> target
108+
cache-targets: "true"
109+
110+
- name: Build
111+
uses: actions-rs/cargo@v1
112+
with:
113+
command: build
114+
args: --release --target ${{ matrix.target }}
115+
116+
- name: Prepare artifact
117+
shell: bash
118+
run: |
119+
mkdir -p artifacts
120+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
121+
cp "target/${{ matrix.target }}/release/${{ matrix.artifact_name }}" "artifacts/${{ matrix.asset_name }}"
122+
else
123+
cp "target/${{ matrix.target }}/release/${{ matrix.artifact_name }}" "artifacts/${{ matrix.asset_name }}"
124+
fi
125+
126+
- name: Upload artifact
127+
uses: actions/upload-artifact@v4
128+
with:
129+
name: ${{ matrix.asset_name }}
130+
path: artifacts/${{ matrix.asset_name }}
131+
132+
create-release:
133+
needs: build-and-release
134+
runs-on: ubuntu-latest
135+
steps:
136+
- name: Download artifacts
137+
uses: actions/download-artifact@v4
138+
139+
- name: Create Release
140+
id: create_release
141+
uses: softprops/action-gh-release@v2
142+
with:
143+
files: |
144+
change_me-linux-amd64/change_me-linux-amd64
145+
change_me-windows-amd64.exe/change_me-windows-amd64.exe
146+
change_me-macos-amd64/change_me-macos-amd64
147+
change_me-linux-arm/change_me-linux-arm
148+
change_me-windows-arm.exe/change_me-windows-arm.exe
149+
change_me-macos-arm/change_me-macos-arm
150+
draft: false
151+
prerelease: false
152+
generate_release_notes: true
153+
append_bode: true
154+
make_latest: true
155+
env:
156+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
# change for your branch name
7+
- main
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
BINARY_NAME: change_me
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install stable Rust
20+
uses: dtolnay/rust-toolchain@stable
21+
with:
22+
components: clippy
23+
24+
- name: Cache Rust dependencies
25+
uses: Swatinem/[email protected]
26+
with:
27+
env-vars: "CARGO RUST"
28+
cache-on-failure: true
29+
30+
- name: lint
31+
run: cargo clippy # instruct some packages if needed

.gitignore

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
1-
# Generated by Cargo
2-
# will have compiled files and executables
31
debug
4-
target
5-
6-
# These are backup files generated by rustfmt
7-
**/*.rs.bk
8-
9-
# MSVC Windows builds of rustc generate these, which store debugging information
10-
*.pdb
11-
12-
# Generated by cargo mutants
13-
# Contains mutation testing data
14-
**/mutants.out*/
15-
16-
# RustRover
17-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
18-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
19-
# and can be added to the global gitignore or merged into this file. For a more nuclear
20-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
21-
#.idea/
2+
**/target
3+
**/dist
4+
**/.DS_Store
5+
**/Cargo.lock

Cargo.toml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
[package]
3+
name = "change_me"
4+
version = "0.0.1"
5+
edition = "2024"
6+
authors = ["TOwInOK <[email protected]>"]
7+
repository = "change_me"
8+
license = "MIT" #"Apache-2.0"
9+
10+
[dependencies]
11+
# serde = { version = "^1", features = ["derive"] }
12+
# serde_json = { version = "1" }
13+
# ron = "^0.10"
14+
# tracing = "^0.1"
15+
# tracing-subscriber = "^0.3"
16+
# anyhow = "^1"
17+
# tokio = { version = "^1", features = ["full"] }
18+
# thiserror = "^2"
19+
20+
21+
[profile.dev]
22+
opt-level = 0
23+
debug = true
24+
strip = "none"
25+
debug-assertions = true
26+
overflow-checks = true
27+
lto = false
28+
panic = 'unwind'
29+
incremental = true
30+
codegen-units = 256
31+
rpath = false
32+
33+
[profile.release]
34+
opt-level = 'z'
35+
debug = false
36+
lto = true
37+
codegen-units = 24
38+
panic = 'abort'
39+
strip = true
40+
incremental = true
41+
debug-assertions = false
42+
overflow-checks = false
43+
44+
[profile.test]
45+
opt-level = 0
46+
debug = true
47+
48+
[profile.bench]
49+
opt-level = 3
50+
debug = false
51+
52+
[profile.wasm-release]
53+
inherits = "release"
54+
opt-level = 'z'
55+
lto = true
56+
codegen-units = 1

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
11
# rust-template-default
22
Default project template for rust project with my credentials
3+
4+
# Contains
5+
- CI/CD pipeline on tag `v*.*.*`
6+
- CI link on every push
7+
- Test folder
8+
- License (MIT)
9+
- .env file
10+
- Configurated Cargo.toml
11+
- Configurated .gitignore
12+
- Configurated .rust-toolchain.toml
13+
- Configurated .rustfmt.toml
14+
15+
---
16+
17+
# Name of packet
18+
19+
## Description
20+
21+
## How to use
22+
```sh
23+
24+
```
25+
26+
## Examples
27+
28+
## How to build
29+
```sh
30+
git clone repo-url
31+
cd repo-name
32+
cargo build
33+
```
34+
35+
## License
36+
MIT License

rust-toolchain.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[toolchain]
2+
channel = "stable"

rustfmt.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
max_width = 100
3+
fn_params_layout = "Vertical"
4+
array_width = 60
5+
attr_fn_like_width = 70
6+
chain_width = 60
7+
fn_call_width = 60
8+
struct_lit_width = 10
9+
struct_variant_width = 35
10+
11+
use_small_heuristics = "Max"
12+
13+
use_field_init_shorthand = true
14+
use_try_shorthand = true
15+
16+
match_block_trailing_comma = false
17+
18+
match_arm_leading_pipes = "Preserve"
19+
20+
reorder_imports = true
21+
reorder_modules = true
22+
23+
remove_nested_parens = true

src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("bruh...");
3+
}

tests/example.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[cfg(test)]
2+
mod tests {
3+
#[test]
4+
fn example() {
5+
assert_eq!(2 + 2, 4);
6+
}
7+
}

0 commit comments

Comments
 (0)