ci: Added Ci to github
Rust CI (Native Install + Cache) / build_and_check (push) Failing after 25s
Rust CI (Native Install + Cache) / test (push) Has been skipped
Rust CI (Native Install + Cache) / docs (push) Has been skipped

This commit is contained in:
Black_Raven committed 2026-03-30 14:42:04 +03:00
1 parent 1411991417
commit 0bb876915b
2 files changed
+137 -53

No files matched your search

+54 -53
View File
@@ -1,100 +1,101 @@
name: Rust CI
on: [push, pull_request]
name: Rust CI (Native Install + Cache)
on:
push:
branches-ignore:
- release
pull_request:
branches-ignore:
- release
env:
CARGO_TERM_COLOR: always
jobs:
check:
build_and_check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
run: |
if ! command -v rustc &> /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
fi
- name: Verify Rust installation
- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Cargo Check & Build
run: |
rustc --version
cargo --version
- name: Build
run: cargo check --verbose
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Verify Rust installation
run: |
rustc --version
cargo --version
- name: Build
run: cargo build --verbose
cargo check --verbose
cargo build --verbose
test:
needs: [check, build]
needs: build_and_check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
run: |
if ! command -v rustc &> /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
fi
- name: Verify Rust installation
run: |
rustc --version
cargo --version
- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Test
- name: Run Tests
run: cargo test --verbose
docs:
needs: [check, build]
needs: build_and_check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
run: |
if ! command -v rustc &> /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
fi
- name: Verify Rust installation
- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build docs
run: |
rustc --version
cargo --version
cargo doc --no-deps --document-private-items
mkdir -p ./docs-output && cp -r target/doc/* ./docs-output/
- name: Build documentation
run: cargo doc --no-deps --document-private-items
- name: Create docs directory
run: mkdir -p ./docs-output && cp -r target/doc/* ./docs-output/
- name: Upload documentation as artifact
uses: actions/upload-artifact@v4
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: rust-documentation
path: ./docs-output/
retention-days: 30
if-no-files-found: error
retention-days: 7
+83
View File
@@ -0,0 +1,83 @@
name: Release Build
on:
push:
branches:
- release
pull_request:
branches:
- release
env:
CARGO_TERM_COLOR: always
# Название вашего приложения из Cargo.toml
APP_NAME: "UIrclone"
jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
suffix: ""
binary_path: "target/x86_64-unknown-linux-gnu/release"
- target: x86_64-pc-windows-gnu
suffix: ".exe"
binary_path: "target/x86_64-pc-windows-gnu/release"
- target: x86_64-apple-darwin
suffix: ""
binary_path: "target/x86_64-apple-darwin/release"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install System Dependencies
run: |
sudo apt-get update
# Зависимости для egui/eframe на Linux
sudo apt-get install -y libwayland-dev libxkbcommon-dev libegl1-mesa-dev libgbm-dev
# Инструменты кросс-компиляции
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
sudo apt-get install -y gcc-mingw-w64
fi
- name: Install Rust & Target
run: |
if ! command -v rustc &> /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
source $HOME/.cargo/env
fi
rustup target add ${{ matrix.target }}
- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.target }}-release-
- name: Build Binary
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare Artifact
run: |
mkdir -p ./out
# Копируем бинарник
cp "${{ matrix.binary_path }}/${{ env.APP_NAME }}${{ matrix.suffix }}" ./out/
# Копируем ассеты (шрифты), так как они нужны приложению в рантайме
cp -r assets ./out/assets
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.APP_NAME }}-${{ matrix.target }}
path: ./out/
retention-days: 5