├── .gitignore ├── README.md ├── src └── main.rs ├── Cargo.lock ├── .github └── workflows │ ├── release_asset.yml │ ├── release-deb.yml │ └── release.yml └── Cargo.toml /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gh-test-rust 2 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("Hello, world!"); 3 | } 4 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "gh-test-rust" 7 | version = "0.1.0" 8 | -------------------------------------------------------------------------------- /.github/workflows/release_asset.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Release Assets 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | generate-sbom: 9 | runs-on: ubuntu-latest 10 | name: Generate and Upload SBOM 11 | steps: 12 | - name: Checkout repository 13 | uses: actions/checkout@v4 14 | 15 | - name: Install Rust toolchain 16 | uses: dtolnay/rust-toolchain@stable 17 | with: 18 | toolchain: stable 19 | 20 | - name: Install cargo-cyclonedx 21 | run: cargo install cargo-cyclonedx 22 | 23 | - name: Generate SBOM 24 | run: cargo cyclonedx --format xml --override-filename urx.cdx 25 | 26 | - name: Upload SBOM to release 27 | uses: softprops/action-gh-release@v2 28 | with: 29 | files: urx.cdx.xml 30 | env: 31 | GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} 32 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "gh-test-rust" 3 | version = "0.1.0" 4 | edition = "2024" 5 | 6 | [dependencies] 7 | tokio = { version = "1.44", features = ["full"] } 8 | clap = { version = "4.4", features = ["derive"] } 9 | reqwest = { version = "0.12", features = ["json"] } 10 | serde = { version = "1.0", features = ["derive"] } 11 | serde_json = "1.0" 12 | anyhow = "1.0" 13 | futures = "0.3" 14 | indicatif = "0.17.7" 15 | url = "2.5.0" 16 | rand = "0.8.5" 17 | scraper = "0.18.1" 18 | toml = "0.8.8" 19 | async-trait = "0.1" 20 | roxmltree = "0.20.0" 21 | colored = "2.0.0" 22 | async-recursion = "1.0.5" 23 | flate2 = "1.0" 24 | rusqlite = { version = "0.32", features = ["bundled"] } 25 | redis = { version = "0.27", optional = true, features = ["aio", "tokio-comp"] } 26 | sha2 = "0.10" 27 | chrono = { version = "0.4", features = ["serde"] } 28 | 29 | [dev-dependencies] 30 | mockito = "1.7.0" 31 | tempfile = "3.8.0" 32 | 33 | [features] 34 | default = [] 35 | redis-cache = ["redis"] 36 | 37 | -------------------------------------------------------------------------------- /.github/workflows/release-deb.yml: -------------------------------------------------------------------------------- 1 | name: Upload .deb on Release Publish 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | permissions: 8 | contents: write 9 | 10 | jobs: 11 | build-and-upload-deb: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout repository at release tag 15 | uses: actions/checkout@v4 16 | with: 17 | ref: ${{ github.event.release.tag_name }} 18 | 19 | - name: Install Rust toolchain 20 | uses: dtolnay/rust-toolchain@stable 21 | with: 22 | toolchain: stable 23 | targets: x86_64-unknown-linux-gnu 24 | 25 | - name: Install cargo-deb 26 | run: cargo install cargo-deb --locked 27 | 28 | - name: Build .deb package 29 | run: cargo deb 30 | 31 | - name: Upload .deb files to the released tag 32 | env: 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 34 | run: | 35 | echo "Uploading .deb files to release ${{ github.event.release.tag_name }} ..." 36 | for file in target/debian/*.deb; do 37 | [ -f "$file" ] || continue 38 | echo "Uploading $(basename "$file")" 39 | gh release upload "${{ github.event.release.tag_name }}" "$file" --clobber 40 | done 41 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Release 3 | 4 | on: 5 | release: 6 | types: [published] 7 | 8 | env: 9 | CARGO_TERM_COLOR: always 10 | 11 | jobs: 12 | build-and-upload: 13 | name: Build and upload 14 | runs-on: ${{ matrix.os }} 15 | 16 | permissions: 17 | contents: write # Required to upload release assets 18 | 19 | strategy: 20 | matrix: 21 | include: 22 | # Linux targets 23 | - build: linux-x86_64 24 | os: ubuntu-latest 25 | target: x86_64-unknown-linux-gnu 26 | use_cross: false 27 | - build: linux-aarch64 28 | os: ubuntu-24.04-arm 29 | target: aarch64-unknown-linux-gnu 30 | use_cross: false # Cross-compilation needed for ARM64 31 | # macOS targets 32 | - build: macos-x86_64 33 | os: macos-latest 34 | target: x86_64-apple-darwin 35 | use_cross: false 36 | - build: macos-aarch64 37 | os: macos-latest 38 | target: aarch64-apple-darwin 39 | use_cross: false # Apple Silicon Macs can build for both architectures natively 40 | # Windows targets 41 | - build: windows-x86_64 42 | os: windows-latest 43 | target: x86_64-pc-windows-msvc 44 | use_cross: false 45 | 46 | steps: 47 | - name: Checkout 48 | uses: actions/checkout@v4 49 | 50 | - name: Get the release version from the tag 51 | shell: bash 52 | run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV 53 | 54 | - name: Install Rust 55 | uses: dtolnay/rust-toolchain@stable 56 | with: 57 | targets: ${{ matrix.target }} 58 | 59 | - name: Install cross-compilation tools 60 | if: matrix.use_cross == true 61 | uses: taiki-e/install-action@v2 62 | with: 63 | tool: cross 64 | 65 | - name: Build 66 | shell: bash 67 | run: | 68 | if [[ "${{ matrix.use_cross }}" == "true" ]]; then 69 | cross build --verbose --release --target ${{ matrix.target }} 70 | else 71 | cargo build --verbose --release --target ${{ matrix.target }} 72 | fi 73 | 74 | - name: Build archive 75 | shell: bash 76 | run: | 77 | binary_name="gh-test-rust" 78 | dirname="$binary_name-$VERSION-${{ matrix.build }}" 79 | mkdir "$dirname" 80 | 81 | # Move the appropriate binary into the archive directory 82 | if [ "${{ matrix.os }}" = "windows-latest" ]; then 83 | mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" 84 | else 85 | mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" 86 | fi 87 | 88 | # Create the appropriate archive format for each OS 89 | if [ "${{ matrix.os }}" = "windows-latest" ]; then 90 | 7z a "$dirname.zip" "$dirname" 91 | echo "ASSET=$dirname.zip" >> $GITHUB_ENV 92 | else 93 | tar -czf "$dirname.tar.gz" "$dirname" 94 | echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV 95 | fi 96 | 97 | - name: Generate checksums 98 | shell: bash 99 | run: | 100 | if [ "${{ matrix.os }}" = "windows-latest" ]; then 101 | certutil -hashfile "$ASSET" SHA256 > "$ASSET.sha256" 102 | else 103 | shasum -a 256 "$ASSET" > "$ASSET.sha256" 104 | fi 105 | 106 | - name: Upload release archive 107 | uses: softprops/action-gh-release@v2 108 | with: 109 | files: | 110 | ${{ env.ASSET }} 111 | ${{ env.ASSET }}.sha256 112 | --------------------------------------------------------------------------------