chore(deps): update rust crate rfd to v0.17.1 #675
This file contains hidden or 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
| name: CI/CD | |
| on: | |
| push: | |
| pull_request: | |
| types: | |
| - opened | |
| workflow_dispatch: # allow manual execution | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-repo: | |
| name: Check git repository | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| format: 'table' | |
| exit-code: '1' | |
| ignore-unfixed: true | |
| severity: 'CRITICAL,HIGH' | |
| check-code-style: | |
| name: Check code style | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| components: rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| shared-key: "fmt-check" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Check the code style | |
| run: cargo fmt --all -- --check | |
| check-code: | |
| name: Check rust code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| components: clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| shared-key: "clippy-check" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Verify code | |
| run: cargo clippy | |
| check-unused-dependencies: | |
| name: Check for unused deps | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: nightly | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| shared-key: "udeps-check" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Install cargo-udeps | |
| uses: cargo-bins/cargo-binstall@main | |
| with: | |
| package: cargo-udeps | |
| - name: Analyze dependencies | |
| run: cargo update && cargo +nightly udeps | |
| continue-on-error: true | |
| test: | |
| name: Run application tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| shared-key: "test" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Run unit tests | |
| run: cargo test | |
| build-feature: | |
| name: Build feature branch | |
| needs: [ check-repo, check-code-style, check-code, test ] | |
| runs-on: ubuntu-latest | |
| if: github.ref != 'refs/heads/main' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [ 'x86_64-unknown-linux-gnu', 'x86_64-pc-windows-gnu' ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| shared-key: "feature-build-${{ matrix.target }}" | |
| - name: Build binary | |
| run: | | |
| # Build the binary with regular cargo build | |
| cargo build --release | |
| # Set the target directory path | |
| CARGO_BUILD_TARGET=$(rustc -vV | grep host | cut -d' ' -f2) | |
| echo "Using host target: ${CARGO_BUILD_TARGET}" | |
| echo "CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET}" >> $GITHUB_ENV | |
| echo "Binary built at: target/release/binvec" | |
| ls -la "target/release/binvec" || echo "Binary not found!" | |
| create-release: | |
| name: Create new release | |
| needs: [ check-repo, check-code-style, check-code, test ] | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| outputs: | |
| version: ${{ steps.semantic-release.outputs.new_release_version }} | |
| upload_url: ${{ steps.semantic-release.outputs.upload_url }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # Required for semantic-release to access commit history | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Install Dependencies | |
| run: | | |
| npm init -y | |
| npm install \ | |
| semantic-release \ | |
| @semantic-release/git \ | |
| @semantic-release/changelog \ | |
| @semantic-release/exec \ | |
| @semantic-release/commit-analyzer \ | |
| conventional-changelog-conventionalcommits | |
| - name: Generate Semantic Release Notes and Create Release | |
| id: semantic-release | |
| env: | |
| # Use a more limited scoped token for releases only | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
| run: npx semantic-release | |
| - name: Delete old releases | |
| uses: dev-drprasad/delete-older-releases@v0.3.4 | |
| with: | |
| keep_latest: 5 | |
| delete_tags: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build: | |
| name: Build artifacts | |
| needs: [ create-release ] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [ 'x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu', 'armv7-unknown-linux-gnueabihf', 'arm-unknown-linux-gnueabihf', 'x86_64-pc-windows-gnu' ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set version and upload URL from semantic-release | |
| run: | | |
| echo "VERSION=${{ needs.create-release.outputs.version }}" >> $GITHUB_ENV | |
| echo "UPLOAD_URL=${{ needs.create-release.outputs.upload_url }}" >> $GITHUB_ENV | |
| - name: Fallback to fetch release info if needed | |
| if: env.VERSION == '' || env.UPLOAD_URL == '' | |
| run: | | |
| REPO="RouHim/binvec" | |
| LATEST_RELEASE_JSON=$(curl --silent --retry 3 "https://api.github.com/repos/$REPO/releases/latest") | |
| LATEST_RELEASE=$(echo "$LATEST_RELEASE_JSON" | jq -r '.tag_name') | |
| UPLOAD_URL=$(echo "$LATEST_RELEASE_JSON" | jq -r '.upload_url') | |
| if [[ -z "$LATEST_RELEASE" || "$LATEST_RELEASE" == "null" || -z "$UPLOAD_URL" || "$UPLOAD_URL" == "null" ]]; then | |
| echo "Failed to fetch release information. Tag or Upload URL might be null." | |
| echo "API Response: $LATEST_RELEASE_JSON" | |
| exit 1 | |
| fi | |
| echo "Latest release is $LATEST_RELEASE" | |
| echo "VERSION=$LATEST_RELEASE" >> $GITHUB_ENV | |
| echo "UPLOAD_URL=${UPLOAD_URL}" >> $GITHUB_ENV | |
| - name: Update version in Cargo.toml | |
| run: | | |
| if [ -z "${{ env.VERSION }}" ]; then | |
| echo "Error: VERSION environment variable is not set" | |
| exit 1 | |
| fi | |
| sed -i 's/version = "0.0.0"/version = "${{ env.VERSION }}"/g' Cargo.toml | |
| echo "Cargo version is now" $(cargo metadata --no-deps --format-version 1 | jq -r ".packages[0].version") | |
| - name: Install rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| shared-key: "build-${{ matrix.target }}" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Build and prepare binary for upload | |
| run: | | |
| # Build the binary with regular cargo build | |
| cargo build --release | |
| # Set the target directory path | |
| CARGO_BUILD_TARGET=$(rustc -vV | grep host | cut -d' ' -f2) | |
| echo "Using host target: ${CARGO_BUILD_TARGET}" | |
| echo "CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET}" >> $GITHUB_ENV | |
| ORIGINAL_BINARY_PATH="target/release/binvec" | |
| # Add .exe extension for Windows targets | |
| if [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
| RENAMED_BINARY_NAME="binvec-${{ matrix.target }}.exe" | |
| else | |
| RENAMED_BINARY_NAME="binvec-${{ matrix.target }}" | |
| fi | |
| DEST_DIR="target/release" | |
| RENAMED_BINARY_PATH="${DEST_DIR}/${RENAMED_BINARY_NAME}" | |
| echo "Original binary path: $ORIGINAL_BINARY_PATH" | |
| echo "Will be renamed to: $RENAMED_BINARY_PATH" | |
| if [ -f "$ORIGINAL_BINARY_PATH" ]; then | |
| echo "Binary found at: $ORIGINAL_BINARY_PATH" | |
| ls -la "$ORIGINAL_BINARY_PATH" | |
| # Ensure destination directory exists (it should, but good practice) | |
| mkdir -p "$DEST_DIR" | |
| cp "$ORIGINAL_BINARY_PATH" "$RENAMED_BINARY_PATH" | |
| echo "Copied binary to: $RENAMED_BINARY_PATH" | |
| ls -la "$RENAMED_BINARY_PATH" | |
| else | |
| echo "ERROR: Binary not found at expected path: $ORIGINAL_BINARY_PATH" | |
| echo "Listing contents of expected directory: ${DEST_DIR}/" | |
| ls -la "${DEST_DIR}/" || echo "Directory ${DEST_DIR}/ not found or empty." | |
| echo "Listing full target directory structure (first 50 lines):" | |
| ls -R target | head -n 50 | |
| exit 1 | |
| fi | |
| - name: Upload artifact | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.VERSION }} | |
| files: target/release/binvec-${{ matrix.target }}* | |
| name: Release ${{ env.VERSION }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fail_on_unmatched_files: true | |
| draft: false | |
| prerelease: false | |
| publish-aur: | |
| name: Publish to AUR | |
| needs: [ build ] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: archlinux:latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install necessary packages | |
| run: pacman --sync --refresh --noconfirm jq | |
| - name: Get version | |
| run: | | |
| echo "VERSION=${{ needs.create-release.outputs.version }}" >> $GITHUB_ENV | |
| - name: Fallback to fetch version if needed | |
| if: env.VERSION == '' | |
| run: | | |
| REPO="RouHim/binvec" | |
| LATEST_RELEASE_JSON=$(curl --silent --retry 3 "https://api.github.com/repos/$REPO/releases/latest") | |
| LATEST_RELEASE=$(echo "$LATEST_RELEASE_JSON" | jq -r '.tag_name') | |
| if [[ -z "$LATEST_RELEASE" || "$LATEST_RELEASE" == "null" ]]; then | |
| echo "Failed to fetch release information or tag_name is null." | |
| echo "API Response: $LATEST_RELEASE_JSON" # For better debugging | |
| exit 1 | |
| fi | |
| echo "VERSION=$LATEST_RELEASE" >> $GITHUB_ENV | |
| - name: Update version in PKGBUILD | |
| run: | | |
| sed -i "s/pkgver=.*/pkgver=$VERSION/g" PKGBUILD | |
| - name: Publish AUR package | |
| uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 | |
| with: | |
| pkgname: binvec | |
| pkgbuild: ./PKGBUILD | |
| updpkgsums: true | |
| commit_username: ${{ secrets.AUR_USERNAME }} | |
| commit_email: ${{ secrets.AUR_EMAIL }} | |
| ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
| commit_message: "Update to v${{ env.VERSION }}" | |
| force_push: "true" | |
| ssh_keyscan_types: "rsa,ecdsa,ed25519" | |
| publish-aur-bin: | |
| name: Publish to AUR (Binary Package) | |
| needs: [ build ] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: archlinux:latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install necessary packages for AUR | |
| run: pacman --sync --refresh --noconfirm jq | |
| - name: Get version | |
| run: | | |
| echo "VERSION=${{ needs.create-release.outputs.version }}" >> $GITHUB_ENV | |
| - name: Fallback to fetch version if needed | |
| if: env.VERSION == '' | |
| run: | | |
| REPO="RouHim/binvec" | |
| LATEST_RELEASE_JSON=$(curl --silent --retry 3 "https://api.github.com/repos/$REPO/releases/latest") | |
| LATEST_RELEASE=$(echo "$LATEST_RELEASE_JSON" | jq -r '.tag_name') | |
| if [[ -z "$LATEST_RELEASE" || "$LATEST_RELEASE" == "null" ]]; then | |
| echo "Failed to fetch release information or tag_name is null." | |
| echo "API Response: $LATEST_RELEASE_JSON" # For better debugging | |
| exit 1 | |
| fi | |
| echo "VERSION=$LATEST_RELEASE" >> $GITHUB_ENV | |
| - name: Update version in PKGBUILD.bin | |
| run: | | |
| sed -i "s/pkgver=.*/pkgver=$VERSION/g" PKGBUILD.bin | |
| - name: Publish AUR Binary Package | |
| uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 | |
| with: | |
| pkgname: binvec-bin | |
| pkgbuild: ./PKGBUILD.bin | |
| updpkgsums: true | |
| commit_username: ${{ secrets.AUR_USERNAME }} | |
| commit_email: ${{ secrets.AUR_EMAIL }} | |
| ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
| commit_message: "Update to v${{ env.VERSION }}" | |
| force_push: "true" | |
| ssh_keyscan_types: "rsa,ecdsa,ed25519" | |