Skip to content

Commit 31cc28b

Browse files
authored
[workflow] Build once and run tests against multiple Kubo versions (#272)
* Replace IPFS installation script with Docker Compose action * Turn Kubo's telemetry off * Parameterize Kubo's Docker image tag * Run matrix build against multiple Kubo versions * Store Kubo's logs for troubleshooting * Format Docker Compose file with Spotless * Build project only once and run multiple tests without compilation * Install Docker Compose explicitly
1 parent 597b206 commit 31cc28b

3 files changed

Lines changed: 56 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,39 @@ on:
1010

1111
jobs:
1212
build:
13+
runs-on: ubuntu-latest
14+
name: Build w/o tests
15+
steps:
16+
- uses: actions/checkout@v6
17+
- name: Set up JDK 21
18+
uses: actions/setup-java@v5
19+
with:
20+
distribution: temurin
21+
java-version: 21
22+
cache: 'maven'
23+
- name: Build with Maven
24+
run: ./mvnw -V -DskipTests --no-transfer-progress package
25+
- name: Upload artifacts
26+
uses: actions/upload-artifact@v6
27+
with:
28+
name: maven-build-artifacts
29+
path: target/
30+
retention-days: 1
1331

32+
test:
33+
needs: build
1434
runs-on: ubuntu-latest
1535

36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
kubo: # https://github.com/ipfs/kubo#docker
40+
- v0.39.0 # specific release tag
41+
- release # latest stable release
42+
- master-latest # developer preview, HEAD of master branch
43+
44+
name: Test with Kubo tag ${{matrix.kubo}}
45+
1646
steps:
1747
- uses: actions/checkout@v6
1848
- name: Set up JDK 21
@@ -21,7 +51,22 @@ jobs:
2151
distribution: temurin
2252
java-version: 21
2353
cache: 'maven'
24-
- name: Install and run IPFS
25-
run: ./install-run-ipfs.sh
54+
- name: Download compiled artifacts
55+
uses: actions/download-artifact@v5
56+
with:
57+
name: maven-build-artifacts
58+
path: target/
59+
- name: Set up Docker Compose
60+
run: sudo apt-get install docker-compose
61+
- name: Run Kubo ${{matrix.kubo}} IPFS daemon
62+
env:
63+
KUBO_TAG: ${{matrix.kubo}}
64+
run: docker compose up -d
2665
- name: Build & run tests with Maven
27-
run: ./mvnw -V verify
66+
run: ./mvnw -V --no-transfer-progress -Dmaven.compiler.skip=true verify
67+
- name: Kubo logs
68+
if: ${{always()}}
69+
run: docker compose logs
70+
- name: Shut down Docker Compose
71+
if: always()
72+
run: docker compose down

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
version: '2'
21
services:
32
ipfs-daemon:
4-
image: 'ipfs/kubo:v0.39.0'
3+
image: ipfs/kubo:${KUBO_TAG-release} # default is latest release, see https://github.com/ipfs/kubo#docker
4+
environment:
5+
IPFS_TELEMETRY: off
56
ports:
67
- "4001:4001"
78
- "5001:5001"

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@
107107
<quiet>true</quiet>
108108
</sortPom>
109109
</pom>
110+
<yaml>
111+
<includes>
112+
<include>docker-compose.yml</include>
113+
</includes>
114+
</yaml>
110115
<upToDateChecking>
111116
<enabled>true</enabled>
112117
</upToDateChecking>

0 commit comments

Comments
 (0)