Skip to content

Commit 35c783e

Browse files
committed
Merge branch 'main' into hampi
2 parents 698c4c4 + f536880 commit 35c783e

File tree

6 files changed

+217
-109
lines changed

6 files changed

+217
-109
lines changed

.github/workflows/check-and-test.yml

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

.github/workflows/build-release.yml renamed to .github/workflows/main.yml

Lines changed: 164 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
name: Build Release
1+
name: main
22

33
on:
44
push:
5-
branches: [main, "release-*"]
65
pull_request:
7-
branches: ["main"]
6+
workflow_call:
87

98
env:
109
CARGO_TERM_COLOR: always
@@ -13,7 +12,143 @@ env:
1312
FILE_RAYHUNTER_DAEMON_TPLINK: ../../rayhunter-daemon-tplink/rayhunter-daemon
1413

1514
jobs:
15+
files_changed:
16+
name: Detect file changes
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
outputs:
21+
code_changed: ${{ steps.files_changed.outputs.code_count }}
22+
daemon_changed: ${{ steps.files_changed.outputs.daemon_count }}
23+
docs_changed: ${{ steps.files_changed.outputs.docs_count }}
24+
installer_changed: ${{ steps.files_changed.outputs.installer_count }}
25+
rootshell_changed: ${{ steps.files_changed.outputs.rootshell_count }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
- name: detect file changes
31+
id: files_changed
32+
run: |
33+
lcommit=${{ github.event.pull_request.base.sha || 'origin/main' }}
34+
if [ ${{ github.ref }} = 'refs/heads/main' ]
35+
then
36+
echo "building everything"
37+
echo code_count=forced >> "$GITHUB_OUTPUT"
38+
echo daemon_count=forced >> "$GITHUB_OUTPUT"
39+
echo docs_count=forced >> "$GITHUB_OUTPUT"
40+
echo installer_count=forced >> "$GITHUB_OUTPUT"
41+
echo rootshell_count=forced >> "$GITHUB_OUTPUT"
42+
else
43+
echo "code_count=$(git diff --name-only $lcommit...HEAD | grep -e ^bin -e ^installer -e ^lib -e ^rootshell -e ^telcom-parser | wc -l)" >> "$GITHUB_OUTPUT"
44+
echo "daemon_count=$(git diff --name-only $lcommit...HEAD | grep -e ^bin -e ^lib -e ^telcom-parser | wc -l)" >> "$GITHUB_OUTPUT"
45+
echo "docs_count=$(git diff --name-only $lcommit...HEAD | grep -e ^book.toml -e ^doc | wc -l)" >> "$GITHUB_OUTPUT"
46+
echo "installer_count=$(git diff --name-only $lcommit...HEAD | grep -e ^installer | wc -l)" >> "$GITHUB_OUTPUT"
47+
echo "rootshell_count=$(git diff --name-only $lcommit...HEAD | grep -e ^rootshell | wc -l)" >> "$GITHUB_OUTPUT"
48+
fi
49+
50+
mdbook_test:
51+
name: Test mdBook Documentation builds
52+
needs: files_changed
53+
if: needs.files_changed.outputs.docs_changed != '0'
54+
runs-on: ubuntu-latest
55+
permissions:
56+
contents: read
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Install mdBook
60+
run: |
61+
cargo install mdbook --no-default-features --features search --vers "^0.4" --locked
62+
- name: Test mdBook
63+
run: mdbook test
64+
65+
mdbook_publish:
66+
name: Publish mdBook to Github Pages
67+
needs: mdbook_test
68+
if: ${{ github.event_name != 'pull_request' }}
69+
permissions:
70+
pages: write
71+
contents: write
72+
id-token: write
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v4
76+
- name: Install mdBook
77+
run: |
78+
cargo install mdbook --no-default-features --features search --vers "^0.4" --locked
79+
80+
- name: Build mdBook
81+
run: mdbook build
82+
83+
- name: Setup Pages
84+
uses: actions/configure-pages@v4
85+
- name: Upload artifact
86+
uses: actions/upload-pages-artifact@v3
87+
with:
88+
path: book
89+
- name: Deploy to Github Pages
90+
uses: actions/deploy-pages@v4
91+
92+
check_and_test:
93+
needs: files_changed
94+
if: needs.files_changed.outputs.code_changed != '0'
95+
strategy:
96+
matrix:
97+
device:
98+
- name: tplink
99+
- name: orbic
100+
runs-on: ubuntu-latest
101+
permissions:
102+
contents: read
103+
env:
104+
NO_FIRMWARE_BIN=true
105+
steps:
106+
- uses: actions/checkout@v4
107+
- name: Check formatting
108+
run: cargo fmt --all --check
109+
- name: Check
110+
run: |
111+
pushd bin/web
112+
npm install
113+
npm run build
114+
popd
115+
cargo check --verbose --no-default-features --features=${{ matrix.device.name }}
116+
- name: Run tests
117+
run: |
118+
cargo test --verbose --no-default-features --features=${{ matrix.device.name }}
119+
- name: Run clippy
120+
run: |
121+
cargo clippy --verbose --no-default-features --features=${{ matrix.device.name }}
122+
123+
windows_installer_check_and_test:
124+
needs: files_changed
125+
if: needs.files_changed.outputs.installer_changed != '0'
126+
runs-on: windows-latest
127+
permissions:
128+
contents: read
129+
env:
130+
NO_FIRMWARE_BIN=true
131+
steps:
132+
- uses: actions/checkout@v4
133+
- name: cargo check
134+
shell: bash
135+
run: |
136+
cd installer
137+
cargo check --verbose
138+
- name: cargo test
139+
shell: bash
140+
run: |
141+
cd installer
142+
cargo test --verbose --no-default-features
143+
16144
build_rayhunter_check:
145+
if: needs.files_changed.outputs.daemon_changed != '0'
146+
needs:
147+
- check_and_test
148+
- files_changed
149+
permissions:
150+
contents: read
151+
packages: write
17152
strategy:
18153
matrix:
19154
platform:
@@ -42,8 +177,15 @@ jobs:
42177
name: rayhunter-check-${{ matrix.platform.name }}
43178
path: target/release/rayhunter-check${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }}
44179
if-no-files-found: error
180+
45181
build_rootshell:
182+
if: needs.files_changed.outputs.rootshell_changed != '0'
183+
needs:
184+
- check_and_test
185+
- files_changed
46186
runs-on: ubuntu-latest
187+
permissions:
188+
contents: read
47189
steps:
48190
- uses: actions/checkout@v4
49191
- uses: dtolnay/rust-toolchain@stable
@@ -56,7 +198,15 @@ jobs:
56198
name: rootshell
57199
path: target/armv7-unknown-linux-musleabihf/firmware/rootshell
58200
if-no-files-found: error
201+
59202
build_rayhunter:
203+
if: needs.files_changed.outputs.daemon_changed != '0'
204+
needs:
205+
- check_and_test
206+
- files_changed
207+
permissions:
208+
contents: read
209+
packages: write
60210
strategy:
61211
matrix:
62212
device:
@@ -88,9 +238,17 @@ jobs:
88238
name: rayhunter-daemon-${{ matrix.device.name }}
89239
path: target/armv7-unknown-linux-musleabihf/firmware/rayhunter-daemon
90240
if-no-files-found: error
241+
91242
build_rust_installer:
243+
if: needs.files_changed.outputs.installer_changed != '0'
244+
permissions:
245+
contents: read
246+
packages: write
92247
needs:
93248
- build_rayhunter
249+
- build_rootshell
250+
- files_changed
251+
- windows_installer_check_and_test
94252
strategy:
95253
matrix:
96254
platform:
@@ -124,6 +282,9 @@ jobs:
124282
if-no-files-found: error
125283

