From 9b901a0ff8678f8de4e9190825e5e35cd34a4648 Mon Sep 17 00:00:00 2001 From: Salman Mohammed Date: Thu, 16 Jan 2025 16:16:43 -0500 Subject: [PATCH] combine the two CI workflows into a single one, skip docs dir --- .github/workflows/ci-desktop.yml | 30 ----- .github/workflows/ci.yaml | 103 -------------- .github/workflows/ci.yml | 126 ++++++++++++++++++ ...p-release.yaml => desktop-app-release.yml} | 0 4 files changed, 126 insertions(+), 133 deletions(-) delete mode 100644 .github/workflows/ci-desktop.yml delete mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/ci.yml rename .github/workflows/{desktop-app-release.yaml => desktop-app-release.yml} (100%) diff --git a/.github/workflows/ci-desktop.yml b/.github/workflows/ci-desktop.yml deleted file mode 100644 index 82905d180..000000000 --- a/.github/workflows/ci-desktop.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Desktop App Lint - -on: - push: - branches: - - v1.0 - pull_request: - branches: - - v1.0 - -jobs: - build: - runs-on: macos-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: 'lts/*' - - - name: Install dependencies - run: npm ci - working-directory: ui/desktop - - - name: Run Lint check - run: npm run lint:check - working-directory: ui/desktop \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 8926d2d6e..000000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,103 +0,0 @@ -name: Rust Build and Test - -on: - push: - branches: - - v1.0 - pull_request: - branches: - - v1.0 - -jobs: - format: - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - - - name: check format - run: | - cargo fmt --check - - build-and-test: - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - - name: Install Libs - run: | - sudo apt update -y - sudo apt install -y libdbus-1-dev gnome-keyring libxcb1-dev - - - name: Start gnome-keyring - # run gnome-keyring with 'foobar' as password for the login keyring - # this will create a new login keyring and unlock it - # the login password doesn't matter, but the keyring must be unlocked for the tests to work - run: gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar' - - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - - - name: Cache Cargo registry - uses: actions/cache@v3 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo index - uses: actions/cache@v3 - with: - path: ~/.cargo/index - key: ${{ runner.os }}-cargo-index - restore-keys: | - ${{ runner.os }}-cargo-index - - - name: Cache Cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-build- - - - name: Install Ollama - run: curl -fsSL https://ollama.com/install.sh | sh - - - name: Start Ollama - run: | - # Run the background, in a way that survives to the next step - nohup ollama serve > ollama.log 2>&1 & - - # Block using the ready endpoint - time curl --retry 5 --retry-connrefused --retry-delay 1 -sf http://localhost:11434 - - - name: Test Ollama model - run: ollama run qwen2.5 hello || cat ollama.log - - - name: Build the Rust project - run: cargo build - - - name: Run Tests - run: cargo test --verbose - env: - OLLAMA_MODEL: "qwen2.5" - - - name: check lint - run: | - cargo clippy diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..dcbce61f2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,126 @@ +name: Continuous Integration + +on: + push: + paths-ignore: + - 'docs/**' + branches: + - v1.0 + pull_request: + paths-ignore: + - 'docs/**' + branches: + - v1.0 + +jobs: + rust-format: + name: Check Rust Code Format + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: Run cargo fmt + run: cargo fmt --check + + rust-build-and-test: + name: Build and Test Rust Project + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Install Dependencies + run: | + sudo apt update -y + sudo apt install -y libdbus-1-dev gnome-keyring libxcb1-dev + + - name: Start gnome-keyring + # run gnome-keyring with 'foobar' as password for the login keyring + # this will create a new login keyring and unlock it + # the login password doesn't matter, but the keyring must be unlocked for the tests to work + run: | + gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar' + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: Cache Cargo Registry + uses: actions/cache@v3 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache Cargo Index + uses: actions/cache@v3 + with: + path: ~/.cargo/index + key: ${{ runner.os }}-cargo-index + restore-keys: | + ${{ runner.os }}-cargo-index + + - name: Cache Cargo Build + uses: actions/cache@v3 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-build- + + - name: Install Ollama + run: curl -fsSL https://ollama.com/install.sh | sh + + - name: Start Ollama + run: | + # Run the background, in a way that survives to the next step + nohup ollama serve > ollama.log 2>&1 & + # Block using the ready endpoint + time curl --retry 5 --retry-connrefused --retry-delay 1 -sf http://localhost:11434 + + - name: Test Ollama Model + run: ollama run qwen2.5 hello || cat ollama.log + + - name: Build Rust Project + run: cargo build + + - name: Run Tests + run: cargo test --verbose + env: + OLLAMA_MODEL: "qwen2.5" + + ## TODO: Need to decide if we wanna error out on clippy warnings. It was not being used before. + # - name: Run Cargo Clippy (Lint) + # run: cargo clippy -- -D warnings + + desktop-lint: + name: Lint Electron Desktop App + runs-on: macos-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 'lts/*' + + - name: Install Dependencies + run: npm ci + working-directory: ui/desktop + + - name: Run Lint + run: npm run lint:check + working-directory: ui/desktop diff --git a/.github/workflows/desktop-app-release.yaml b/.github/workflows/desktop-app-release.yml similarity index 100% rename from .github/workflows/desktop-app-release.yaml rename to .github/workflows/desktop-app-release.yml