Skip to content

Commit f7b57db

Browse files
committed
Add initial implementation of Capture Rust SDK
0 parents  commit f7b57db

File tree

10 files changed

+1662
-0
lines changed

10 files changed

+1662
-0
lines changed

.github/workflows/ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
name: Test
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
rust:
19+
- stable
20+
- beta
21+
- nightly
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Install Rust
26+
uses: dtolnay/rust-toolchain@master
27+
with:
28+
toolchain: ${{ matrix.rust }}
29+
components: rustfmt, clippy
30+
31+
- name: Cache cargo registry
32+
uses: actions/cache@v3
33+
with:
34+
path: ~/.cargo/registry
35+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
36+
37+
- name: Cache cargo index
38+
uses: actions/cache@v3
39+
with:
40+
path: ~/.cargo/git
41+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
42+
43+
- name: Cache cargo build
44+
uses: actions/cache@v3
45+
with:
46+
path: target
47+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
48+
49+
- name: Check formatting
50+
run: cargo fmt --all -- --check
51+
52+
- name: Run clippy
53+
run: cargo clippy --all-targets --all-features -- -D warnings
54+
55+
- name: Build
56+
run: cargo build --verbose
57+
58+
- name: Run tests
59+
run: cargo test --verbose
60+
61+
- name: Build examples
62+
run: cargo build --examples --verbose
63+
64+
coverage:
65+
name: Coverage
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
70+
- name: Install Rust
71+
uses: dtolnay/rust-toolchain@stable
72+
73+
- name: Install cargo-tarpaulin
74+
uses: taiki-e/install-action@cargo-tarpaulin
75+
76+
- name: Generate code coverage
77+
run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml
78+
79+
- name: Upload to codecov.io
80+
uses: codecov/codecov-action@v3
81+
with:
82+
file: cobertura.xml
83+
fail_ci_if_error: true
84+
85+
security:
86+
name: Security audit
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v4
90+
91+
- name: Install Rust
92+
uses: dtolnay/rust-toolchain@stable
93+
94+
- name: Install cargo-audit
95+
uses: taiki-e/install-action@cargo-audit
96+
97+
- name: Run security audit
98+
run: cargo audit
99+
100+
msrv:
101+
name: Minimum supported Rust version
102+
runs-on: ubuntu-latest
103+
steps:
104+
- uses: actions/checkout@v4
105+
106+
- name: Install Rust
107+
uses: dtolnay/rust-toolchain@master
108+
with:
109+
toolchain: 1.70.0 # Adjust based on your MSRV
110+
111+
- name: Check MSRV
112+
run: cargo check --all-features

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Rust
2+
/target/
3+
**/*.rs.bk
4+
*.pdb
5+
Cargo.lock
6+
7+
# IDE
8+
.vscode/
9+
.idea/
10+
*.swp
11+
*.swo
12+
*~
13+
14+
# OS
15+
.DS_Store
16+
.DS_Store?
17+
._*
18+
.Spotlight-V100
19+
.Trashes
20+
ehthumbs.db
21+
Thumbs.db
22+
23+
# Logs
24+
*.log
25+
26+
# Environment variables
27+
.env
28+
.env.local
29+
.env.*.local
30+
31+
# Test artifacts
32+
*.png
33+
*.pdf
34+
*.html
35+
36+
# Backup files
37+
*.bak
38+
*.tmp
39+
*.temp
40+
41+
# Coverage reports
42+
tarpaulin-report.html
43+
cobertura.xml
44+
45+
.claude/

Cargo.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[package]
2+
name = "capture-rust"
3+
version = "0.1.0"
4+
edition = "2021"
5+
description = "Rust SDK for capture.page - Browser automation and screenshot API"
6+
license = "MIT"
7+
repository = "https://github.com/techulus/capture-node"
8+
authors = ["Arjun Komath <[email protected]>"]
9+
keywords = ["screenshot", "capture", "browser", "automation", "api"]
10+
categories = ["web-programming", "api-bindings"]
11+
12+
[dependencies]
13+
reqwest = { version = "0.12", features = ["json"] }
14+
serde = { version = "1.0", features = ["derive"] }
15+
serde_json = "1.0"
16+
tokio = { version = "1.0", features = ["full"] }
17+
md5 = "0.7"
18+
url = "2.5"
19+
thiserror = "1.0"
20+
urlencoding = "2.1"
21+
22+
[dev-dependencies]
23+
tokio-test = "0.4"

0 commit comments

Comments
 (0)