Skip to content

Update cd.yml #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2746bfb
Update cd.yml
oleander May 27, 2025
fb47ea9
feat: Update Configuration and Core Components (#35) 🤖
oleander May 28, 2025
6d71b68
chore: Release git-ai version 1.0.9
oleander May 28, 2025
819f874
OK 🤖
oleander May 28, 2025
092dd7a
Add 'colored' dependency and utilize for improved UI in examples.rs 🤖
oleander May 28, 2025
c7efbdb
Fix early exit issue in simulate.sh error handling 🤖
oleander May 28, 2025
466221d
Update hook.rs for improved bin functionality 🤖
oleander May 28, 2025
a49f220
Add toolchain action to Rust workflow 🤖
oleander May 28, 2025
6b1985d
The provided diff is incomplete and does not contain any change infor…
oleander May 28, 2025
15303a6
Update git-ai to version 0.1.14 in Cargo.lock and Cargo.toml 🤖
oleander May 28, 2025
f9d9741
Update hook.rs for improved bin functionality 🤖
oleander May 28, 2025
bc08b83
Remove debug flag from cargo install command in Justfile 🤖
oleander May 28, 2025
83d65ec
Refactor duplicated repo creation logic into into_repo method 🤖
oleander May 28, 2025
f8d39c4
Normalize table markdown format in README.md 🤖
oleander May 28, 2025
fa9c2e2
Specify target in cargo publish command 🤖
oleander May 28, 2025
464c084
Update Cargo.toml with new targets; enhance CI workflow steps 🤖
oleander May 28, 2025
0d9f648
The provided diff is incomplete and does not contain any change infor…
oleander May 28, 2025
21e2d62
Refactor error handling in network and git operations 🤖
oleander May 28, 2025
bfeb006
Remove commented-out build targets in cd.yml 🤖
oleander May 28, 2025
0813ff5
Update code and README for better clarity and accuracy 🤖
oleander May 28, 2025
4664654
Update Dockerfile to use Rust version 1.76.0 for improved compatibili…
oleander May 28, 2025
720531e
Update workflow and README to reflect logic move to config.rs 🤖
oleander May 28, 2025
547cefe
Remove redundant progress bar callbacks in hook.rs 🤖
oleander May 28, 2025
849bb4a
Fix duplicate sections in github workflow YAML file 🤖
oleander May 28, 2025
0fd323b
Refactor release script from shell to fish script 🤖
oleander May 28, 2025
33ff6fd
Enable Cargo test, publish, and build in Github workflows for CD and …
oleander May 28, 2025
ce222b8
Update dependencies in Cargo.toml to latest versions 🤖
oleander May 28, 2025
25a2a3e
Update git-ai crate to version 0.1.15 🤖
oleander May 28, 2025
f925147
Remove stale code and unused exclude files logic in git module 🤖
oleander May 28, 2025
ed961aa
Uncomment crates.io publish step in CD workflow 🤖
oleander May 28, 2025
f98d1ae
Update record.sh to include git AI commands in demo recording 🤖
oleander May 28, 2025
9798519
Update emoji color in log message 🤖
oleander May 28, 2025
0abb28f
Add CONTRIBUTING.md with guidelines for contributing to Git AI 🤖
oleander May 28, 2025
9bcdacb
Rename .rustfmt.toml to rustfmt.toml 🤖
oleander May 28, 2025
02df2bf
Set default values for CLI args, improve API key retrieval 🤖
oleander May 28, 2025
cc18622
Add release script to automate the versioning and tagging process 🤖
oleander May 28, 2025
ffaa7e2
Update config handling and add `home` crate dependency 🤖
oleander May 28, 2025
ff81755
Update git-ai version and tag name in workflow 🤖
oleander May 28, 2025
77bb081
Remove redundant comments in patch_test.rs 🤖
oleander May 28, 2025
86f78a0
Update GitHub CI Workflow 🤖
oleander May 28, 2025
d151628
Simplify release process and test workflow in Justfile and release sc…
oleander May 28, 2025
535ce34
Simplify README content and reorganize installation instructions 🤖
oleander May 28, 2025
0260ac2
Enable patience diff algorithm and clean up commented code 🤖
oleander May 28, 2025
06f666c
🤖
oleander May 28, 2025
48ece00
Update CD workflow
oleander May 28, 2025
f71eb1b
Update CD workflow 🤖
oleander May 28, 2025
e6c13ad
Merge branch 'main' into oleander-patch-1
oleander May 28, 2025
12a4c0d
Update CD workflow 🤖
oleander May 28, 2025
1d6f338
Remove unused dependencies from Cargo.toml and Cargo.lock 🤖
oleander May 28, 2025
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
6 changes: 6 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[env]

TMPDIR = "/tmp"

[target.x86_64-unknown-linux-musl]
linker = "musl-gcc"

[target.x86_64-unknown-linux-musl.openssl-sys]
rustc-link-lib = ["static=ssl", "static=crypto"]
280 changes: 229 additions & 51 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: CD
name: Build & Release

on:
push:
branches:
- main
workflow_dispatch:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -20,6 +21,7 @@ env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
ACTIONS_RUNTIME_TOKEN: dummy
CARGO_TERM_COLOR: always
RUST_CACHE_VERSION: 1

jobs:
artifact:
Expand All @@ -37,112 +39,288 @@ jobs:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
steps:
- name: Check if should skip this matrix combination
id: check_skip
run: |
# Skip macOS targets when running in act (Linux containers)
if [[ -n "${ACT}" && "${{ matrix.os }}" == "macos-latest" ]]; then
echo "skip=true" >> $GITHUB_OUTPUT
echo "Skipping macOS target in act environment"
else
echo "skip=false" >> $GITHUB_OUTPUT
fi

- uses: actions/checkout@v4
if: steps.check_skip.outputs.skip != 'true'

- name: Install Node.js for act
if: steps.check_skip.outputs.skip != 'true' && env.ACT == 'true'
run: |
# Install Node.js manually in act container
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
# Verify installation
node --version
npm --version

- name: Cache cargo registry
if: steps.check_skip.outputs.skip != 'true'
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-${{ matrix.target }}-cargo-registry-${{ env.RUST_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-registry-${{ env.RUST_CACHE_VERSION }}-
${{ runner.os }}-cargo-registry-${{ env.RUST_CACHE_VERSION }}-

- name: Cache cargo target
if: steps.check_skip.outputs.skip != 'true'
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-target-${{ env.RUST_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/*.rs') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-target-${{ env.RUST_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}-
${{ runner.os }}-${{ matrix.target }}-cargo-target-${{ env.RUST_CACHE_VERSION }}-

- name: Cache Rust toolchain
if: steps.check_skip.outputs.skip != 'true'
uses: actions/cache@v4
with:
path: |
~/.rustup/toolchains
~/.rustup/update-hashes
~/.rustup/settings.toml
key: ${{ runner.os }}-rust-toolchain-nightly-${{ matrix.target }}
restore-keys: |
${{ runner.os }}-rust-toolchain-nightly-
${{ runner.os }}-rust-toolchain-

- name: Install Node
if: steps.check_skip.outputs.skip != 'true'
uses: actions/setup-node@v4

- name: Setup Rust
if: steps.check_skip.outputs.skip != 'true'
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}

- name: Check if running in act
id: check_act
if: steps.check_skip.outputs.skip != 'true'
run: |
if [[ -n "${ACT}" ]]; then
echo "running_in_act=true" >> $GITHUB_OUTPUT
else
echo "running_in_act=false" >> $GITHUB_OUTPUT
fi

- name: Install node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Add x86_64-unknown-linux-musl target
if: matrix.target == 'x86_64-unknown-linux-musl'
if: matrix.target == 'x86_64-unknown-linux-musl' && steps.check_act.outputs.running_in_act != 'true' && steps.check_skip.outputs.skip != 'true'
run: |
rustup target add x86_64-unknown-linux-musl
sudo apt-get update && sudo apt-get install -y musl-tools

- name: Install Dependencies for musl Target
if: matrix.target == 'x86_64-unknown-linux-musl'
if: matrix.target == 'x86_64-unknown-linux-musl' && steps.check_act.outputs.running_in_act != 'true' && steps.check_skip.outputs.skip != 'true'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools musl-dev perl make pkg-config libssl-dev
# Set up environment for musl compilation
sudo apt-get install -y musl-tools musl-dev perl make pkg-config
# Set up environment for musl cross-compilation
echo "CC_x86_64_unknown_linux_musl=musl-gcc" >> $GITHUB_ENV
echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc" >> $GITHUB_ENV
# Configure OpenSSL build to avoid -m64 flag
echo "OPENSSL_STATIC=1" >> $GITHUB_ENV
echo "OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-musl" >> $GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=/usr/include" >> $GITHUB_ENV

- name: Skip musl build in act
if: matrix.target == 'x86_64-unknown-linux-musl' && steps.check_act.outputs.running_in_act == 'true' && steps.check_skip.outputs.skip != 'true'
run: |
echo "Skipping musl build in act due to cross-compilation issues"
mkdir -p bin
echo '#!/bin/sh' > bin/git-ai
echo 'echo "Placeholder for musl build in act"' >> bin/git-ai
chmod +x bin/git-ai
cp bin/git-ai bin/git-ai-hook

- name: Install Dependencies for Linux Target
if: matrix.target == 'x86_64-unknown-linux-gnu'
if: matrix.target == 'x86_64-unknown-linux-gnu' && steps.check_skip.outputs.skip != 'true'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev

- name: Build for target
if: ${{ !(matrix.target == 'x86_64-unknown-linux-musl' && steps.check_act.outputs.running_in_act == 'true') && steps.check_skip.outputs.skip != 'true' }}
run: |
cargo build \
-Z unstable-options \
--profile release-with-debug \
--artifact-dir bin \
--target ${{ matrix.target }}

- name: Upload and compress artifacts
- name: Package artifacts
if: steps.check_skip.outputs.skip != 'true'
run: |
mkdir -p dist
if [[ "${{ matrix.target }}" == *"-windows-"* ]]; then
cp bin/git-ai.exe dist/
cd dist
zip -r ../git-ai-${{ matrix.target }}.zip .
cd ..
else
cp bin/git-ai dist/
cd dist
tar -czf ../git-ai-${{ matrix.target }}.tar.gz .
cd ..
fi

- name: Upload packaged artifacts
if: steps.check_skip.outputs.skip != 'true'
uses: actions/upload-artifact@v4
with:
name: git-ai-${{ matrix.target }}-package
if-no-files-found: error
path: git-ai-${{ matrix.target }}.*

- name: Upload raw artifacts
if: steps.check_skip.outputs.skip != 'true'
uses: actions/upload-artifact@v4
with:
name: git-ai-${{ matrix.target }}
name: git-ai-${{ matrix.target }}-raw
if-no-files-found: error
path: bin/git-*

release:
runs-on: ubuntu-latest
runs-on: macos-latest
needs: artifact
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main

- name: Setup Rust
uses: dtolnay/rust-toolchain@nightly

- name: Configure git user name
run: git config user.name ${{ github.actor }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-cargo-registry-${{ env.RUST_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-${{ env.RUST_CACHE_VERSION }}-

- name: Configure git email
run: git config user.email ${{ github.actor }}@users.noreply.github.com
- name: Cache cargo target
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-target-release-${{ env.RUST_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-release-${{ env.RUST_CACHE_VERSION }}-

- name: Install cargo-bump
run: cargo install cargo-bump
- name: Cache cargo-binstall
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-binstall
key: ${{ runner.os }}-cargo-binstall-${{ env.RUST_CACHE_VERSION }}

- name: Bump version
run: cargo bump patch --git-tag
- uses: dtolnay/rust-toolchain@stable

- name: Commit Version Bump
run: git commit -a --amend --no-edit
- name: Install cargo-binstall
uses: taiki-e/install-action@v2
with:
tool: cargo-binstall

- name: New version
id: app
run: echo "version=$(git describe --tags --abbrev=0 HEAD)" >> $GITHUB_OUTPUT
- name: Install cargo-release
run: cargo binstall -y cargo-release

- name: Delete old tag
run: git tag -d ${{ steps.app.outputs.version }}
- name: Git config
run: |
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}@users.noreply.github.com

- name: Create new tag
run: git tag v${{ steps.app.outputs.version }}
- name: Checkout main
run: git checkout main

- name: Publish to crates.io
if: github.ref == 'refs/heads/main'
run: cargo publish --allow-dirty
- name: Build & publish
run: cargo release minor --no-confirm --execute --allow-branch main

- name: Test publish to crates.io (dry run)
if: github.ref != 'refs/heads/main'
run: cargo publish --dry-run --allow-dirty
- name: Create temporary directory for artifacts
run: mkdir -p ${{ runner.temp }}/artifacts

- name: Push to origin
if: github.ref == 'refs/heads/main'
run: git push origin HEAD --tags
- name: Download all packaged artifacts
uses: actions/download-artifact@v4
with:
pattern: git-ai-*-package
path: ${{ runner.temp }}/artifacts
merge-multiple: true

- name: Test push to origin (dry run)
if: github.ref != 'refs/heads/main'
run: git push origin HEAD --tags --dry-run
- name: Move artifacts to packages directory
run: |
mkdir -p packages
# Move all artifacts from temp to packages directory
mv ${{ runner.temp }}/artifacts/* packages/

- name: Download all artifacts
run: gh run download ${{ github.run_id }}
- name: Get version
id: app
run: echo "version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')" >> $GITHUB_OUTPUT

- name: Zip each downloaded directory
- name: Generate cargo-binstall metadata.json
run: |
for dir in $(ls -d git-ai-*); do
tar -czf ${dir}.tar.gz ${dir}
done
cat > metadata.json << EOF
{
"name": "git-ai",
"version": "${{ steps.app.outputs.version }}",
"package": {
"targets": [
{
"name": "git-ai",
"bins": ["git-ai"]
}
],
"platforms": {
"x86_64-unknown-linux-gnu": {
"bins": {
"git-ai": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.app.outputs.version }}/git-ai-x86_64-unknown-linux-gnu.tar.gz"
}
},
"x86_64-unknown-linux-musl": {
"bins": {
"git-ai": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.app.outputs.version }}/git-ai-x86_64-unknown-linux-musl.tar.gz"
}
},
"x86_64-apple-darwin": {
"bins": {
"git-ai": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.app.outputs.version }}/git-ai-x86_64-apple-darwin.tar.gz"
}
},
"aarch64-apple-darwin": {
"bins": {
"git-ai": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.app.outputs.version }}/git-ai-aarch64-apple-darwin.tar.gz"
}
}
}
}
}
EOF

- name: Uploads compressed artifacts
if: github.ref == 'refs/heads/main'
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.app.outputs.version }}
fail_on_unmatched_files: true
files: git-ai-*.tar.gz
fail_on_unmatched_files: false
files: |
packages/git-ai-*.tar.gz
packages/git-ai-*.zip
metadata.json
generate_release_notes: true
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: CI

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
# pull_request:
# types: [opened, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ref":"refs/tags/v0.0.0-test"}
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading