2024-05-10 17:44:16 +08:00
|
|
|
name: EasyTier Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: ["develop", "main"]
|
|
|
|
pull_request:
|
|
|
|
branches: ["develop", "main"]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
# necessary for windows
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
2024-05-10 22:25:37 +08:00
|
|
|
pre_job:
|
|
|
|
# continue-on-error: true # Uncomment once integration is finished
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# Map a step output to a job output
|
|
|
|
outputs:
|
|
|
|
should_skip: ${{ steps.skip_check.outputs.should_skip }}
|
|
|
|
steps:
|
|
|
|
- id: skip_check
|
|
|
|
uses: fkirc/skip-duplicate-actions@v5
|
|
|
|
with:
|
|
|
|
# All of these options are optional, so you can remove them if you are happy with the defaults
|
|
|
|
concurrent_skipping: 'never'
|
|
|
|
skip_after_successful_duplicate: 'true'
|
2024-05-22 00:36:16 +08:00
|
|
|
paths: '["Cargo.toml", "Cargo.lock", "easytier/**", ".github/workflows/test.yml"]'
|
2024-05-10 17:44:16 +08:00
|
|
|
test:
|
2024-10-19 18:10:02 +08:00
|
|
|
runs-on: ubuntu-22.04
|
2024-05-22 00:36:16 +08:00
|
|
|
needs: pre_job
|
|
|
|
if: needs.pre_job.outputs.should_skip != 'true'
|
2024-05-10 17:44:16 +08:00
|
|
|
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: |
|
2024-06-02 09:15:40 +08:00
|
|
|
sudo -E env "PATH=$PATH" cargo test --no-default-features --features=full --verbose
|
2024-05-10 17:44:16 +08:00
|
|
|
sudo chown -R $USER:$USER ./target
|
|
|
|
sudo chown -R $USER:$USER ~/.cargo
|