mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-15 14:47:51 +00:00
Bump libs. added CI
This commit is contained in:
44
.github/workflows/ci.yml
vendored
Normal file
44
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master, develop]
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_BACKTRACE: 1
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo test --locked
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo clippy --all-targets --all-features -- -D warnings
|
||||
|
||||
fmt:
|
||||
name: Format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt
|
||||
- run: cargo fmt --all -- --check
|
||||
134
.github/workflows/release.yml
vendored
Normal file
134
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build ${{ matrix.target }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
use_cross: false
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-musl
|
||||
use_cross: false
|
||||
- os: ubuntu-latest
|
||||
target: aarch64-unknown-linux-gnu
|
||||
use_cross: true
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
use_cross: false
|
||||
- os: macos-latest
|
||||
target: aarch64-apple-darwin
|
||||
use_cross: false
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
use_cross: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Install musl tools
|
||||
if: matrix.target == 'x86_64-unknown-linux-musl'
|
||||
run: sudo apt-get update && sudo apt-get install -y musl-tools
|
||||
|
||||
- name: Install cross
|
||||
if: matrix.use_cross
|
||||
run: cargo install cross --git https://github.com/cross-rs/cross
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
key: ${{ matrix.target }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
if [ "${{ matrix.use_cross }}" == "true" ]; then
|
||||
cross build --release --locked --target ${{ matrix.target }}
|
||||
else
|
||||
cargo build --release --locked --target ${{ matrix.target }}
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Get binary name
|
||||
id: binary
|
||||
run: |
|
||||
name=$(grep '^name = ' Cargo.toml | head -1 | cut -d'"' -f2)
|
||||
if [ "${{ runner.os }}" == "Windows" ]; then
|
||||
echo "name=${name}.exe" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "name=${name}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Strip binary
|
||||
if: runner.os != 'Windows'
|
||||
run: strip target/${{ matrix.target }}/release/${{ steps.binary.outputs.name }}
|
||||
|
||||
- name: Package
|
||||
id: package
|
||||
run: |
|
||||
name=$(grep '^name = ' Cargo.toml | head -1 | cut -d'"' -f2)
|
||||
target="${{ matrix.target }}"
|
||||
binary="${{ steps.binary.outputs.name }}"
|
||||
|
||||
cd target/${target}/release
|
||||
|
||||
if [ "${{ runner.os }}" == "Windows" ]; then
|
||||
archive="${name}-${target}.zip"
|
||||
7z a ../../../${archive} ${binary}
|
||||
echo "archive=${archive}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
archive="${name}-${target}.tar.gz"
|
||||
tar czf ../../../${archive} ${binary}
|
||||
echo "archive=${archive}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.target }}
|
||||
path: ${{ steps.package.outputs.archive }}
|
||||
|
||||
release:
|
||||
name: Release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Generate changelog
|
||||
run: |
|
||||
if [ -n "$(git tag --sort=-creatordate | head -n 2 | tail -n 1)" ]; then
|
||||
prev_tag=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
|
||||
git log ${prev_tag}..HEAD --pretty=format:"- %s" > CHANGELOG.md
|
||||
else
|
||||
echo "Initial release" > CHANGELOG.md
|
||||
fi
|
||||
|
||||
- uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
body_path: CHANGELOG.md
|
||||
files: artifacts/**/*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -609,7 +609,7 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
|
||||
[[package]]
|
||||
name = "v2parser"
|
||||
version = "0.3.1"
|
||||
version = "0.4.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"clap",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "v2parser"
|
||||
version = "0.3.1"
|
||||
edition = "2021"
|
||||
version = "0.4.0"
|
||||
edition = "2024"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@@ -15,7 +15,9 @@ serde = { version = "1.0.189", features = ["derive"] }
|
||||
serde_json = "1.0.107"
|
||||
urlencoding = "2"
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
tempfile = "3"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
signal-hook = "0.3"
|
||||
signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }
|
||||
tempfile = "3"
|
||||
futures = "0.3"
|
||||
|
||||
@@ -64,26 +64,6 @@ impl XrayRunner {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn is_running(&mut self) -> bool {
|
||||
if let Some(process) = &mut self.process {
|
||||
match process.try_wait() {
|
||||
Ok(Some(_)) => {
|
||||
// Process has exited
|
||||
self.process = None;
|
||||
false
|
||||
}
|
||||
Ok(None) => true, // Process is still running
|
||||
Err(_) => {
|
||||
// Error checking status, assume not running
|
||||
self.process = None;
|
||||
false
|
||||
}
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for XrayRunner {
|
||||
|
||||
Reference in New Issue
Block a user