fix(gemini): handle structured output by using the first part #12
Workflow file for this run
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 Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| test: | |
| name: Test Suite | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| rust: [stable] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: rustfmt, clippy | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Check formatting | |
| run: cargo fmt -- --check | |
| - name: Run clippy | |
| run: cargo clippy -- -D warnings | |
| - name: Run tests | |
| run: cargo test --verbose | |
| - name: Test binary build | |
| run: cargo build --release | |
| security-audit: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-audit | |
| run: cargo install cargo-audit | |
| - name: Run security audit | |
| run: cargo audit | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools-preview | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@cargo-llvm-cov | |
| - name: Generate coverage report | |
| run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: lcov.info | |
| fail_ci_if_error: false | |
| build-release: | |
| name: Build Release Binaries | |
| runs-on: ${{ matrix.os }} | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| suffix: "" | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| suffix: .exe | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| suffix: "" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Create archive | |
| shell: bash | |
| run: | | |
| binary_name="commitcraft${{ matrix.suffix }}" | |
| binary_path="target/${{ matrix.target }}/release/${binary_name}" | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then | |
| archive_name="commitcraft-${{ matrix.target }}.zip" | |
| 7z a "$archive_name" "$binary_path" | |
| else | |
| archive_name="commitcraft-${{ matrix.target }}.tar.gz" | |
| tar -czf "$archive_name" -C "target/${{ matrix.target }}/release" "$binary_name" | |
| fi | |
| echo "ARCHIVE_NAME=$archive_name" >> $GITHUB_ENV | |
| echo "ARCHIVE_PATH=$archive_name" >> $GITHUB_ENV | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.ARCHIVE_NAME }} | |
| path: ${{ env.ARCHIVE_PATH }} | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [test, build-release] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| draft: false | |
| prerelease: ${{ contains(github.ref, '-') }} | |
| files: artifacts/**/* | |
| generate_release_notes: true | |
| body: | | |
| ## 🚀 What's New | |
| This release includes various improvements and bug fixes. | |
| ## 📦 Installation | |
| ### Quick Install (Linux/macOS) | |
| ```bash | |
| curl -sSL https://raw.githubusercontent.com/san0808/commitcraft/main/install.sh | bash | |
| ``` | |
| ### Manual Download | |
| Download the appropriate binary for your platform from the assets below. | |
| ### Cargo Install | |
| ```bash | |
| cargo install commitcraft | |
| ``` | |
| ## 🎯 Usage | |
| ```bash | |
| # First time setup | |
| commitcraft setup | |
| # Generate commit message | |
| git add . | |
| commitcraft | |
| ``` | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-crate: | |
| name: Publish to crates.io | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| if: startsWith(github.ref, 'refs/tags/v') && vars.ENABLE_CRATES_PUBLISH == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Publish to crates.io | |
| run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| continue-on-error: true |