Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[advisories]
ignore = ["RUSTSEC-2023-0071"] # rsa, no safe upgrade is available
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[net]
git-fetch-with-cli = true
47 changes: 47 additions & 0 deletions .cargo/deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[graph]
targets = []
all-features = false
no-default-features = false
exclude-dev = true

[output]
feature-depth = 1

[licenses]
allow = [
"Apache-2.0",
"MIT",
"Unicode-3.0",
]

confidence-threshold = 0.8
exceptions = []

[licenses.private]
ignore = true
registries = []

[bans]
multiple-versions = "allow"
wildcards = "allow"
highlight = "all"
workspace-default-features = "allow"
external-default-features = "allow"
allow = []
deny = []
skip = []
skip-tree = []

[sources]
unknown-registry = "warn"
unknown-git = "warn"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
allow-git = []

[sources.allow-org]
github = []
gitlab = []
bitbucket = []

[advisories]
ignore = []
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI

on:
pull_request:
branches: [main, master]
push:
branches: [main, master]

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache cargo and build
uses: Swatinem/rust-cache@v2

- name: Run rustfmt
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo and build
uses: Swatinem/rust-cache@v2

- name: Run tests
run: cargo test --all-features --verbose --locked

build:
name: Build (release)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo and build
uses: Swatinem/rust-cache@v2

- name: Build release
run: cargo build --release --all-features --locked

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: tiny-proxy-linux
path: target/release/tiny-proxy
if-no-files-found: error
72 changes: 72 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: PR Check

on:
pull_request:
branches: [main, master]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
quick-check:
name: Quick Quality Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache cargo and build
uses: Swatinem/rust-cache@v2

- name: Check formatting
run: cargo fmt --all -- --check

- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Quick build check
run: cargo check --all-features --locked

- name: Check documentation
run: cargo doc --no-deps --all-features --document-private-items

security-audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo and build
uses: Swatinem/rust-cache@v2

- name: Install cargo-audit
uses: taiki-e/install-action@cargo-audit

- name: Run cargo audit
run: cargo audit

license-check:
name: License Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo and build
uses: Swatinem/rust-cache@v2

- name: Install cargo-deny
uses: taiki-e/install-action@cargo-deny

- name: Check licenses
run: cargo deny check licenses
175 changes: 175 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
name: Release

on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g., v0.1.0)"
required: true
type: string

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C strip=symbols"

jobs:
release-build:
name: Build Release Binaries
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: tiny-proxy-linux-amd64
use-cross: false

- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact: tiny-proxy-linux-arm64
use-cross: true

- os: macos-13
target: x86_64-apple-darwin
artifact: tiny-proxy-macos-amd64
use-cross: false

- os: macos-14
target: aarch64-apple-darwin
artifact: tiny-proxy-macos-arm64
use-cross: false

- os: windows-latest
target: x86_64-pc-windows-msvc
artifact: tiny-proxy-windows-amd64.exe
use-cross: false

steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Install cross
if: matrix.use-cross
uses: taiki-e/install-action@cross

- name: Build
run: |
if [ "${{ matrix.use-cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }} --all-features --locked
else
cargo build --release --target ${{ matrix.target }} --all-features --locked
fi
shell: bash

- name: Prepare artifact
run: |
mkdir -p dist

BIN_PATH=target/${{ matrix.target }}/release/tiny-proxy

if [ "${{ runner.os }}" = "Windows" ]; then
BIN_PATH="${BIN_PATH}.exe"
fi

cp "$BIN_PATH" dist/${{ matrix.artifact }}

cd dist
shasum -a 256 ${{ matrix.artifact }} > ${{ matrix.artifact }}.sha256
shell: bash

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist/

publish-crate:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: release-build
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Publish
run: cargo publish --locked || echo "Already published"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [release-build, publish-crate]

steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist

- name: Get tag
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi

- name: Create release notes
run: |
cat > release_notes.md << EOF
# tiny-proxy ${{ steps.tag.outputs.tag }}

## Installation

### Linux/macOS
\`\`\`bash
curl -L https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.tag }}/tiny-proxy-linux-amd64 -o tiny-proxy
chmod +x tiny-proxy
./tiny-proxy --help
\`\`\`

### Windows
Download and run:
tiny-proxy-windows-amd64.exe

### Cargo
\`\`\`bash
cargo install tiny-proxy
\`\`\`
EOF

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.tag.outputs.tag }}
name: tiny-proxy ${{ steps.tag.outputs.tag }}
body_path: release_notes.md
files: dist/**/*
draft: false
prerelease: ${{ contains(steps.tag.outputs.tag, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading