spectreq-py 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spectreq_py-0.1.1/.github/CODEOWNERS +2 -0
- spectreq_py-0.1.1/.github/dependabot.yml +51 -0
- spectreq_py-0.1.1/.github/workflows/benchmarks.yml +123 -0
- spectreq_py-0.1.1/.github/workflows/ci.yml +69 -0
- spectreq_py-0.1.1/.github/workflows/coverage.yml +76 -0
- spectreq_py-0.1.1/.github/workflows/docs.yml +59 -0
- spectreq_py-0.1.1/.github/workflows/release-drafter.yml +21 -0
- spectreq_py-0.1.1/.github/workflows/release.yml +68 -0
- spectreq_py-0.1.1/.github/workflows/security.yml +114 -0
- spectreq_py-0.1.1/.gitignore +47 -0
- spectreq_py-0.1.1/.pre-commit-config.yaml +45 -0
- spectreq_py-0.1.1/.release.toml +36 -0
- spectreq_py-0.1.1/ARCHITECTURE.md +178 -0
- spectreq_py-0.1.1/CHANGELOG.md +116 -0
- spectreq_py-0.1.1/CONTRIBUTING.md +399 -0
- spectreq_py-0.1.1/Cargo.lock +3194 -0
- spectreq_py-0.1.1/Cargo.toml +103 -0
- spectreq_py-0.1.1/LICENSE +21 -0
- spectreq_py-0.1.1/PKG-INFO +19 -0
- spectreq_py-0.1.1/README.md +1457 -0
- spectreq_py-0.1.1/SECURITY.md +114 -0
- spectreq_py-0.1.1/benches/client_bench.rs +117 -0
- spectreq_py-0.1.1/benches/profile_bench.rs +107 -0
- spectreq_py-0.1.1/examples/README.md +179 -0
- spectreq_py-0.1.1/examples/basic.rs +26 -0
- spectreq_py-0.1.1/examples/cookies.rs +27 -0
- spectreq_py-0.1.1/examples/python/__init__.py +1 -0
- spectreq_py-0.1.1/examples/python/basic_request.py +38 -0
- spectreq_py-0.1.1/examples/python/cookies_demo.py +55 -0
- spectreq_py-0.1.1/examples/python/full_features.py +82 -0
- spectreq_py-0.1.1/examples/python/post_request.py +43 -0
- spectreq_py-0.1.1/examples/python/profiles.py +98 -0
- spectreq_py-0.1.1/examples/python/streaming.py +44 -0
- spectreq_py-0.1.1/examples/python/timing_demo.py +45 -0
- spectreq_py-0.1.1/examples/timing.rs +21 -0
- spectreq_py-0.1.1/profiles/chrome_143_windows.yaml +59 -0
- spectreq_py-0.1.1/pyproject.toml +32 -0
- spectreq_py-0.1.1/scripts/pre-release-check.sh +245 -0
- spectreq_py-0.1.1/scripts/sync-version.py +257 -0
- spectreq_py-0.1.1/scripts/sync-version.sh +27 -0
- spectreq_py-0.1.1/scripts/test-pypi-publish.sh +185 -0
- spectreq_py-0.1.1/spectreq-py/Cargo.toml +23 -0
- spectreq_py-0.1.1/spectreq-py/README.md +88 -0
- spectreq_py-0.1.1/spectreq-py/pytest.ini +3 -0
- spectreq_py-0.1.1/spectreq-py/src/auth.rs +169 -0
- spectreq_py-0.1.1/spectreq-py/src/client.rs +489 -0
- spectreq_py-0.1.1/spectreq-py/src/cookies.rs +95 -0
- spectreq_py-0.1.1/spectreq-py/src/lib.rs +52 -0
- spectreq_py-0.1.1/spectreq-py/src/profile.rs +318 -0
- spectreq_py-0.1.1/spectreq-py/tests/conftest.py +73 -0
- spectreq_py-0.1.1/spectreq-py/tests/test_client.py +275 -0
- spectreq_py-0.1.1/spectreq-py/tests/test_cookies.py +63 -0
- spectreq_py-0.1.1/spectreq-py/tests/test_profile.py +147 -0
- spectreq_py-0.1.1/spectreq-py/verify_install.py +25 -0
- spectreq_py-0.1.1/src/client/auth.rs +624 -0
- spectreq_py-0.1.1/src/client/cache.rs +298 -0
- spectreq_py-0.1.1/src/client/client.rs +1435 -0
- spectreq_py-0.1.1/src/client/compression.rs +198 -0
- spectreq_py-0.1.1/src/client/connector.rs +464 -0
- spectreq_py-0.1.1/src/client/cookies.rs +172 -0
- spectreq_py-0.1.1/src/client/hooks.rs +298 -0
- spectreq_py-0.1.1/src/client/http3.rs +49 -0
- spectreq_py-0.1.1/src/client/metrics.rs +723 -0
- spectreq_py-0.1.1/src/client/middleware.rs +603 -0
- spectreq_py-0.1.1/src/client/mod.rs +52 -0
- spectreq_py-0.1.1/src/client/pinning.rs +248 -0
- spectreq_py-0.1.1/src/client/pool.rs +363 -0
- spectreq_py-0.1.1/src/client/rotation.rs +523 -0
- spectreq_py-0.1.1/src/client/session.rs +566 -0
- spectreq_py-0.1.1/src/client/socks5.rs +378 -0
- spectreq_py-0.1.1/src/client/streaming.rs +341 -0
- spectreq_py-0.1.1/src/core/ech.rs +412 -0
- spectreq_py-0.1.1/src/core/error.rs +75 -0
- spectreq_py-0.1.1/src/core/headers.rs +584 -0
- spectreq_py-0.1.1/src/core/ja4.rs +450 -0
- spectreq_py-0.1.1/src/core/mod.rs +29 -0
- spectreq_py-0.1.1/src/core/profile.rs +1108 -0
- spectreq_py-0.1.1/src/core/tcp.rs +78 -0
- spectreq_py-0.1.1/src/core/tls.rs +223 -0
- spectreq_py-0.1.1/src/lib.rs +80 -0
- spectreq_py-0.1.1/tests/antibot_test.rs +357 -0
- spectreq_py-0.1.1/tests/auth_test.rs +196 -0
- spectreq_py-0.1.1/tests/compression_test.rs +85 -0
- spectreq_py-0.1.1/tests/profile_test.rs +222 -0
- spectreq_py-0.1.1/tests/property_test.rs +263 -0
- spectreq_py-0.1.1/tests/tls_test.rs +180 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# Rust dependencies
|
|
4
|
+
- package-ecosystem: cargo
|
|
5
|
+
directory: /
|
|
6
|
+
schedule:
|
|
7
|
+
interval: weekly
|
|
8
|
+
day: monday
|
|
9
|
+
open-pull-requests-limit: 5
|
|
10
|
+
commit-message:
|
|
11
|
+
prefix: "deps(rust):"
|
|
12
|
+
labels:
|
|
13
|
+
- dependencies
|
|
14
|
+
- rust
|
|
15
|
+
groups:
|
|
16
|
+
rust-minor:
|
|
17
|
+
patterns:
|
|
18
|
+
- "*"
|
|
19
|
+
update-types:
|
|
20
|
+
- minor
|
|
21
|
+
- patch
|
|
22
|
+
|
|
23
|
+
# Python dependencies (spectreq-py)
|
|
24
|
+
- package-ecosystem: pip
|
|
25
|
+
directory: /spectreq-py
|
|
26
|
+
schedule:
|
|
27
|
+
interval: weekly
|
|
28
|
+
day: monday
|
|
29
|
+
open-pull-requests-limit: 3
|
|
30
|
+
commit-message:
|
|
31
|
+
prefix: "deps(python):"
|
|
32
|
+
labels:
|
|
33
|
+
- dependencies
|
|
34
|
+
- python
|
|
35
|
+
|
|
36
|
+
# GitHub Actions
|
|
37
|
+
- package-ecosystem: github-actions
|
|
38
|
+
directory: /
|
|
39
|
+
schedule:
|
|
40
|
+
interval: weekly
|
|
41
|
+
day: monday
|
|
42
|
+
open-pull-requests-limit: 3
|
|
43
|
+
commit-message:
|
|
44
|
+
prefix: "ci:"
|
|
45
|
+
labels:
|
|
46
|
+
- ci
|
|
47
|
+
- dependencies
|
|
48
|
+
groups:
|
|
49
|
+
actions:
|
|
50
|
+
patterns:
|
|
51
|
+
- "*"
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
name: Benchmarks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
benchmark:
|
|
16
|
+
name: Performance Benchmarks
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Install Rust
|
|
23
|
+
uses: dtolnay/rust-toolchain@stable
|
|
24
|
+
with:
|
|
25
|
+
components: rustfmt, clippy
|
|
26
|
+
|
|
27
|
+
- name: Cache cargo
|
|
28
|
+
uses: actions/cache@v4
|
|
29
|
+
with:
|
|
30
|
+
path: |
|
|
31
|
+
~/.cargo/bin/
|
|
32
|
+
~/.cargo/registry/index/
|
|
33
|
+
~/.cargo/registry/cache/
|
|
34
|
+
~/.cargo/git/db/
|
|
35
|
+
target/
|
|
36
|
+
key: ${{ runner.os }}-cargo-bench-${{ hashFiles('**/Cargo.lock') }}
|
|
37
|
+
restore-keys: |
|
|
38
|
+
${{ runner.os }}-cargo-bench-
|
|
39
|
+
|
|
40
|
+
- name: Run benchmarks
|
|
41
|
+
run: cargo bench --bench profile_bench --bench client_bench -- --noplot
|
|
42
|
+
|
|
43
|
+
- name: Store benchmark result
|
|
44
|
+
uses: benchmark-action/github-action-benchmark@v1
|
|
45
|
+
with:
|
|
46
|
+
name: Rust Benchmarks
|
|
47
|
+
tool: 'criterion'
|
|
48
|
+
output-file-path: target/criterion
|
|
49
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
50
|
+
auto-push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
51
|
+
alert-threshold: '150%'
|
|
52
|
+
comment-on-alert: true
|
|
53
|
+
fail-on-alert: false
|
|
54
|
+
alert-comment-cc-users: '@inav'
|
|
55
|
+
|
|
56
|
+
- name: Upload benchmark artifacts
|
|
57
|
+
uses: actions/upload-artifact@v4
|
|
58
|
+
with:
|
|
59
|
+
name: benchmark-results
|
|
60
|
+
path: target/criterion/
|
|
61
|
+
retention-days: 30
|
|
62
|
+
|
|
63
|
+
compare:
|
|
64
|
+
name: Compare with baseline
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
if: github.event_name == 'pull_request'
|
|
67
|
+
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v4
|
|
70
|
+
with:
|
|
71
|
+
fetch-depth: 0
|
|
72
|
+
|
|
73
|
+
- name: Install Rust
|
|
74
|
+
uses: dtolnay/rust-toolchain@stable
|
|
75
|
+
|
|
76
|
+
- name: Cache cargo
|
|
77
|
+
uses: actions/cache@v4
|
|
78
|
+
with:
|
|
79
|
+
path: |
|
|
80
|
+
~/.cargo/bin/
|
|
81
|
+
~/.cargo/registry/index/
|
|
82
|
+
~/.cargo/registry/cache/
|
|
83
|
+
~/.cargo/git/db/
|
|
84
|
+
target/
|
|
85
|
+
key: ${{ runner.os }}-cargo-bench-compare-${{ hashFiles('**/Cargo.lock') }}
|
|
86
|
+
|
|
87
|
+
- name: Install critcmp
|
|
88
|
+
run: cargo install critcmp || true
|
|
89
|
+
|
|
90
|
+
- name: Benchmark baseline (main)
|
|
91
|
+
run: |
|
|
92
|
+
git checkout main
|
|
93
|
+
cargo bench --bench profile_bench --bench client_bench -- --save-baseline main --noplot
|
|
94
|
+
|
|
95
|
+
- name: Benchmark PR
|
|
96
|
+
run: |
|
|
97
|
+
git checkout ${{ github.head_ref }}
|
|
98
|
+
cargo bench --bench profile_bench --bench client_bench -- --save-baseline pr --noplot
|
|
99
|
+
|
|
100
|
+
- name: Compare benchmarks
|
|
101
|
+
id: compare
|
|
102
|
+
run: |
|
|
103
|
+
echo "## Benchmark Comparison" >> $GITHUB_STEP_SUMMARY
|
|
104
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
105
|
+
echo "Comparing PR against main branch:" >> $GITHUB_STEP_SUMMARY
|
|
106
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
107
|
+
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
108
|
+
critcmp main pr >> $GITHUB_STEP_SUMMARY 2>&1 || echo "No significant changes" >> $GITHUB_STEP_SUMMARY
|
|
109
|
+
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
110
|
+
|
|
111
|
+
- name: Comment on PR
|
|
112
|
+
uses: actions/github-script@v7
|
|
113
|
+
with:
|
|
114
|
+
script: |
|
|
115
|
+
const fs = require('fs');
|
|
116
|
+
const summary = process.env.GITHUB_STEP_SUMMARY;
|
|
117
|
+
|
|
118
|
+
github.rest.issues.createComment({
|
|
119
|
+
issue_number: context.issue.number,
|
|
120
|
+
owner: context.repo.owner,
|
|
121
|
+
repo: context.repo.repo,
|
|
122
|
+
body: `## 📊 Benchmark Results\n\nBenchmarks have been run. Check the [workflow summary](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) for detailed comparison.`
|
|
123
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
CARGO_TERM_COLOR: always
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test-rust:
|
|
14
|
+
name: Test Rust
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- name: Set up Rust
|
|
19
|
+
uses: dtolnay/rust-toolchain@stable
|
|
20
|
+
- name: Cache Cargo dependencies
|
|
21
|
+
uses: actions/cache@v4
|
|
22
|
+
with:
|
|
23
|
+
path: |
|
|
24
|
+
~/.cargo/registry
|
|
25
|
+
~/.cargo/git
|
|
26
|
+
target
|
|
27
|
+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
28
|
+
- name: Build
|
|
29
|
+
run: cargo build --verbose
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: cargo test --verbose
|
|
32
|
+
|
|
33
|
+
test-python:
|
|
34
|
+
name: Test Python
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
- name: Set up Python
|
|
39
|
+
uses: actions/setup-python@v5
|
|
40
|
+
with:
|
|
41
|
+
python-version: '3.11'
|
|
42
|
+
- name: Set up Rust
|
|
43
|
+
uses: dtolnay/rust-toolchain@stable
|
|
44
|
+
- name: Create virtualenv
|
|
45
|
+
run: |
|
|
46
|
+
python -m venv .venv
|
|
47
|
+
echo "$PWD/.venv/bin" >> $GITHUB_PATH
|
|
48
|
+
- name: Install maturin
|
|
49
|
+
run: pip install maturin
|
|
50
|
+
- name: Build and install
|
|
51
|
+
run: maturin develop --manifest-path spectreq-py/Cargo.toml
|
|
52
|
+
- name: Install test dependencies
|
|
53
|
+
run: pip install pytest pytest-asyncio
|
|
54
|
+
- name: Run tests
|
|
55
|
+
run: pytest spectreq-py/tests
|
|
56
|
+
|
|
57
|
+
lint:
|
|
58
|
+
name: Lint & Format
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
steps:
|
|
61
|
+
- uses: actions/checkout@v4
|
|
62
|
+
- name: Set up Rust
|
|
63
|
+
uses: dtolnay/rust-toolchain@stable
|
|
64
|
+
with:
|
|
65
|
+
components: clippy, rustfmt
|
|
66
|
+
- name: Check formatting
|
|
67
|
+
run: cargo fmt --all --check
|
|
68
|
+
- name: Clippy
|
|
69
|
+
run: cargo clippy --workspace -- -D warnings
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: Code Coverage
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pull-requests: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
coverage:
|
|
15
|
+
name: Generate Coverage Report
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Install Rust
|
|
22
|
+
uses: dtolnay/rust-toolchain@nightly
|
|
23
|
+
with:
|
|
24
|
+
components: llvm-tools-preview
|
|
25
|
+
|
|
26
|
+
- name: Install cargo-llvm-cov
|
|
27
|
+
uses: taiki-e/install-action@cargo-llvm-cov
|
|
28
|
+
|
|
29
|
+
- name: Cache cargo
|
|
30
|
+
uses: actions/cache@v4
|
|
31
|
+
with:
|
|
32
|
+
path: |
|
|
33
|
+
~/.cargo/bin/
|
|
34
|
+
~/.cargo/registry/index/
|
|
35
|
+
~/.cargo/registry/cache/
|
|
36
|
+
~/.cargo/git/db/
|
|
37
|
+
target/
|
|
38
|
+
key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}
|
|
39
|
+
restore-keys: |
|
|
40
|
+
${{ runner.os }}-cargo-coverage-
|
|
41
|
+
|
|
42
|
+
- name: Generate code coverage
|
|
43
|
+
run: |
|
|
44
|
+
cargo llvm-cov --all-features --workspace \
|
|
45
|
+
--lcov --output-path lcov.info \
|
|
46
|
+
--ignore-filename-regex 'tests/|benches/'
|
|
47
|
+
|
|
48
|
+
- name: Upload coverage to Codecov
|
|
49
|
+
uses: codecov/codecov-action@v4
|
|
50
|
+
with:
|
|
51
|
+
files: lcov.info
|
|
52
|
+
fail_ci_if_error: false
|
|
53
|
+
verbose: true
|
|
54
|
+
env:
|
|
55
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
56
|
+
|
|
57
|
+
- name: Generate HTML report
|
|
58
|
+
run: |
|
|
59
|
+
cargo llvm-cov --all-features --workspace \
|
|
60
|
+
--html --output-dir coverage-html \
|
|
61
|
+
--ignore-filename-regex 'tests/|benches/'
|
|
62
|
+
|
|
63
|
+
- name: Upload coverage report
|
|
64
|
+
uses: actions/upload-artifact@v4
|
|
65
|
+
with:
|
|
66
|
+
name: coverage-report
|
|
67
|
+
path: coverage-html/
|
|
68
|
+
retention-days: 14
|
|
69
|
+
|
|
70
|
+
- name: Coverage summary
|
|
71
|
+
run: |
|
|
72
|
+
echo "## Code Coverage Report" >> $GITHUB_STEP_SUMMARY
|
|
73
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
74
|
+
cargo llvm-cov --all-features --workspace \
|
|
75
|
+
--ignore-filename-regex 'tests/|benches/' 2>&1 | \
|
|
76
|
+
tail -20 >> $GITHUB_STEP_SUMMARY
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- "src/**"
|
|
8
|
+
- "spectreq-py/**"
|
|
9
|
+
- "README.md"
|
|
10
|
+
- "ARCHITECTURE.md"
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
pages: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
concurrency:
|
|
19
|
+
group: pages
|
|
20
|
+
cancel-in-progress: true
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
build:
|
|
24
|
+
name: Build Documentation
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Install Rust toolchain
|
|
31
|
+
uses: dtolnay/rust-toolchain@stable
|
|
32
|
+
|
|
33
|
+
- name: Cache cargo
|
|
34
|
+
uses: Swatinem/rust-cache@v2
|
|
35
|
+
|
|
36
|
+
- name: Build Rust docs
|
|
37
|
+
run: |
|
|
38
|
+
cargo doc --no-deps --all-features --document-private-items
|
|
39
|
+
echo '<meta http-equiv="refresh" content="0; url=spectreq/index.html">' > target/doc/index.html
|
|
40
|
+
|
|
41
|
+
- name: Setup Pages
|
|
42
|
+
uses: actions/configure-pages@v4
|
|
43
|
+
|
|
44
|
+
- name: Upload artifact
|
|
45
|
+
uses: actions/upload-pages-artifact@v3
|
|
46
|
+
with:
|
|
47
|
+
path: target/doc
|
|
48
|
+
|
|
49
|
+
deploy:
|
|
50
|
+
name: Deploy to GitHub Pages
|
|
51
|
+
needs: build
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
environment:
|
|
54
|
+
name: github-pages
|
|
55
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
56
|
+
steps:
|
|
57
|
+
- name: Deploy to GitHub Pages
|
|
58
|
+
id: deployment
|
|
59
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Release Drafter
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
update_release_draft:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: release-drafter/release-drafter@v6
|
|
17
|
+
with:
|
|
18
|
+
config-name: release-drafter.yml
|
|
19
|
+
version: "${{ github.ref_name }}"
|
|
20
|
+
env:
|
|
21
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish-crates-io:
|
|
13
|
+
name: Publish to Crates.io
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Set up Rust
|
|
18
|
+
uses: dtolnay/rust-toolchain@stable
|
|
19
|
+
- name: Build sdist
|
|
20
|
+
uses: PyO3/maturin-action@v1
|
|
21
|
+
with:
|
|
22
|
+
command: sdist
|
|
23
|
+
args: --out dist --manifest-path spectreq-py/Cargo.toml
|
|
24
|
+
- name: Upload sdist
|
|
25
|
+
uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: wheels-sdist
|
|
28
|
+
path: dist
|
|
29
|
+
- name: Publish to Crates.io
|
|
30
|
+
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
|
|
31
|
+
continue-on-error: true # Might fail if version exists, just warn
|
|
32
|
+
|
|
33
|
+
build-wheels:
|
|
34
|
+
name: Build wheels on ${{ matrix.os }}
|
|
35
|
+
runs-on: ${{ matrix.os }}
|
|
36
|
+
strategy:
|
|
37
|
+
matrix:
|
|
38
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- name: Build wheels
|
|
42
|
+
uses: PyO3/maturin-action@v1
|
|
43
|
+
with:
|
|
44
|
+
target: ${{ matrix.target }}
|
|
45
|
+
args: --release --out dist --manifest-path spectreq-py/Cargo.toml
|
|
46
|
+
sccache: 'true'
|
|
47
|
+
- name: Upload wheels
|
|
48
|
+
uses: actions/upload-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: wheels-${{ matrix.os }}
|
|
51
|
+
path: dist
|
|
52
|
+
|
|
53
|
+
publish-pypi:
|
|
54
|
+
name: Publish to PyPI
|
|
55
|
+
needs: [build-wheels, publish-crates-io]
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
permissions:
|
|
58
|
+
id-token: write
|
|
59
|
+
steps:
|
|
60
|
+
- uses: actions/download-artifact@v4
|
|
61
|
+
with:
|
|
62
|
+
pattern: wheels-*
|
|
63
|
+
path: dist
|
|
64
|
+
merge-multiple: true
|
|
65
|
+
- name: Publish to PyPI
|
|
66
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
67
|
+
with:
|
|
68
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
name: Security
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "0 6 * * 1" # Weekly on Monday at 6 AM UTC
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
paths:
|
|
9
|
+
- "Cargo.toml"
|
|
10
|
+
- "Cargo.lock"
|
|
11
|
+
- "spectreq-py/Cargo.toml"
|
|
12
|
+
pull_request:
|
|
13
|
+
branches: [main]
|
|
14
|
+
paths:
|
|
15
|
+
- "Cargo.toml"
|
|
16
|
+
- "Cargo.lock"
|
|
17
|
+
- "spectreq-py/Cargo.toml"
|
|
18
|
+
workflow_dispatch:
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
security-events: write
|
|
23
|
+
|
|
24
|
+
env:
|
|
25
|
+
CARGO_TERM_COLOR: always
|
|
26
|
+
|
|
27
|
+
jobs:
|
|
28
|
+
# ============================================================================
|
|
29
|
+
# Dependency Audit
|
|
30
|
+
# ============================================================================
|
|
31
|
+
audit:
|
|
32
|
+
name: Security Audit
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
steps:
|
|
35
|
+
- name: Checkout
|
|
36
|
+
uses: actions/checkout@v4
|
|
37
|
+
|
|
38
|
+
- name: Install Rust toolchain
|
|
39
|
+
uses: dtolnay/rust-toolchain@stable
|
|
40
|
+
|
|
41
|
+
- name: Install cargo-audit
|
|
42
|
+
run: cargo install cargo-audit
|
|
43
|
+
|
|
44
|
+
- name: Run security audit
|
|
45
|
+
run: cargo audit
|
|
46
|
+
|
|
47
|
+
# ============================================================================
|
|
48
|
+
# Dependency License Check
|
|
49
|
+
# ============================================================================
|
|
50
|
+
deny:
|
|
51
|
+
name: Dependency Check
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
steps:
|
|
54
|
+
- name: Checkout
|
|
55
|
+
uses: actions/checkout@v4
|
|
56
|
+
|
|
57
|
+
- name: Install Rust toolchain
|
|
58
|
+
uses: dtolnay/rust-toolchain@stable
|
|
59
|
+
|
|
60
|
+
- name: Install cargo-deny
|
|
61
|
+
run: cargo install cargo-deny
|
|
62
|
+
|
|
63
|
+
- name: Check dependencies
|
|
64
|
+
run: cargo deny check || true # Soft fail until deny.toml is configured
|
|
65
|
+
continue-on-error: true
|
|
66
|
+
|
|
67
|
+
# ============================================================================
|
|
68
|
+
# SAST - Static Analysis
|
|
69
|
+
# ============================================================================
|
|
70
|
+
semgrep:
|
|
71
|
+
name: Semgrep SAST
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
container:
|
|
74
|
+
image: semgrep/semgrep
|
|
75
|
+
steps:
|
|
76
|
+
- name: Checkout
|
|
77
|
+
uses: actions/checkout@v4
|
|
78
|
+
|
|
79
|
+
- name: Run Semgrep
|
|
80
|
+
run: semgrep ci --sarif --output=semgrep.sarif
|
|
81
|
+
env:
|
|
82
|
+
SEMGREP_RULES: p/rust p/security-audit p/secrets
|
|
83
|
+
continue-on-error: true
|
|
84
|
+
|
|
85
|
+
- name: Upload SARIF
|
|
86
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
87
|
+
with:
|
|
88
|
+
sarif_file: semgrep.sarif
|
|
89
|
+
if: always()
|
|
90
|
+
continue-on-error: true
|
|
91
|
+
|
|
92
|
+
# ============================================================================
|
|
93
|
+
# Dependency Tree Analysis
|
|
94
|
+
# ============================================================================
|
|
95
|
+
supply-chain:
|
|
96
|
+
name: Supply Chain Check
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
steps:
|
|
99
|
+
- name: Checkout
|
|
100
|
+
uses: actions/checkout@v4
|
|
101
|
+
|
|
102
|
+
- name: Install Rust toolchain
|
|
103
|
+
uses: dtolnay/rust-toolchain@stable
|
|
104
|
+
|
|
105
|
+
- name: Check for yanked crates
|
|
106
|
+
run: |
|
|
107
|
+
cargo update 2>&1 | tee update_output.txt
|
|
108
|
+
if grep -q "yanked" update_output.txt; then
|
|
109
|
+
echo "::warning::Some dependencies have been yanked"
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
- name: Check for duplicates
|
|
113
|
+
run: |
|
|
114
|
+
cargo tree --duplicates || echo "No duplicate dependencies"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Rust
|
|
2
|
+
target/
|
|
3
|
+
**/*.rs.bk
|
|
4
|
+
Cargo.lock
|
|
5
|
+
|
|
6
|
+
# Python
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
*$py.class
|
|
10
|
+
*.so
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
.venv/
|
|
30
|
+
venv/
|
|
31
|
+
ENV/
|
|
32
|
+
env/
|
|
33
|
+
ENV/
|
|
34
|
+
env.bak/
|
|
35
|
+
venv.bak/
|
|
36
|
+
|
|
37
|
+
# IDEs
|
|
38
|
+
.idea/
|
|
39
|
+
.vscode/
|
|
40
|
+
*.swp
|
|
41
|
+
*.swo
|
|
42
|
+
|
|
43
|
+
# OS
|
|
44
|
+
.DS_Store
|
|
45
|
+
Thumbs.db
|
|
46
|
+
|
|
47
|
+
.ruff_cache
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Pre-commit hooks for Spectre
|
|
2
|
+
# Install: pip install pre-commit && pre-commit install
|
|
3
|
+
# Run on all files: pre-commit run --all-files
|
|
4
|
+
|
|
5
|
+
repos:
|
|
6
|
+
# Rust formatting
|
|
7
|
+
- repo: local
|
|
8
|
+
hooks:
|
|
9
|
+
- id: rustfmt
|
|
10
|
+
name: rustfmt
|
|
11
|
+
entry: cargo fmt
|
|
12
|
+
language: system
|
|
13
|
+
types: [rust]
|
|
14
|
+
args: ["--", "--check"]
|
|
15
|
+
pass_filenames: false
|
|
16
|
+
|
|
17
|
+
# Python formatting and linting
|
|
18
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
19
|
+
rev: v0.8.0
|
|
20
|
+
hooks:
|
|
21
|
+
- id: ruff
|
|
22
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
23
|
+
- id: ruff-format
|
|
24
|
+
|
|
25
|
+
# General file fixes
|
|
26
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
27
|
+
rev: v5.0.0
|
|
28
|
+
hooks:
|
|
29
|
+
- id: trailing-whitespace
|
|
30
|
+
- id: end-of-file-fixer
|
|
31
|
+
- id: check-yaml
|
|
32
|
+
- id: check-toml
|
|
33
|
+
- id: check-added-large-files
|
|
34
|
+
args: ["--maxkb=1000"]
|
|
35
|
+
- id: check-merge-conflict
|
|
36
|
+
- id: detect-private-key
|
|
37
|
+
- id: mixed-line-ending
|
|
38
|
+
args: ["--fix=lf"]
|
|
39
|
+
|
|
40
|
+
# Markdown linting
|
|
41
|
+
- repo: https://github.com/igorshubovych/markdownlint-cli
|
|
42
|
+
rev: v0.42.0
|
|
43
|
+
hooks:
|
|
44
|
+
- id: markdownlint
|
|
45
|
+
args: ["--fix"]
|