Skip to content

Commit 0a8808e

Browse files
ci: optimize GitHub Actions to reduce costs
- Remove cross-platform (macOS/Windows) matrix from CI test and build jobs - Keep tests/lint/docs running on ubuntu-only (release.yml still builds all platforms) - Remove redundant build job entirely from CI (release workflow handles real builds) - Add concurrency group to cancel superseded runs - Remove duplicate cargo registry cache (rust-cache already handles this) - Removes push trigger on master (only main needed) Estimated monthly savings: ~$18-20 (eliminates 10x-cost macOS and 2x-cost Windows CI runners) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b2af5bc commit 0a8808e

File tree

1 file changed

+10
-132
lines changed

1 file changed

+10
-132
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ name: CI
22

33
on:
44
push:
5-
branches: [main, master]
5+
branches: [main]
66
pull_request:
7-
branches: [main, master, dev]
7+
branches: [main, dev]
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
812

913
env:
1014
CARGO_TERM_COLOR: always
1115
RUST_BACKTRACE: 1
12-
# Faster compilation with incremental disabled for CI
1316
CARGO_INCREMENTAL: 0
1417

1518
jobs:
@@ -74,40 +77,17 @@ jobs:
7477
libx11-xcb-dev \
7578
libxml2-dev
7679
77-
- name: Cache Cargo registry
78-
uses: actions/cache@v4
79-
with:
80-
path: |
81-
~/.cargo/registry
82-
~/.cargo/git
83-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
84-
restore-keys: |
85-
${{ runner.os }}-cargo-registry-
86-
87-
- name: Cache Cargo build
88-
uses: actions/cache@v4
89-
with:
90-
path: target
91-
key: ${{ runner.os }}-cargo-build-lint-${{ hashFiles('**/Cargo.lock') }}
92-
restore-keys: |
93-
${{ runner.os }}-cargo-build-lint-
94-
9580
- name: Run Clippy
9681
run: cargo clippy --all-targets --all-features -- -D warnings
9782
continue-on-error: true
9883

9984
# ============================================
100-
# Test - Run on all platforms
85+
# Test - Linux only (cross-platform in release)
10186
# ============================================
10287
test:
103-
name: Test (${{ matrix.os }})
104-
runs-on: ${{ matrix.os }}
88+
name: Test
89+
runs-on: ubuntu-latest
10590
needs: format
106-
strategy:
107-
fail-fast: false
108-
matrix:
109-
os: [ubuntu-latest, windows-latest, macos-latest]
110-
11191
steps:
11292
- name: Checkout code
11393
uses: actions/checkout@v4
@@ -118,10 +98,9 @@ jobs:
11898
- name: Setup Rust cache
11999
uses: Swatinem/rust-cache@v2
120100
with:
121-
shared-key: "test-${{ matrix.os }}"
101+
shared-key: "test"
122102

123103
- name: Install Linux dependencies
124-
if: matrix.os == 'ubuntu-latest'
125104
run: |
126105
sudo apt-get update
127106
sudo apt-get install -y \
@@ -143,26 +122,6 @@ jobs:
143122
libx11-xcb-dev \
144123
libxml2-dev
145124
146-
- name: Cache vcpkg
147-
if: matrix.os == 'windows-latest'
148-
uses: actions/cache@v4
149-
with:
150-
path: C:\vcpkg
151-
key: ${{ runner.os }}-vcpkg-${{ hashFiles('.github/workflows/ci.yml') }}
152-
restore-keys: |
153-
${{ runner.os }}-vcpkg-
154-
155-
- name: Install Windows dependencies (vcpkg)
156-
if: matrix.os == 'windows-latest'
157-
run: |
158-
if (!(Test-Path C:\vcpkg)) {
159-
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
160-
C:\vcpkg\bootstrap-vcpkg.bat
161-
}
162-
C:\vcpkg\vcpkg install libxml2:x64-windows
163-
echo "VCPKG_ROOT=C:\vcpkg" >> $env:GITHUB_ENV
164-
echo "C:\vcpkg\installed\x64-windows\bin" >> $env:GITHUB_PATH
165-
166125
- name: Run cargo check
167126
run: cargo check --all-targets
168127

@@ -172,87 +131,6 @@ jobs:
172131
LD_LIBRARY_PATH: /usr/lib/x86_64-linux-gnu:${{ github.workspace }}/target/debug/build
173132
LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libxml2.so.2
174133

175-
# ============================================
176-
# Build - Verify release builds work
177-
# ============================================
178-
build:
179-
name: Build (${{ matrix.os }})
180-
runs-on: ${{ matrix.os }}
181-
needs: [lint, test]
182-
strategy:
183-
fail-fast: false
184-
matrix:
185-
os: [ubuntu-latest, windows-latest, macos-latest]
186-
187-
steps:
188-
- name: Checkout code
189-
uses: actions/checkout@v4
190-
191-
- name: Install Rust toolchain
192-
uses: dtolnay/rust-toolchain@stable
193-
194-
- name: Setup Rust cache
195-
uses: Swatinem/rust-cache@v2
196-
with:
197-
shared-key: "build-${{ matrix.os }}"
198-
199-
- name: Install Linux dependencies
200-
if: matrix.os == 'ubuntu-latest'
201-
run: |
202-
sudo apt-get update
203-
sudo apt-get install -y \
204-
libxcb-render0-dev \
205-
libxcb-shape0-dev \
206-
libxcb-xfixes0-dev \
207-
libxkbcommon-dev \
208-
libssl-dev \
209-
libgtk-3-dev \
210-
libglib2.0-dev \
211-
libatk1.0-dev \
212-
libcairo2-dev \
213-
libpango1.0-dev \
214-
libgdk-pixbuf2.0-dev \
215-
libwayland-dev \
216-
libxcb1-dev \
217-
libxcb-randr0-dev \
218-
libxcb-xkb-dev \
219-
libx11-xcb-dev \
220-
libxml2-dev
221-
222-
- name: Cache vcpkg
223-
if: matrix.os == 'windows-latest'
224-
uses: actions/cache@v4
225-
with:
226-
path: C:\vcpkg
227-
key: ${{ runner.os }}-vcpkg-${{ hashFiles('.github/workflows/ci.yml') }}
228-
restore-keys: |
229-
${{ runner.os }}-vcpkg-
230-
231-
- name: Install Windows dependencies (vcpkg)
232-
if: matrix.os == 'windows-latest'
233-
run: |
234-
if (!(Test-Path C:\vcpkg)) {
235-
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
236-
C:\vcpkg\bootstrap-vcpkg.bat
237-
}
238-
C:\vcpkg\vcpkg install libxml2:x64-windows
239-
echo "VCPKG_ROOT=C:\vcpkg" >> $env:GITHUB_ENV
240-
echo "C:\vcpkg\installed\x64-windows\bin" >> $env:GITHUB_PATH
241-
242-
- name: Build release binary
243-
run: cargo build --release
244-
245-
- name: Verify binary exists (Unix)
246-
if: matrix.os != 'windows-latest'
247-
run: |
248-
ls -la target/release/ultralog
249-
file target/release/ultralog
250-
251-
- name: Verify binary exists (Windows)
252-
if: matrix.os == 'windows-latest'
253-
run: |
254-
dir target\release\ultralog.exe
255-
256134
# ============================================
257135
# Documentation - Verify docs build
258136
# ============================================

0 commit comments

Comments
 (0)