Skip to content

misc

misc #5

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
env:
CARGO_TERM_COLOR: always
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Mihomo
run: |
wget --output-document mihomo.gz https://github.com/MetaCubeX/mihomo/releases/download/v1.18.4/mihomo-linux-amd64-v1.18.4.gz
gunzip mihomo.gz
chmod +x mihomo
nohup ./mihomo -d Example -f Example/basic_clash_config.yaml &
- name: Cache Target
uses: actions/cache@v4
with:
path: |
./clashtui/target
~/.cargo
key: ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
restore-keys: |
ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
ci-${{ runner.os }}-
- name: Download Dependencies
run: cd clashtui && cargo fetch
- name: Run tests
run: cd clashtui && cargo test --all --verbose
- name: Build
run: cd clashtui && cargo build --all-features --verbose --locked && cargo build --all-features --release --locked
- name: Build Version
run: cd clashtui && cargo r --all-features -- -V
- name: Pre Upload
run: |
mkdir artifacts
mv ./clashtui/target/release/clashtui ./artifacts/clashtui.release
mv ./clashtui/target/debug/clashtui ./artifacts/clashtui.debug
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: Linux_Build
path: artifacts
retention-days: 5
build-linux-arm64:
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Mihomo
run: |
wget --output-document mihomo.gz https://github.com/MetaCubeX/mihomo/releases/download/v1.18.4/mihomo-linux-amd64-v1.18.4.gz
gunzip mihomo.gz
chmod +x mihomo
nohup ./mihomo -d Example -f Example/basic_clash_config.yaml &
- name: Cache Target
uses: actions/cache@v4
with:
path: |
./clashtui/target
~/.cargo
key: ci-${{ runner.os }}-arm64-${{ hashFiles('./clashtui/Cargo.lock') }}
restore-keys: |
ci-${{ runner.os }}-arm64-${{ hashFiles('./clashtui/Cargo.lock') }}
ci-${{ runner.os }}-arm64-
- name: Download Dependencies
run: |
cd clashtui
rustup target add aarch64-unknown-linux-gnu
cargo install cargo-zigbuild
curl -OL https://ziglang.org/builds/zig-linux-x86_64-0.14.0-dev.121+ab4c461b7.tar.xz
tar -xf zig-linux-x86_64-0.14.0-dev.121+ab4c461b7.tar.xz
cargo fetch
- name: Run tests
run: cd clashtui && cargo test --all --verbose
- name: Build
run: |
cd clashtui
export PATH=PATH:$PWD/zig-linux-x86_64-0.14.0-dev.121+ab4c461b7/
cargo zigbuild --target aarch64-unknown-linux-gnu.2.17 --all-features --verbose --locked
cargo zigbuild --target aarch64-unknown-linux-gnu.2.17 --all-features --release --locked
- name: Build Version
run: echo "Refer to build-linux"
- name: Pre Upload
run: |
mkdir artifacts
mv ./clashtui/target/release/clashtui ./artifacts/clashtui.arm64.release
mv ./clashtui/target/debug/clashtui ./artifacts/clashtui.arm64.debug
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: Linux_Arm64_Build
path: artifacts
retention-days: 5
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Mihomo
run: |
curl -L https://github.com/MetaCubeX/mihomo/releases/download/v1.18.4/mihomo-windows-amd64-v1.18.4.zip --output mihomo.zip
7z x mihomo.zip
mihomo-windows-amd64.exe -d Example -f Example/basic_clash_config.yaml &
- name: Cache Target
uses: actions/cache@v4
with:
path: |
./clashtui/target
~/.cargo
key: ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
restore-keys: |
ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
ci-${{ runner.os }}-
- name: Download Dependencies
run: cd clashtui && cargo fetch
- name: Check
run: cd clashtui && cargo check --all-features --verbose
# - name: Run tests
# run: cd clashtui && cargo test --all --verbose
- name: Build
run: cd clashtui && cargo build --all-features --verbose && cargo build --all-features --release
- name: Build Version
run: cd clashtui && cargo r --all-features -- -V
- name: Pre Upload
run: |
mkdir artifacts
mv ./clashtui/target/release/clashtui.exe ./artifacts/clashtui.release.exe
mv ./clashtui/target/debug/clashtui.exe ./artifacts/clashtui.debug.exe
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: Windows_Build
path: artifacts
retention-days: 5
release:
runs-on: ubuntu-latest
needs: [build-linux, build-linux-arm64, build-windows]
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ./artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/*