|
8 | 8 | CARGO_TERM_COLOR: always |
9 | 9 |
|
10 | 10 | jobs: |
11 | | - check: |
| 11 | + rust-lint: |
| 12 | + name: Rust Lint |
12 | 13 | runs-on: ubuntu-latest |
13 | 14 | timeout-minutes: 30 |
| 15 | + permissions: |
| 16 | + contents: read |
14 | 17 | steps: |
15 | 18 | - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
16 | | - - uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable |
| 19 | + - uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1 |
| 20 | + - uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2 |
| 21 | + - name: Format check |
| 22 | + run: just fmt-check |
| 23 | + - name: Clippy |
| 24 | + run: just clippy |
| 25 | + |
| 26 | + unit-tests: |
| 27 | + name: Unit Tests |
| 28 | + runs-on: ubuntu-latest |
| 29 | + timeout-minutes: 30 |
| 30 | + permissions: |
| 31 | + contents: read |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 34 | + - uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1 |
| 35 | + - uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2 |
| 36 | + - name: Unit tests |
| 37 | + run: just test-unit |
| 38 | + |
| 39 | + desktop: |
| 40 | + name: Desktop |
| 41 | + runs-on: ubuntu-latest |
| 42 | + timeout-minutes: 45 |
| 43 | + permissions: |
| 44 | + contents: read |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 47 | + - uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1 |
| 48 | + - uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2 |
17 | 49 | with: |
18 | | - components: rustfmt, clippy |
| 50 | + workspaces: desktop/src-tauri |
| 51 | + - name: Install Tauri dependencies (Linux) |
| 52 | + env: |
| 53 | + DEBIAN_FRONTEND: noninteractive |
| 54 | + run: | |
| 55 | + sudo apt-get update \ |
| 56 | + -o Acquire::Retries=3 \ |
| 57 | + -o Acquire::http::Timeout=30 \ |
| 58 | + -o Acquire::https::Timeout=30 |
| 59 | + sudo apt-get install -y --no-install-recommends \ |
| 60 | + -o Acquire::Retries=3 \ |
| 61 | + -o Acquire::http::Timeout=30 \ |
| 62 | + -o Acquire::https::Timeout=30 \ |
| 63 | + -o DPkg::Lock::Timeout=120 \ |
| 64 | + build-essential \ |
| 65 | + curl \ |
| 66 | + file \ |
| 67 | + libayatana-appindicator3-dev \ |
| 68 | + libgtk-3-dev \ |
| 69 | + librsvg2-dev \ |
| 70 | + libssl-dev \ |
| 71 | + libwebkit2gtk-4.1-dev \ |
| 72 | + libxdo-dev \ |
| 73 | + patchelf \ |
| 74 | + wget |
| 75 | + - name: Install desktop dependencies |
| 76 | + run: just desktop-install-ci |
| 77 | + - name: Install Playwright Chromium |
| 78 | + run: cd desktop && pnpm exec playwright install --with-deps chromium |
| 79 | + - name: Desktop lint and format |
| 80 | + run: just desktop-check |
| 81 | + - name: Desktop build |
| 82 | + run: just desktop-build |
| 83 | + - name: Desktop smoke e2e |
| 84 | + run: cd desktop && pnpm exec playwright test --project=smoke |
| 85 | + - name: Desktop Tauri check |
| 86 | + run: just desktop-tauri-check |
| 87 | + - name: Upload desktop e2e artifacts |
| 88 | + if: failure() |
| 89 | + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 |
| 90 | + with: |
| 91 | + name: desktop-e2e-artifacts |
| 92 | + path: | |
| 93 | + desktop/playwright-report |
| 94 | + desktop/test-results |
| 95 | + if-no-files-found: ignore |
| 96 | + |
| 97 | + desktop-e2e-integration: |
| 98 | + name: Desktop E2E Integration |
| 99 | + runs-on: ubuntu-latest |
| 100 | + timeout-minutes: 45 |
| 101 | + permissions: |
| 102 | + contents: read |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 105 | + - uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1 |
19 | 106 | - uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2 |
20 | | - - run: cargo fmt --all -- --check |
21 | | - - run: cargo clippy --workspace --all-targets -- -D warnings |
22 | | - - run: cargo test --workspace |
23 | | - - run: cargo install cargo-audit --locked |
24 | | - - run: cargo audit --ignore RUSTSEC-2023-0071 --ignore RUSTSEC-2024-0384 |
25 | | - - run: cargo install cargo-deny --locked |
26 | | - - run: cargo deny check |
| 107 | + with: |
| 108 | + workspaces: desktop/src-tauri |
| 109 | + - name: Install desktop dependencies |
| 110 | + run: just desktop-install-ci |
| 111 | + - name: Install Playwright Chromium |
| 112 | + run: cd desktop && pnpm exec playwright install --with-deps chromium |
| 113 | + - name: Desktop build |
| 114 | + run: just desktop-build |
| 115 | + - name: Start integration services |
| 116 | + run: docker compose up -d |
| 117 | + - name: Wait for integration services |
| 118 | + run: | |
| 119 | + wait_healthy() { |
| 120 | + local service="$1" |
| 121 | + local container="$2" |
| 122 | + for attempt in $(seq 1 60); do |
| 123 | + status=$(docker inspect --format='{{.State.Health.Status}}' "${container}" 2>/dev/null || echo "not_found") |
| 124 | + if [ "${status}" = "healthy" ]; then |
| 125 | + echo "${service} is healthy" |
| 126 | + return 0 |
| 127 | + fi |
| 128 | + sleep 2 |
| 129 | + done |
| 130 | + docker logs "${container}" || true |
| 131 | + return 1 |
| 132 | + } |
| 133 | + wait_healthy "MySQL" "sprout-mysql" |
| 134 | + wait_healthy "Redis" "sprout-redis" |
| 135 | + wait_healthy "Typesense" "sprout-typesense" |
| 136 | + - name: Build relay |
| 137 | + run: cargo build -p sprout-relay |
| 138 | + - name: Start relay |
| 139 | + run: | |
| 140 | + nohup env \ |
| 141 | + DATABASE_URL=mysql://sprout:sprout_dev@localhost:3306/sprout \ |
| 142 | + REDIS_URL=redis://localhost:6379 \ |
| 143 | + TYPESENSE_URL=http://localhost:8108 \ |
| 144 | + TYPESENSE_API_KEY=sprout_dev_key \ |
| 145 | + RELAY_URL=ws://localhost:3000 \ |
| 146 | + SPROUT_BIND_ADDR=0.0.0.0:3000 \ |
| 147 | + SPROUT_REQUIRE_AUTH_TOKEN=false \ |
| 148 | + ./target/debug/sprout-relay > /tmp/sprout-relay.log 2>&1 & |
| 149 | + echo $! > /tmp/sprout-relay.pid |
| 150 | + for attempt in $(seq 1 60); do |
| 151 | + if ! kill -0 "$(cat /tmp/sprout-relay.pid)" 2>/dev/null; then |
| 152 | + cat /tmp/sprout-relay.log |
| 153 | + exit 1 |
| 154 | + fi |
| 155 | + status_code=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:3000/api/channels || true) |
| 156 | + if [ "${status_code}" != "000" ]; then |
| 157 | + exit 0 |
| 158 | + fi |
| 159 | + sleep 1 |
| 160 | + done |
| 161 | + cat /tmp/sprout-relay.log |
| 162 | + exit 1 |
| 163 | + - name: Seed desktop e2e data |
| 164 | + run: bash scripts/setup-desktop-test-data.sh |
| 165 | + - name: Desktop relay-backed e2e |
| 166 | + run: cd desktop && pnpm exec playwright test --project=integration |
| 167 | + - name: Upload desktop integration artifacts |
| 168 | + if: failure() |
| 169 | + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 |
| 170 | + with: |
| 171 | + name: desktop-e2e-integration-artifacts |
| 172 | + path: | |
| 173 | + desktop/playwright-report |
| 174 | + desktop/test-results |
| 175 | + /tmp/sprout-relay.log |
| 176 | + if-no-files-found: ignore |
| 177 | + |
| 178 | + security: |
| 179 | + name: Security |
| 180 | + runs-on: ubuntu-latest |
| 181 | + timeout-minutes: 20 |
| 182 | + permissions: |
| 183 | + contents: read |
| 184 | + steps: |
| 185 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 186 | + - uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1 |
| 187 | + - name: Dependency policy |
| 188 | + run: cargo-deny check |
0 commit comments