Skip to content

Commit 0431e24

Browse files
authored
Merge pull request #1889 from lightninglabs/wip/speed-ci
GitHub CI: modularize LiT setup, add reusable cleanup action, and adopt matrix builds
2 parents ff43bc7 + f8eaad6 commit 0431e24

File tree

3 files changed

+131
-106
lines changed

3 files changed

+131
-106
lines changed

.github/actions/cleanup-space/action.yaml

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,46 @@ runs:
77
- name: Free up disk space
88
shell: bash
99
run: |
10+
set -euo pipefail
11+
1012
echo "Removing large toolsets to free up disk space..."
1113
echo "Disk space before cleanup:"
12-
df -h
13-
14-
# Remove dotnet to save disk space.
15-
sudo rm -rf /usr/share/dotnet
16-
# Remove android to save disk space.
17-
sudo rm -rf /usr/local/lib/android
18-
# Remove ghc to save disk space.
19-
sudo rm -rf /opt/ghc
20-
# Remove large packages.
21-
sudo rm -rf /usr/share/swift
22-
sudo rm -rf /usr/local/julia*
23-
sudo rm -rf /opt/hostedtoolcache
14+
df -h || true
15+
16+
shopt -s nullglob
17+
18+
remove_path() {
19+
local path="$1"
20+
if [ -e "$path" ] || [ -L "$path" ]; then
21+
echo "Removing $path"
22+
sudo rm -rf "$path"
23+
fi
24+
}
25+
26+
# Remove large toolsets and caches.
27+
remove_path /usr/share/dotnet
28+
remove_path /usr/local/lib/android
29+
remove_path /opt/ghc
30+
remove_path /usr/share/swift
31+
for path in /usr/local/julia*; do remove_path "$path"; done
32+
remove_path /opt/hostedtoolcache
33+
34+
# Remove caches.
35+
remove_path /usr/local/share/boost
36+
if [ -n "${AGENT_TOOLSDIRECTORY:-}" ]; then
37+
remove_path "$AGENT_TOOLSDIRECTORY"
38+
fi
2439
2540
# Remove docker images to save space.
26-
docker image prune -a -f || true
41+
if command -v docker >/dev/null 2>&1; then
42+
docker image prune -a -f || true
43+
else
44+
echo "Docker not available; skipping image prune."
45+
fi
2746
28-
# Remove large apt packages.
29-
sudo apt-get remove -y \
47+
# Remove large apt packages when available.
48+
if command -v apt-get >/dev/null 2>&1; then
49+
sudo apt-get remove -y \
3050
'^aspnetcore-.*' \
3151
'^dotnet-.*' \
3252
'^llvm-.*' \
@@ -39,12 +59,11 @@ runs:
3959
powershell \
4060
mono-devel \
4161
libgl1-mesa-dri 2>/dev/null || true
42-
sudo apt-get autoremove -y
43-
sudo apt-get clean
44-
45-
# Remove caches.
46-
sudo rm -rf /usr/local/share/boost
47-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
62+
sudo apt-get autoremove -y || true
63+
sudo apt-get clean || true
64+
else
65+
echo "apt-get not available; skipping package removals."
66+
fi
4867
4968
echo "Disk space after cleanup:"
50-
df -h
69+
df -h || true
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: LiT setup
2+
description: Prepare LiT workspace with Taproot-Assets replaces, caches, and dependencies
3+
runs:
4+
using: composite
5+
steps:
6+
- name: setup go
7+
uses: actions/setup-go@v5
8+
with:
9+
go-version: '~${{ env.GO_VERSION }}'
10+
cache: true
11+
cache-dependency-path: |
12+
lightning-terminal/go.sum
13+
go.sum
14+
15+
- name: Clone LiT repository
16+
uses: actions/checkout@v5
17+
with:
18+
repository: lightninglabs/lightning-terminal
19+
ref: ${{ env.LITD_BRANCH }}
20+
path: lightning-terminal
21+
22+
- name: Update go.mod to use the local repository
23+
working-directory: ./lightning-terminal
24+
run: |
25+
go mod edit -replace=github.com/lightninglabs/taproot-assets=../
26+
go mod edit -replace=github.com/lightninglabs/taproot-assets/taprpc=../taprpc
27+
go mod tidy
28+
shell: bash
29+
30+
- name: Setup Node.js and cache Yarn dependencies
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '20.x'
34+
cache: 'yarn'
35+
cache-dependency-path: lightning-terminal/app/yarn.lock
36+
37+
- name: Install LiT app dependencies
38+
working-directory: ./lightning-terminal/app
39+
run: yarn
40+
shell: bash

