ci: Added Ci to github
This commit is contained in:
1 parent
1411991417
commit
0bb876915b
2 files changed
+159
-75
No files matched your search
+76
-75
@@ -1,100 +1,101 @@
|
|||||||
name: Rust CI
|
name: Rust CI (Native Install + Cache)
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- release
|
||||||
|
pull_request:
|
||||||
|
branches-ignore:
|
||||||
|
- release
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
build_and_check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
run: |
|
run: |
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
if ! command -v rustc &> /dev/null; then
|
||||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
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
|
||||||
run: |
|
uses: actions/cache@v3
|
||||||
rustc --version
|
with:
|
||||||
cargo --version
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-cargo-
|
||||||
|
|
||||||
- name: Build
|
- name: Cargo Check & Build
|
||||||
run: cargo check --verbose
|
run: |
|
||||||
|
cargo check --verbose
|
||||||
build:
|
cargo build --verbose
|
||||||
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
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
needs: [check, build]
|
needs: build_and_check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
run: |
|
run: |
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
if ! command -v rustc &> /dev/null; then
|
||||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
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
|
||||||
run: |
|
uses: actions/cache@v3
|
||||||
rustc --version
|
with:
|
||||||
cargo --version
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- name: Test
|
- name: Run Tests
|
||||||
run: cargo test --verbose
|
run: cargo test --verbose
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
needs: [check, build]
|
needs: build_and_check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
run: |
|
run: |
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
if ! command -v rustc &> /dev/null; then
|
||||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
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
|
||||||
run: |
|
uses: actions/cache@v3
|
||||||
rustc --version
|
with:
|
||||||
cargo --version
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- name: Build documentation
|
- name: Build docs
|
||||||
run: cargo doc --no-deps --document-private-items
|
run: |
|
||||||
|
cargo doc --no-deps --document-private-items
|
||||||
- name: Create docs directory
|
mkdir -p ./docs-output && cp -r target/doc/* ./docs-output/
|
||||||
run: mkdir -p ./docs-output && cp -r target/doc/* ./docs-output/
|
|
||||||
|
|
||||||
- name: Upload documentation as artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: rust-documentation
|
|
||||||
path: ./docs-output/
|
|
||||||
retention-days: 30
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: rust-documentation
|
||||||
|
path: ./docs-output/
|
||||||
|
retention-days: 7
|
||||||
@@ -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
|
||||||
Reference in new issue
Block a user