Skip to content

Commit 44805f4

Browse files
committed
rewrite to Rust, vpn-kill-switch v0.8.0
1 parent 0f5dd31 commit 44805f4

28 files changed

Lines changed: 2815 additions & 360 deletions

.circleci/config.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/actions-rs/grcov.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/coverage.yml

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,65 @@
22
name: Coverage
33

44
on:
5-
push:
6-
branches-ignore:
7-
- 'develop'
8-
- 'main'
5+
workflow_call:
6+
secrets:
7+
CODECOV_TOKEN:
8+
required: true
99

1010
jobs:
1111
coverage:
1212
name: Coverage
13-
runs-on: ubuntu-latest
13+
runs-on: macos-latest
14+
1415
steps:
15-
- uses: actions/checkout@v4
16-
- uses: dtolnay/rust-toolchain@nightly
16+
- uses: actions/checkout@v5
17+
18+
- name: Cache Rust toolchain and dependencies
19+
uses: actions/cache@v4
20+
with:
21+
path: |
22+
~/.cargo/bin/
23+
~/.cargo/registry/index/
24+
~/.cargo/registry/cache/
25+
~/.cargo/git/db/
26+
target/
27+
key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-cargo-coverage-
30+
${{ runner.os }}-cargo-
31+
32+
- uses: dtolnay/rust-toolchain@stable
33+
with:
34+
components: llvm-tools-preview
1735

1836
- name: Run tests
19-
run: cargo test --verbose -- --nocapture
37+
run: cargo test --verbose
2038
env:
2139
RUST_BACKTRACE: full
22-
CARGO_INCREMENTAL: '0'
23-
RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code
24-
-Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests
25-
RUSTDOCFLAGS: -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code
26-
-Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests
40+
CARGO_INCREMENTAL: 0
41+
LLVM_PROFILE_FILE: coverage-%p-%m.profraw
42+
RUSTFLAGS: -Cinstrument-coverage -Ccodegen-units=1 -Clink-dead-code -Coverflow-checks=off
43+
RUSTDOCFLAGS: -Cinstrument-coverage -Ccodegen-units=1 -Clink-dead-code -Coverflow-checks=off
2744

28-
- name: rust-grcov
29-
uses: actions-rs/grcov@v0.1
45+
- name: Install grcov
46+
run: |
47+
if [[ ! -e ~/.cargo/bin/grcov ]]; then
48+
cargo install grcov
49+
else
50+
echo "grcov already installed"
51+
fi
52+
53+
- name: Run grcov
54+
run: grcov . --binary-path target/debug/ -s . -t lcov --branch --ignore-not-existing
55+
--ignore '../**' --ignore '/*' -o coverage.lcov
3056

3157
- name: Upload to codecov.io
32-
uses: codecov/codecov-action@v3
58+
uses: codecov/codecov-action@v5
59+
env:
60+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
61+
with:
62+
files: coverage.lcov
63+
flags: rust
3364

3465
- name: Coveralls GitHub Action
3566
uses: coverallsapp/github-action@v2

.github/workflows/deploy.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,21 @@ jobs:
1818

1919
build:
2020
name: Build and release
21-
runs-on: ${{ matrix.os }}
21+
runs-on: macos-latest
2222
needs: test
2323

2424
strategy:
2525
matrix:
2626
include:
27-
- build: linux
28-
os: ubuntu-latest
29-
target: x86_64-unknown-linux-musl
30-
31-
- build: macos
32-
os: macos-latest
27+
- build: macos-x86_64
3328
target: x86_64-apple-darwin
3429

30+
- build: macos-aarch64
31+
target: aarch64-apple-darwin
32+
3533
steps:
3634
- name: Checkout
37-
uses: actions/checkout@v4
35+
uses: actions/checkout@v5
3836

3937
- name: Get the release version from the tag
4038
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
@@ -44,38 +42,34 @@ jobs:
4442
with:
4543
targets: ${{ matrix.target }}
4644

47-
- run: sudo apt -y install musl-dev musl-tools
48-
if: matrix.build == 'linux'
49-
5045
- name: Build
5146
run: cargo build --release --locked --target ${{ matrix.target }}
5247

