🐎 ci: modify action on paths and split the steps (#96)

* 🐎 ci: modify action on paths and split the steps
This commit is contained in:
m1m1sha
2024-05-10 17:44:16 +08:00
committed by GitHub
parent bee9565225
commit 2a728482fa
3 changed files with 250 additions and 60 deletions

61
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
name: EasyTier Test
on:
push:
branches: ["develop", "main"]
paths:
- "easytier.toml"
- "easytier/**"
- "easytier-gui/**"
- ".github/workflows/test.yml"
pull_request:
branches: ["develop", "main"]
paths:
- "easytier.toml"
- "easytier/**"
- "easytier-gui/**"
- ".github/workflows/test.yml"
env:
CARGO_TERM_COLOR: always
defaults:
run:
# necessary for windows
shell: bash
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup protoc
uses: arduino/setup-protoc@v2
with:
# GitHub repo token to use to avoid rate limiter
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup tools for test
run: sudo apt install bridge-utils
- name: Setup system for test
run: |
sudo sysctl net.bridge.bridge-nf-call-iptables=0
sudo sysctl net.bridge.bridge-nf-call-ip6tables=0
sudo sysctl net.ipv6.conf.lo.disable_ipv6=0
sudo ip addr add 2001:db8::2/64 dev lo
- name: Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo
./target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
run: |
sudo -E env "PATH=$PATH" cargo test --verbose
sudo chown -R $USER:$USER ./target
sudo chown -R $USER:$USER ~/.cargo