126284
build_release_zip:
285+
permissions:
286+
contents: read
287+
packages: write
127288
needs:
128289
- build_rayhunter_check
129290
- build_rootshell

.github/workflows/mdbook.yaml

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

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# To use: navigate on Github to Actions, select "Release rayhunter" on the left, click "Run workflow" > "Run workflow" on the right.
2+
# https://github.com/EFForg/rayhunter/actions/workflows/release.yml
3+
name: Release rayhunter
4+
on:
5+
workflow_dispatch:
6+
7+
env:
8+
GH_TOKEN: ${{ github.token }}
9+
10+
jobs:
11+
check_version_same:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Ensure all Cargo.toml files have the same version defined.
18+
run: |
19+
defined_versions=$(find lib bin installer rootshell telcom-parser -name Cargo.toml -exec grep ^version {} \; | sort -u | wc -l)
20+
find lib bin installer rootshell telcom-parser -name Cargo.toml -exec grep ^version {} \;
21+
echo number of defined versions = $defined_versions
22+
if [ $defined_versions != "1" ]
23+
then
24+
echo "all Cargo.toml files must have the same version defined"
25+
exit 1
26+
fi
27+
28+
main:
29+
needs: check_version_same
30+
permissions:
31+
contents: write
32+
id-token: write
33+
packages: write
34+
pages: write
35+
uses: ./.github/workflows/main.yml
36+
37+
release:
38+
runs-on: ubuntu-latest
39+
needs: main
40+
permissions:
41+
contents: write
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: actions/download-artifact@v4
45+
- name: Create release
46+
run: |
47+
version=$(grep ^version lib/Cargo.toml | cut -d' ' -f3 | tr -d '"')
48+
gh release create --generate-notes -t "Rayhunter v$version" "v$version" rayhunter-v${version}/rayhunter-*

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

installer/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ tokio-retry2 = "0.5.7"
2121
tokio-stream = "0.1.17"
2222

2323
[target.'cfg(target_os = "linux")'.dependencies.adb_client]
24-
git = "https://github.com/gaykitty/adb_client.git"
25-
rev = "e732fc178a0eb237138e4091059ff5ffa241385a"
24+
git = "https://github.com/EFForg/adb_client.git"
25+
rev = "e511662394e4fa32865c154c40f81a3d846f700c"
2626
default-features = false
2727
features = ["trans-nusb"]
2828

2929
[target.'cfg(any(target_os = "windows", target_os = "macos"))'.dependencies.adb_client]
30-
git = "https://github.com/gaykitty/adb_client.git"
31-
rev = "e732fc178a0eb237138e4091059ff5ffa241385a"
30+
git = "https://github.com/EFForg/adb_client.git"
31+
rev = "e511662394e4fa32865c154c40f81a3d846f700c"
3232
default-features = false
3333
features = ["trans-libusb"]

0 commit comments

Comments
 (0)