5348
- name: Build archive
5449
shell: bash
5550
run: |
5651
binary_name="killswitch"
57-
5852
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
5953
mkdir "$dirname"
60-
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
61-
tar -czf "$dirname.tar.gz" "$dirname"
62-
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
54+
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
55+
tar -czf "$dirname.tar.gz" "$dirname"
56+
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
6357
6458
- name: Release
6559
if: startsWith(github.ref, 'refs/tags/')
66-
uses: softprops/action-gh-release@v1
60+
uses: softprops/action-gh-release@v2
6761
with:
6862
files: |-
6963
${{ env.ASSET }}
7064
7165
publish:
7266
name: Publish
73-
runs-on: ubuntu-latest
67+
runs-on: macos-latest
7468
needs:
7569
- build
7670
steps:
7771
- name: Checkout sources
78-
uses: actions/checkout@v4
72+
uses: actions/checkout@v5
7973

8074
- name: Install Rust
8175
uses: dtolnay/rust-toolchain@stable
@@ -93,7 +87,6 @@ jobs:
9387
- name: bump-homebrew-formula
9488
uses: mislav/bump-homebrew-formula-action@v3.1
9589
with:
96-
# A PR will be sent to github.com/Homebrew/homebrew-core to update this formula:
9790
formula-name: killswitch
9891
env:
9992
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}

.github/workflows/test.yml

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ on:
1818
jobs:
1919
format:
2020
name: Format
21-
runs-on: ubuntu-latest
21+
runs-on: macos-latest
2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v5
2424
with:
2525
ref: ${{ inputs.branch }}
2626
- uses: dtolnay/rust-toolchain@stable
@@ -30,74 +30,27 @@ jobs:
3030

3131
lint:
3232
name: Clippy
33-
runs-on: ubuntu-latest
33+
runs-on: macos-latest
3434
steps:
35-
- uses: actions/checkout@v4
35+
- uses: actions/checkout@v5
3636
with:
3737
ref: ${{ inputs.branch }}
3838
- uses: dtolnay/rust-toolchain@stable
3939

4040
- name: Clippy
41-
run: cargo clippy -- -D clippy::all -D clippy::nursery -D warnings
42-
43-
check:
44-
name: Check
45-
runs-on: ubuntu-latest
46-
steps:
47-
- uses: actions/checkout@v4
48-
with:
49-
ref: ${{ inputs.branch }}
50-
- uses: dtolnay/rust-toolchain@stable
51-
52-
- name: Check
53-
run: cargo check
41+
run: cargo clippy --all-targets --all-features
5442

5543
test:
5644
name: Test
57-
strategy:
58-
matrix:
59-
os:
60-
- ubuntu-latest
61-
- macOS-latest
62-
rust:
63-
- stable
64-
runs-on: ${{ matrix.os }}
45+
runs-on: macos-latest
6546
needs:
6647
- format
6748
- lint
68-
- check
6949
steps:
70-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v5
7151
with:
7252
ref: ${{ inputs.branch }}
7353
- uses: dtolnay/rust-toolchain@stable
7454

75-
- name: test
55+
- name: Test
7656
run: cargo test
77-
78-
coverage:
79-
name: Coverage
80-
runs-on: ubuntu-latest
81-
steps:
82-
- uses: actions/checkout@v4
83-
with:
84-
ref: ${{ inputs.branch }}
85-
- uses: dtolnay/rust-toolchain@nightly
86-
87-
- name: Run tests
88-
run: cargo test --verbose
89-
env:
90-
CARGO_INCREMENTAL: '0'
91-
RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code
92-
-Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests
93-
RUSTDOCFLAGS: -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code
94-
-Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests
95-
96-
- name: rust-grcov
97-
uses: actions-rs/grcov@v0.1
98-
99-
- name: Upload to codecov.io
100-
uses: codecov/codecov-action@v3
101-
102-
- name: Coveralls GitHub Action
103-
uses: coverallsapp/github-action@v2

.gitignore

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1-
/target/
1+
debug
2+
target
23
**/*.rs.bk
34
.envrc
5+
.DS_Store
6+
7+
# Editor/IDE artifacts
8+
flycheck_*
9+
flycheck*.rs
10+
.flycheck_*
11+
12+
# test artifacts
13+
/tests/tmp/
14+
*.db
15+
16+
# Ai tools
17+
.claude/
18+
.copilot/
19+
.cursor/
20+
.idea/
21+
.vscode/
22+
.opencode/
23+
.codexrc
24+
CLAUDE.md
25+
26+
# Python cache
27+
__pycache__/
28+
*.py[cod]
29+
*.pyo

0 commit comments

Comments
 (0)