-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d727490
Showing
22 changed files
with
2,215 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: ci | ||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: {} | ||
jobs: | ||
cargo: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: [stable, beta] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install dependencies (linux) | ||
run: | | ||
sudo apt install -y protobuf-compiler | ||
echo "PROTOC=$(which protoc)" >> $GITHUB_ENV | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
components: clippy, rustfmt | ||
- name: Run cargo clippy | ||
run: cargo clippy --all-targets --all-features -- -D warnings | ||
- name: Run cargo fmt | ||
run: cargo fmt --all --check | ||
- name: Run cargo sort | ||
run: | | ||
cargo install cargo-sort | ||
cargo sort --grouped --check | ||
- name: Run cargo test | ||
run: cargo test --all-features --all-targets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: release | ||
on: workflow_dispatch | ||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
alias: unknown-linux-gnu | ||
- os: macos-12 | ||
alias: x86_64-apple-darwin | ||
- os: macos-13-xlarge | ||
alias: aarch64-apple-darwin | ||
- os: windows-latest | ||
alias: pc-windows-msvc | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- if: ${{ matrix.os == 'ubuntu-latest' }} | ||
name: Install dependencies (linux) | ||
run: | | ||
sudo apt install -y protobuf-compiler | ||
echo "PROTOC=$(which protoc)" >> $GITHUB_ENV | ||
- if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13-xlarge' }} | ||
name: Install dependencies (macos) | ||
run: | | ||
brew install protobuf | ||
echo "PROTOC=$(which protoc)" >> $GITHUB_ENV | ||
- if: ${{ matrix.sys.os == 'windows-latest' }} | ||
name: Install MSYS2 (windows) | ||
uses: msys2/setup-msys2@v2 | ||
- if: ${{ matrix.os == 'windows-latest' }} | ||
name: Install dependencies (windows) | ||
run: choco install protoc | ||
- name: Install Rust stable | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Run cargo build | ||
run: cargo build --profile=release-bin | ||
- if: ${{ !cancelled() }} | ||
uses: tree | ||
# with: | ||
# name: crx-${{ matrix.alias }} | ||
# path: target/release-bin/{crx,crx.exe} | ||
# if-no-files-found: error | ||
publish: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
if: ${{ !cancelled() && needs.build.result == 'success' }} | ||
env: | ||
RUST_BACKTRACE: 1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Login to crates.io | ||
run: cargo login $CRATES_IO_TOKEN | ||
env: | ||
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | ||
- name: Publish | ||
run: cargo publish | ||
env: | ||
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: [build, publish] | ||
if: ${{ !cancelled() && needs.publish.result == 'success' && needs.build.result == 'success' }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: /artifacts | ||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref_name }} | ||
run: | | ||
gh release create "$tag" \ | ||
--repo="$GITHUB_REPOSITORY" \ | ||
--title="${GITHUB_REPOSITORY#*/} ${tag#v}" \ | ||
--generate-notes | ||
gh release upload "$tag" /artifacts/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target | ||
/Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
[package] | ||
name = "crx" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = ["realtimetodie"] | ||
description = "A library to read and write as CRX packages" | ||
keywords = [ | ||
"browser", | ||
"browser extension", | ||
"crx", | ||
"chrome", | ||
"chrome extension", | ||
"extension", | ||
"web", | ||
"web extension", | ||
] | ||
categories = [ | ||
"command-line-utilities", | ||
"cryptography", | ||
"decoding", | ||
"encoding", | ||
"web-programming", | ||
"no-std", | ||
] | ||
license = "GPL-3.0" | ||
documentation = "https://docs.rs/crx/" | ||
repository = "https://github.com/realtimetodie/crx" | ||
rust-version = "1.65" | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
path = "src/lib.rs" | ||
|
||
[[bin]] | ||
name = "crx" | ||
path = "src/main.rs" | ||
|
||
[features] | ||
default = ["ecdsa", "rsa", "std"] | ||
ecdsa = ["dep:ecdsa", "dep:p256"] | ||
rsa = ["dep:rsa", "dep:sha2"] | ||
std = [] | ||
wasm = ["getrandom/js", "dep:wasm-bindgen"] | ||
|
||
[dependencies] | ||
clap = "4.4.12" | ||
const-oid = { version = "0.9.6", features = ["db"] } | ||
ecdsa = { version = "0.16.9", default-features = false, features = ["pem", "pkcs8", "verifying"], optional = true } | ||
getrandom = { version = "0.2.11", optional = true } | ||
p256 = { version = "0.13.2", optional = true } | ||
pkcs8 = { version = "0.10.2", features = ["encryption", "std", "pkcs5"] } | ||
prost = "0.12.3" | ||
rand = "0.8.5" | ||
rsa = { version = "0.9.6", default-features = false, features = ["sha2"], optional = true } | ||
sha2 = { version = "0.10.8", optional = true } | ||
signature = "2.2.0" | ||
wasm-bindgen = { version = "0.2.89", optional = true } | ||
|
||
[build-dependencies] | ||
prost-build = "0.12.3" | ||
|
||
[profile.release-bin] | ||
inherits = "release" | ||
strip = "debuginfo" |
Oops, something went wrong.