mirror of https://github.com/buster-so/buster.git
cli release code
This commit is contained in:
parent
37854342da
commit
09ab45bbb5
|
@ -0,0 +1,93 @@
|
|||
name: CLI Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'cli/**'
|
||||
- '.github/workflows/cli-release.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
# Add permissions for creating releases
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: blacksmith-16vcpu-ubuntu-2204
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: Cache Rust dependencies
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Configure Cargo for optimized build
|
||||
run: |
|
||||
mkdir -p .cargo
|
||||
echo '[profile.release]' > .cargo/config.toml
|
||||
echo 'lto = true' >> .cargo/config.toml
|
||||
echo 'codegen-units = 1' >> .cargo/config.toml
|
||||
echo 'panic = "abort"' >> .cargo/config.toml
|
||||
echo 'opt-level = 3' >> .cargo/config.toml
|
||||
echo 'strip = true' >> .cargo/config.toml
|
||||
|
||||
- name: Build optimized release
|
||||
working-directory: ./cli
|
||||
run: cargo build --release
|
||||
|
||||
- name: Compress binary
|
||||
working-directory: ./cli
|
||||
run: |
|
||||
cd target/release
|
||||
tar czf buster-cli-linux-x86_64.tar.gz buster
|
||||
sha256sum buster-cli-linux-x86_64.tar.gz > buster-cli-linux-x86_64.tar.gz.sha256
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: buster-cli
|
||||
path: |
|
||||
cli/target/release/buster-cli-linux-x86_64.tar.gz
|
||||
cli/target/release/buster-cli-linux-x86_64.tar.gz.sha256
|
||||
retention-days: 1
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: buster-cli
|
||||
|
||||
- name: Get version
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=$(cat version.txt)
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: v${{ steps.get_version.outputs.version }}
|
||||
name: Release v${{ steps.get_version.outputs.version }}
|
||||
files: |
|
||||
buster-cli-linux-x86_64.tar.gz
|
||||
buster-cli-linux-x86_64.tar.gz.sha256
|
||||
draft: false
|
||||
prerelease: false
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -174,7 +174,7 @@ async fn enhance_yaml_with_descriptions(yaml: String) -> Result<String> {
|
|||
LlmMessage::new(
|
||||
"developer".to_string(),
|
||||
"You are a YAML description enhancer. Your output must be wrapped in markdown code blocks using ```yml format.
|
||||
Your task is to ONLY replace text matching exactly \"{NEED DESCRIPTION HERE}\" with appropriate descriptions.
|
||||
Your task is to ONLY replace text matching exactly \"{NEED DESCRIPTION HERE}\" with appropriate descriptions. Do not modify any other parts of the YAML or other descriptions without the placeholder. You should still return the entire YAML in your output.
|
||||
DO NOT modify any other part of the YAML.
|
||||
DO NOT add any explanations or text outside the ```yml block.
|
||||
Return the complete YAML wrapped in markdown, with only the placeholders replaced.".to_string(),
|
||||
|
@ -190,7 +190,7 @@ async fn enhance_yaml_with_descriptions(yaml: String) -> Result<String> {
|
|||
&messages,
|
||||
0.1,
|
||||
2048,
|
||||
30,
|
||||
120,
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
|
|
|
@ -124,19 +124,19 @@ impl YamlDiffMerger {
|
|||
// Update dimensions while preserving style
|
||||
if let Some(existing_dims) = map.get_mut("dimensions") {
|
||||
if let Value::Sequence(dims) = existing_dims {
|
||||
// Create a map of existing dimensions by name
|
||||
// Create a map of existing dimensions by name (case insensitive)
|
||||
let mut dim_map: HashMap<String, &Value> = HashMap::new();
|
||||
for dim in dims.iter() {
|
||||
if let Some(name) = dim.get("name").and_then(|n| n.as_str()) {
|
||||
dim_map.insert(name.to_string(), dim);
|
||||
dim_map.insert(name.to_lowercase(), dim);
|
||||
}
|
||||
}
|
||||
|
||||
// Update dimensions while preserving order and style
|
||||
let mut new_dims = Vec::new();
|
||||
for dim in &new_model.dimensions {
|
||||
if let Some(&existing_dim) = dim_map.get(&dim.name) {
|
||||
// Preserve existing dimension's style
|
||||
if let Some(&existing_dim) = dim_map.get(&dim.name.to_lowercase()) {
|
||||
// Preserve existing dimension's style and casing
|
||||
new_dims.push(existing_dim.clone());
|
||||
} else {
|
||||
// Add new dimension
|
||||
|
@ -150,19 +150,19 @@ impl YamlDiffMerger {
|
|||
// Update measures while preserving style
|
||||
if let Some(existing_measures) = map.get_mut("measures") {
|
||||
if let Value::Sequence(measures) = existing_measures {
|
||||
// Create a map of existing measures by name
|
||||
// Create a map of existing measures by name (case insensitive)
|
||||
let mut measure_map: HashMap<String, &Value> = HashMap::new();
|
||||
for measure in measures.iter() {
|
||||
if let Some(name) = measure.get("name").and_then(|n| n.as_str()) {
|
||||
measure_map.insert(name.to_string(), measure);
|
||||
measure_map.insert(name.to_lowercase(), measure);
|
||||
}
|
||||
}
|
||||
|
||||
// Update measures while preserving order and style
|
||||
let mut new_measures = Vec::new();
|
||||
for measure in &new_model.measures {
|
||||
if let Some(&existing_measure) = measure_map.get(&measure.name) {
|
||||
// Preserve existing measure's style
|
||||
if let Some(&existing_measure) = measure_map.get(&measure.name.to_lowercase()) {
|
||||
// Preserve existing measure's style and casing
|
||||
new_measures.push(existing_measure.clone());
|
||||
} else {
|
||||
// Add new measure
|
||||
|
@ -233,13 +233,13 @@ impl YamlDiffMerger {
|
|||
|
||||
// Create maps for quick lookups
|
||||
let existing_dims: HashMap<_, _> = existing_model.dimensions.iter()
|
||||
.map(|d| (d.name.clone(), d)).collect();
|
||||
.map(|d| (d.name.to_lowercase(), d)).collect();
|
||||
let existing_measures: HashMap<_, _> = existing_model.measures.iter()
|
||||
.map(|m| (m.name.clone(), m)).collect();
|
||||
.map(|m| (m.name.to_lowercase(), m)).collect();
|
||||
let new_dims: HashMap<_, _> = new_model.dimensions.iter()
|
||||
.map(|d| (d.name.clone(), d)).collect();
|
||||
.map(|d| (d.name.to_lowercase(), d)).collect();
|
||||
let new_measures: HashMap<_, _> = new_model.measures.iter()
|
||||
.map(|m| (m.name.clone(), m)).collect();
|
||||
.map(|m| (m.name.to_lowercase(), m)).collect();
|
||||
|
||||
let mut changes = ModelDiff {
|
||||
added_dimensions: Vec::new(),
|
||||
|
@ -258,9 +258,9 @@ impl YamlDiffMerger {
|
|||
changes.added_dimensions.push((*dim).clone());
|
||||
}
|
||||
}
|
||||
for name in existing_dims.keys() {
|
||||
for (name, dim) in existing_dims.iter() {
|
||||
if !new_dims.contains_key(name) {
|
||||
changes.removed_dimensions.push(name.clone());
|
||||
changes.removed_dimensions.push(dim.name.clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,9 +272,9 @@ impl YamlDiffMerger {
|
|||
changes.added_measures.push((*measure).clone());
|
||||
}
|
||||
}
|
||||
for name in existing_measures.keys() {
|
||||
for (name, measure) in existing_measures.iter() {
|
||||
if !new_measures.contains_key(name) {
|
||||
changes.removed_measures.push(name.clone());
|
||||
changes.removed_measures.push(measure.name.clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue