fixup! Fix permissions of file in clash_cfg_dir. Add updating provide… #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
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.0/mihomo-linux-amd64-v1.18.0.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 --verbose --locked && cargo build --release --locked | |
- name: Build Version | |
run: cd clashtui && cargo r -- -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-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.1/mihomo-windows-amd64-v1.18.1.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: Run tests | |
# run: cd clashtui && cargo test --all --verbose | |
- name: Build | |
run: cd clashtui && cargo build --verbose && cargo build --release | |
- name: Build Version | |
run: cd clashtui && cargo r -- -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-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/* |