Skip to content

re-impl cli, tui to do #31

re-impl cli, tui to do

re-impl cli, tui to do #31

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
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
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: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Mihomo
if: false
# ignore as it's same as linux
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
if: false
# ignore as it's only built in a release
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 cross
cargo fetch
- name: Run tests
if: false
# ignore as it's same as linux
run: cd clashtui && cargo test --all --verbose
- name: Build
run: |
cd clashtui
cross build --target=aarch64-unknown-linux-gnu --all-features --verbose --locked
cross build --target=aarch64-unknown-linux-gnu --all-features --release --locked
- name: Build Version
run: echo "Refer to build-linux"
- name: Pre Upload
run: |
mkdir artifacts
mv ./clashtui/target/aarch64-unknown-linux-gnu/release/clashtui ./artifacts/clashtui.arm64.release
mv ./clashtui/target/aarch64-unknown-linux-gnu/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
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
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:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [build-linux, build-linux-arm64, build-windows]
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ./artifacts
- name: UPX compress
run: |
chmod +x ./artifacts/*
curl -OL https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-amd64_linux.tar.xz
tar -xf upx-4.2.4-amd64_linux.tar.xz
cp ./upx-4.2.4-amd64_linux/upx .
./upx ./artifacts/*
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/*