.github/workflows/main.yaml

Lines changed: 50 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@ defaults:
1616
shell: bash
1717

1818
env:
19-
# go needs absolute directories, using the $HOME variable doesn't work here.
19+
# Go needs absolute directories; using the $HOME variable doesn't work here.
2020
GOPATH: /home/runner/work/go
2121

2222
GO_VERSION: '1.24.9'
23-
24-
LITD_ITEST_BRANCH: 'master'
23+
24+
LITD_BRANCH: 'master'
2525

2626
jobs:
27-
#######################
28-
# sql model generation
29-
#######################
27+
# Validate generated SQL models stay in sync with queries.
3028
sqlc-check:
3129
name: Sqlc check
3230
runs-on: ubuntu-latest
@@ -46,6 +44,7 @@ jobs:
4644
- name: Generate sql models
4745
run: make sqlc-check
4846

47+
# Rebuild RPC stubs and REST annotations to detect drift.
4948
rpc-check:
5049
name: RPC check
5150
runs-on: ubuntu-latest
@@ -61,6 +60,7 @@ jobs:
6160
- name: Generate RPC stubs and check REST annotations
6261
run: make rpc-check
6362

63+
# Ensure go.mod and go.sum remain tidy.
6464
mod-check:
6565
name: go mod check
6666
runs-on: ubuntu-latest
@@ -76,6 +76,7 @@ jobs:
7676
- name: Run go mod tidy
7777
run: make mod-check
7878

79+
# Confirm deterministic test vectors are up to date.
7980
test-vector-check:
8081
name: test vector check
8182
runs-on: ubuntu-latest
@@ -91,6 +92,7 @@ jobs:
9192
- name: Run test vector creation check
9293
run: make test-vector-check
9394

95+
# Verify database migration numbering and versions.
9496
migration-check:
9597
name: migration version check
9698
runs-on: ubuntu-latest
@@ -101,9 +103,7 @@ jobs:
101103
- name: Run migration check
102104
run: make migration-check
103105

104-
########################
105-
# Compilation check.
106-
########################
106+
# Build the codebase and docs examples to catch compilation regressions.
107107
compile-check:
108108
name: Compilation check
109109
runs-on: ubuntu-latest
@@ -122,9 +122,7 @@ jobs:
122122
- name: Compile docs examples
123123
run: make build-docs-examples
124124

125-
########################
126-
# sample configuration check
127-
########################
125+
# Guard sample-tapd.conf defaults against accidental drift.
128126
sample-conf-check:
129127
name: sample configuration check
130128
runs-on: ubuntu-latest
@@ -140,9 +138,7 @@ jobs:
140138
- name: check default values in sample-tapd.conf file
141139
run: make sample-conf-check
142140

143-
########################
144-
# Docker build check.
145-
########################
141+
# Smoke test Docker builds for default and dev images.
146142
docker-build-check:
147143
name: Docker build check
148144
runs-on: ubuntu-latest
@@ -167,12 +163,22 @@ jobs:
167163
file: dev.Dockerfile
168164
tags: 'dev-taproot-assets'
169165

170-
########################
171-
# cross compilation
172-
########################
166+
# Cross-compile release binaries across supported targets.
173167
cross-compile:
174168
name: cross compilation
175169
runs-on: ubuntu-latest
170+
strategy:
171+
fail-fast: false
172+
matrix:
173+
sys:
174+
- darwin-amd64
175+
- darwin-arm64
176+
- linux-386
177+
- linux-amd64
178+
- linux-armv6
179+
- linux-armv7
180+
- linux-arm64
181+
- windows-amd64
176182
steps:
177183
- name: git checkout
178184
uses: actions/checkout@v5
@@ -185,12 +191,10 @@ jobs:
185191
with:
186192
go-version: '${{ env.GO_VERSION }}'
187193

188-
- name: build release for all architectures
189-
run: make release
194+
- name: Build release for ${{ matrix.sys }}
195+
run: make release sys=${{ matrix.sys }}
190196

191-
########################
192-
# Lint check.
193-
########################
197+
# Run the lint suite for static analysis coverage.
194198
lint-check:
195199
name: Lint check
196200
runs-on: ubuntu-latest
@@ -208,9 +212,7 @@ jobs:
208212
- name: run lint
209213
run: make lint
210214

