Files
goose/.github/workflows/ci.yml

169 lines
4.5 KiB
YAML

on:
push:
paths-ignore:
- "documentation/**"
branches:
- main
pull_request:
paths-ignore:
- "documentation/**"
branches:
- main
workflow_dispatch:
name: CI
jobs:
rust-format:
name: Check Rust Code Format
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- 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@v4
- name: Install Dependencies
run: |
sudo apt update -y
sudo apt install -y libdbus-1-dev gnome-keyring libxcb1-dev
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- 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-
# Add disk space cleanup before linting
- name: Check disk space before build
run: df -h
- name: Aggressive pre-build cleanup
run: |
# Clean package manager caches
sudo apt-get clean
sudo apt-get autoremove -y
sudo rm -rf /opt/hostedtoolcache
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /opt/hostedtoolcache/
sudo rm -rf /usr/local/lib/android/sdk/ndk
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
rm -rf target/debug/deps
rm -rf target/debug/incremental
# Clean up unused swap and memory
sudo swapoff -a
sudo swapon -a
echo "Disk space after aggressive cleanup:"
df -h
- name: Build and Test
run: |
gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar'
cargo test
working-directory: crates
- name: Lint
run: cargo clippy -- -D warnings
# Add disk space cleanup before linting
- name: Check disk space before cleanup
run: df -h
- name: Clean up disk space after build
run: |
echo "Cleaning up disk space after build..."
# Remove debug artifacts that are no longer needed after tests
rm -rf target/debug/deps || true
rm -rf target/debug/build || true
rm -rf target/debug/incremental || true
# Clean Cargo cache
rm -rf ~/.cargo/registry/src || true
rm -rf ~/.cargo/registry/index || true
rm -rf ~/.cargo/git/checkouts || true
rm -rf ~/.cargo/git/db || true
# Clean package manager caches
npm cache clean --force || true
sudo apt-get clean
sudo apt-get autoremove -y
# Remove Docker images if any
docker system prune -af || true
# Remove temp files
sudo rm -rf /tmp/* || true
# Check disk space after all cleanup
echo "Final disk space:"
df -h
desktop-lint:
name: Lint Electron Desktop App
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- 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
# Faster Desktop App build for PRs only
bundle-desktop-unsigned:
uses: ./.github/workflows/bundle-desktop.yml
if: github.event_name == 'pull_request'
with:
signing: false