Author SHA1 Message Date
melfely d51aca2ccf ci: Updated Bin toml with version number and gitea regsitry (#9)
Lint & Build / Build (push) Successful in 1m4s
Lint & Build / Linting (push) Successful in 1m57s
Release-plz / Release-plz release (push) Successful in 2m15s
Release-plz / Release-plz PR (push) Successful in 2m15s
Lint & Build / Test (push) Successful in 2m54s
Lint & Build / Cross-Build-Windows (push) Successful in 3m34s
Lint & Build / Cross-Build-Linux (push) Successful in 4m7s
Lint & Build / Cross-Build-MacOS (push) Successful in 4m39s
ZERO idea what happened to the commit that fixed this BEFORE. But whatever.

Reviewed-on: #9
2026-09-11 17:17:08 +00:00
melfely 93a7969315 ci: I guess fixes the syntax of the CI run. (#7)
Lint & Build / Linting (push) Successful in 1m57s
Lint & Build / Build (push) Successful in 1m13s
Lint & Build / Test (push) Successful in 2m41s
Lint & Build / Cross-Build-Windows (push) Successful in 3m18s
Lint & Build / Cross-Build-Linux (push) Successful in 4m1s
Lint & Build / Cross-Build-MacOS (push) Successful in 4m22s
Release-plz / Release-plz PR (push) Successful in 1m32s
Release-plz / Release-plz release (push) Failing after 1m39s
Not actually SURE even why it doesn't work now.

Reviewed-on: #7
2026-09-11 17:03:23 +00:00
melfelyandci-bot b8288087ab Merge in the Release-Plz Setup (#6)
Lint & Build / Linting (push) Successful in 1m23s
Lint & Build / Build (push) Successful in 1m1s
Lint & Build / Test (push) Successful in 1m35s
Lint & Build / Cross-Build-Windows (push) Successful in 2m6s
Lint & Build / Cross-Build-Linux (push) Successful in 2m12s
Lint & Build / Cross-Build-MacOS (push) Successful in 2m48s
This Pull Request will setup the process of Automatic release of everything in the workspace.

Adds in a README.md file.

---------

Co-authored-by: ci-bot <bot@email.melfely.com>
Reviewed-on: #6
Co-authored-by: Melfely <bug362@outlook.com>
2026-09-11 16:48:00 +00:00
melfely 827dda4162 Merge pull request 'ci: Rename Lint Workflow' (#2) from melfely/rename-workflow into master
Lint & Build / Linting (push) Successful in 1m14s
Lint & Build / Build (push) Successful in 1m1s
Lint & Build / Cross-Build-Windows (push) Successful in 1m56s
Lint & Build / Cross-Build-Linux (push) Successful in 2m27s
Lint & Build / Cross-Build-MacOS (push) Successful in 2m54s
Lint & Build / Test (push) Successful in 1m12s
Reviewed-on: #2
2026-09-10 23:28:32 +00:00
melfely 6d48820a7e ci: Rename Lint Workflow
Lint & Build / Linting (pull_request) Successful in 1m17s
Lint & Build / Build (pull_request) Successful in 55s
Lint & Build / Cross-Build-Linux (pull_request) Successful in 2m5s
Lint & Build / Cross-Build-MacOS (pull_request) Successful in 2m44s
Lint & Build / Test (pull_request) Successful in 1m17s
Lint & Build / Cross-Build-Windows (pull_request) Successful in 1m27s
The name was too long, and looks bad in most of the Gitea UI elements, a shorter name will be much better.
2026-09-10 20:32:06 +00:00
melfely 32d1e2cd29 ci: Added lint.yml which tests for linting and build on multiple platforms
Crossplatform Linting && Build / Test (pull_request) Successful in 1m15s
Crossplatform Linting && Build / Test (push) Successful in 1m31s
Crossplatform Linting && Build / Cross-Build-Windows (push) Successful in 2m11s
Crossplatform Linting && Build / Cross-Build-Linux (push) Successful in 2m42s
Crossplatform Linting && Build / Cross-Build-MacOS (push) Successful in 3m2s
Crossplatform Linting && Build / Linting (pull_request) Successful in 1m20s
Crossplatform Linting && Build / Build (pull_request) Successful in 59s
Crossplatform Linting && Build / Cross-Build-Windows (pull_request) Successful in 1m58s
Crossplatform Linting && Build / Cross-Build-Linux (pull_request) Successful in 2m30s
Crossplatform Linting && Build / Cross-Build-MacOS (pull_request) Successful in 2m50s
Crossplatform Linting && Build / Linting (push) Successful in 1m15s
Crossplatform Linting && Build / Build (push) Successful in 1m5s
This uses a 3 step process

Lint -> Linux x86 Build -> [Linux x86 Test, Windows x86 Build, MacOS Check, Linux aarch64 Build]

The build steps being seperate from the linux build is so that its clear WHICH OS is preventing the build, along with if it doesn't build for linux x86 (MY dev machines) then there is ZERO point in checking other OS since all of my work happens on linux x86. This reduces Runtime on just outright bad pull-requests. Then we have plenty of runners, so we can easily run all 4 of the other jobs in the final step in parallel.

The MacOS steps includes a build BUT will pass regardless of its output, because the build step for MacOS is fairly unrelaible, so this relies on a check only.

The main difference between a check and a builds is that build calls the linker, while the check does not. Since the linker commonly fails in a cross-compile, while check verifies the rust code itself is techincally compatible with the OS. (IE no dependencies outright do not support the target). Which is a good enough for the most part.
2026-09-10 14:27:13 -05:00
13 changed files with 312 additions and 54 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
[registries.gitea] [registries.gitea]
index = "sparse+https://gitea.example.com/api/packages/crates/cargo/" index = "sparse+https://gitea.melfely.com/api/packages/crates/cargo/"
+89 -39
View File
@@ -1,4 +1,4 @@
name: Crossplatform Linting && Build name: Lint & Build
on: on:
push: push:
@@ -20,33 +20,20 @@ jobs:
components: rustfmt, clippy components: rustfmt, clippy
- name: Install cargo sort - name: Install cargo sort
uses: taiki-e/cache-cargo-install-action@v3 # v3 uses: taiki-e/install-action@v2
with: with:
tool: cargo-sort tool: cargo-sort
- name: Install cargo machete - name: Install cargo machete
uses: taiki-e/cache-cargo-install-action@v3 # v3 uses: taiki-e/install-action@v2
with: with:
tool: cargo-machete tool: cargo-machete
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-lint-
- name: Check formatting - name: Check formatting
run: cargo fmt --check run: cargo fmt --check
- name: Check import sorting - name: Check import sorting
run: cargo sort --grouped --check --check-format run: cargo sort --workspace --grouped --check --check-format
- name: Check for unused dependencies - name: Check for unused dependencies
run: cargo machete run: cargo machete
@@ -68,33 +55,96 @@ jobs:
with: with:
targets: x86_64-unknown-linux-musl targets: x86_64-unknown-linux-musl
- name: Install Cross
uses: taiki-e/cache-cargo-install-action@v3 # v3
with:
tool: cargo-cross
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-lint-
- name: Build for Linux x86 (GNU and MUSL) - name: Build for Linux x86 (GNU and MUSL)
run: | run: |
cargo build --target x86_64-unknown-linux-gnu --release --locked cargo build --target x86_64-unknown-linux-gnu --release --locked
cargo build --target x86_64-unknown-linux-musl --release --locked cargo build --target x86_64-unknown-linux-musl --release --locked
- name: Build for Linux aarch64 (GNU and MUSL)
cross_build_linux:
name: Cross-Build-Linux
runs-on: ubuntu-latest
needs: [lint, build]
steps:
- name: Checkout Project
uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Crosscompile for aarch64 linux, windows, macos
uses: zijiren233/cargo-cross@v1
with:
targets: |
aarch64-unknown-linux-musl
aarch64-unknown-linux-gnu
cross_build_windows:
name: Cross-Build-Windows
runs-on: ubuntu-latest
needs: [lint, build]
steps:
- name: Checkout Project
uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Crosscompile for targets
uses: zijiren233/cargo-cross@v1
with:
targets: |
x86_64-pc-windows-gnu
cross_Build_osx:
name: Cross-Build-MacOS
runs-on: ubuntu-latest
needs: [lint, build]
steps:
- name: Checkout Project
uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
# CrossCheck for MacOS first, which checks for a valid rust project on MacOS
- name: Crosscheck for MacOS
uses: zijiren233/cargo-cross@v1
with:
command: check
targets: |
aarch64-apple-darwin
# MacOS is known for having a problematic linker step from linux, we should not fail the job if this fails, but this Workflow ALSO has the seperate cargo check
- name: Crosscompile for targets
continue-on-error: true
uses: zijiren233/cargo-cross@v1
with:
targets: |
aarch64-apple-darwin
test_linux:
name: Test
runs-on: ubuntu-latest
needs: [build, lint]
steps:
- name: Checkout Project
uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Test for Linux x86 (GNU and MUSL)
run: | run: |
cargo cross --target aarch64-unknown-linux-gnu --release --locked cargo test --target x86_64-unknown-linux-gnu --release --locked
cargo cross --target aarch64-unknown-linux-musl --release --locked cargo test --target x86_64-unknown-linux-musl --release --locked
+81
View File
@@ -0,0 +1,81 @@
name: Release-plz
on:
push:
branches: [main, master]
jobs:
# Release unpublished packages.
release-plz-release:
name: Release-plz release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- &setup-git-user
name: Config Git User
run: |
git config --global user.name "ci-bot"
git config --global user.email "bot@email.melfely.com"
- &checkout
name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- &install-rust
name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- &install-cargo-semver
name: Install Cargo SemVer Checks
uses: taiki-e/install-action@fa23953489c080190314742a9b907f8e97c6767c # v2.87.10
with:
tool: cargo-semver-checks
- &install-release-plz
name: Install release-plz
uses: taiki-e/install-action@fa23953489c080190314742a9b907f8e97c6767c # v2.87.10
with:
tool: release-plz
- name: Run release-plz release
run: |
release-plz release --forge gitea --git-token ${{ secrets.GITEA_TOKEN }} --registry gitea --token "Bearer ${{ secrets.CARGO_REGISTRIES_GITEA_TOKEN }}"
# Create a PR with the new versions and changelog, preparing the next releases
release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- *setup-git-user
- *checkout
- *install-rust
- *install-cargo-semver
- *install-release-plz
- name: Fill Credentials
run: |
git config --global credential.helper store
echo "https://ci-bot:${{ secrets.GITEA_TOKEN }}@gitea.melfely.com" > ~/.git-credentials
- name: Run release-plz release-pr
run: |
release-plz release-pr --forge gitea --git-token ${{ secrets.GITEA_TOKEN }} --registry gitea
Generated
+9 -2
View File
@@ -3,5 +3,12 @@
version = 4 version = 4
[[package]] [[package]]
name = "temp" name = "example_bin"
version = "0.1.0" version = "0.1.1"
dependencies = [
"example_lib",
]
[[package]]
name = "example_lib"
version = "0.1.1"
+3 -6
View File
@@ -1,6 +1,3 @@
[package] [workspace]
name = "temp" resolver = "3"
version = "0.1.0" members = ["example_bin", "example_lib"]
edition = "2024"
[dependencies]
+56 -2
View File
@@ -1,3 +1,57 @@
# rust_workflow_template # Rust Workspace Template with Pre-Configured Workflows
This Setup does ALOT of checking and analyis before letting you push to main/master. Requiring a massive amount of Cross-Platform support.
## Why?
This automates everything from linting, to CI/CD. This allows us to just work on projects, as long as we follow the rules, without having to worry about deployement.
Fully automating out an entire departement in most companies called DevOps.
**You just need to pay attention to the following**
## How to use properly.
This is an EXAMPLE workspace, look around at the how the Cargo.Toml files are setup, they are important. Once you get comfortable, delete the existing stuff, and start making your own.
A few major points.
### Git Commits
This uses a tool to auto generate change logs and version indexing. As LONG as you feed it good data, one of such requirements are good commits
This project **REQUIRES** you to use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format. This allows for a whole HOST of good automated tooling. That you will love, in comparison to doing it all by hand. WHILE adding a bit of a requirement to making good split up commits.
Any commits **not** following this standard should be rejected or reworded. If a commit is *to large* or some other problem to not fit the mold. Then change the commit, do **NOT** break the rules.
### Gitea Registry
We don't publish to crates.io, instead we publish to the pre-configured gitea crates repo. Which keeps everything private. Does have the disadvantage of reqiuring a bit of extra work to use.
In the example_bin Cargo.toml file you can see
```toml
example_lib = { version = "0.1.1", path = "../example_lib", registry = "gitea" }
```
This line is VERY important, it uses a PATH based dependency to find the project. Which allows for it to be live.
Note that the version number will need to be updated, along WITH the fact that you need to make sure that it uses the "gitea" regsitry here as well. That is where cargo will expect to find it at later.
### Workspace
in the root level Cargo.toml is the workspace config
```toml
[workspace]
resolver = "3"
members = ["example_bin", "example_lib"]
```
notice how it LISTS all the crates that are members of the workspace? That is important!
### Cargo Lock files
All of the workflow tools remotely use --locked versions of cargo build and check, so therefore it **CANNOT** update the lock files.
The lock files are what versions of a package you are using when it was built. This is all about the philophsy of [reproducible builds](https://reproducible-builds.org/)
Rust Cargo Template with CI/CD Setup.
+14
View File
@@ -0,0 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.1.1](https://gitea.melfely.com/melfely/rust_workflow_template/compare/example_bin-v0.1.0...example_bin-v0.1.1) - 2026-09-11
### Added
- bin example now references the local example_lib
+7
View File
@@ -0,0 +1,7 @@
[package]
name = "example_bin"
version = "0.1.1"
edition = "2024"
[dependencies]
example_lib = { version = "0.1.0", path = "../example_lib", registry = "gitea" }
+11
View File
@@ -0,0 +1,11 @@
use example_lib::*;
fn main() {
println!("Hello, world!");
let result = add(1, 1);
assert_eq!(result, 2);
let result = sub(1, 1);
assert_eq!(result, 0);
}
+14
View File
@@ -0,0 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.1.1](https://gitea.melfely.com/melfely/rust_workflow_template/compare/example_lib-v0.1.0...example_lib-v0.1.1) - 2026-09-11
### Added
- added pub fn sub()
+6
View File
@@ -0,0 +1,6 @@
[package]
name = "example_lib"
version = "0.1.1"
edition = "2024"
[dependencies]
+20
View File
@@ -0,0 +1,20 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}
pub fn sub(left: u64, right: u64) -> u64 {
left - right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
let result = sub(2, 2);
assert_eq!(result, 0);
}
}
-3
View File
@@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}