211-
########################
212-
# Format check.
213-
########################
215+
# Enforce formatting consistency.
214216
format-check:
215217
name: Format check
216218
runs-on: ubuntu-latest
@@ -226,9 +228,7 @@ jobs:
226228
- name: run format
227229
run: make fmt
228230

229-
########################
230-
# check PR updates release notes
231-
########################
231+
# Ensure pull requests update release notes unless explicitly skipped.
232232
milestone-check:
233233
name: Check release notes updated
234234
runs-on: ubuntu-latest
@@ -240,9 +240,7 @@ jobs:
240240
- name: Release notes check
241241
run: scripts/check-release-notes.sh
242242

243-
########################
244-
# run unit tests
245-
########################
243+
# Unit tests with race detection, coverage, and Postgres backend variants.
246244
unit-test:
247245
name: run unit tests
248246
runs-on: ubuntu-latest
@@ -263,7 +261,7 @@ jobs:
263261
with:
264262
go-version: '${{ env.GO_VERSION }}'
265263

266-
- name: run ${{ matrix.unit_type }}
264+
- name: Run ${{ matrix.unit_type }}
267265
run: make ${{ matrix.unit_type }}
268266

269267
- name: Send coverage
@@ -276,9 +274,7 @@ jobs:
276274
format: 'golang'
277275
parallel: true
278276

279-
########################
280-
# run integration tests
281-
########################
277+
# Integration tests on SQLite backend.
282278
integration-test:
283279
name: run itests
284280
runs-on: ubuntu-latest
@@ -319,9 +315,7 @@ jobs:
319315
format: 'golang'
320316
parallel: true
321317

322-
########################
323-
# run integration tests with Postgres backend
324-
########################
318+
# Integration tests on Postgres backend.
325319
integration-test-postgres:
326320
name: run itests postgres
327321
runs-on: ubuntu-latest
@@ -362,60 +356,32 @@ jobs:
362356
format: 'golang'
363357
parallel: true
364358

365-
########################
366-
# Run LiTd tests
367-
########################
368-
run-lit-tests:
369-
name: run LiT tests
359+
# LiT integration/unit tests with Taproot Assets replacements.
360+
run-lit:
361+
name: run LiT ${{ matrix.task_name }}
370362
runs-on: ubuntu-latest
363+
continue-on-error: true
364+
strategy:
365+
fail-fast: false
366+
matrix:
367+
include:
368+
- task_name: itests (custom_channels)
369+
run_cmd: make itest icase=custom_channels
370+
- task_name: unit
371+
run_cmd: make unit
371372

372373
steps:
373374
- name: git checkout
374-
uses: actions/checkout@v5
375-
376-
- name: Clean up runner space
377-
uses: ./.github/actions/cleanup-space
378-
379-
- name: Setup go ${{ env.GO_VERSION }}
380-
uses: actions/setup-go@v5
381-
with:
382-
go-version: '${{ env.GO_VERSION }}'
383-
384-
- name: Clone Lit repository
385375
uses: actions/checkout@v4
386-
with:
387-
repository: lightninglabs/lightning-terminal
388-
ref: ${{ env.LITD_ITEST_BRANCH }}
389-
path: lightning-terminal
390-
391-
- name: Update go.mod to use the local Tap repository
392-
working-directory: ./lightning-terminal
393-
run: |
394-
go mod edit -replace=github.com/lightninglabs/taproot-assets=../
395-
go mod edit -replace=github.com/lightninglabs/taproot-assets/taprpc=../taprpc
396-
go mod tidy
397-
398-
- name: Install yarn
399-
run: npm install -g yarn
400-
401-
- name: setup nodejs
402-
uses: ./lightning-terminal/.github/actions/setup-node
403-
with:
404-
node-version: 16.x
405-
406-
- name: install LiT app dependencies
407-
working-directory: ./lightning-terminal/app
408-
run: yarn
409376

410-
- name: Run LiT itests
411-
working-directory: ./lightning-terminal
412-
run: make itest icase=custom_channels
377+
- name: Prepare LiT workspace
378+
uses: ./.github/actions/lit-setup
413379

414-
- name: Run LiT unit tests
380+
- name: Run LiT ${{ matrix.task_name }}
415381
working-directory: ./lightning-terminal
416-
run: make unit
382+
run: ${{ matrix.run_cmd }}
417383

418-
# Notify about the completion of all coverage collecting jobs.
384+
# Finalize Coveralls reporting after parallel coverage jobs.
419385
finish:
420386
if: ${{ always() }}
421387
needs: [ unit-test ]

0 commit comments

Comments
 (0)