Skip to content

Commit 7a8a479

Browse files
authored
ci(distroless): Fix tests (#352)
Fix tests for distroless containers which were always testing the same dart/flutter version.
1 parent 38f24b1 commit 7a8a479

File tree

5 files changed

+32
-24
lines changed

5 files changed

+32
-24
lines changed

.github/workflows/distroless_dart.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ jobs:
5959
- name: Git Checkout
6060
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
6161

62-
- name: Setup Flutter
63-
uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 # 2.19.0
64-
with:
65-
channel: stable
66-
cache: true
67-
6862
# Set up QEMU for multi-platform builds (needed for ARM on x86 runners)
6963
- name: Set up QEMU
7064
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # 3.6.0
@@ -144,8 +138,15 @@ jobs:
144138
cache-from: type=gha # Pull cache from GitHub Actions cache
145139
cache-to: type=gha,mode=max # Push cache to GitHub Actions cache (mode=max includes all layers)
146140

141+
- name: Setup Dart
142+
uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c # 1.7.1
143+
with:
144+
sdk: ${{ matrix.sdk.version }}
145+
147146
- name: Test Container
148147
working-directory: apps/distroless/dart/test
148+
env:
149+
DART_VERSION: ${{ matrix.sdk.version }}
149150
run: |
150151
dart pub get
151152
./test-docker.sh

.github/workflows/distroless_flutter.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ jobs:
6363
- name: Git Checkout
6464
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
6565

66-
- name: Setup Flutter
67-
uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 # 2.19.0
68-
with:
69-
channel: stable
70-
cache: true
71-
7266
# Set up Docker Buildx, the builder engine for multi-platform builds
7367
- name: Set up Docker Buildx
7468
id: buildx
@@ -166,8 +160,16 @@ jobs:
166160
cache-from: type=gha # Pull cache from GitHub Actions cache
167161
cache-to: type=gha,mode=max # Push cache to GitHub Actions cache (mode=max includes all layers)
168162

163+
- name: Setup Flutter
164+
uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 # 2.19.0
165+
with:
166+
channel: ${{ matrix.sdk.channel }}
167+
flutter-version: ${{ matrix.sdk.version }}
168+
169169
- name: Test Container
170170
working-directory: apps/distroless/flutter/test
171+
env:
172+
FLUTTER_VERSION: ${{ matrix.sdk.version }}
171173
run: |
172174
dart pub get
173175
./test-docker.sh

apps/cli/fixtures/fixtures_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ class TestRunner {
160160
exe: Platform.resolvedExecutable,
161161
action: PubAction.upgrade,
162162
workingDirectory: projectRoot,
163+
//
163164
// verbose: Platform.environment.containsKey('CI'),
164165
verbose: false,
165166
).timeout(const Duration(seconds: 30));

apps/distroless/dart/test/test-docker.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@
33
set -e
44

55
if [ -n "$FLUTTER_ROOT" ]; then
6-
DART_SDK="$FLUTTER_ROOT/bin/cache/dart-sdk"
6+
DART_HOME="$FLUTTER_ROOT/bin/cache/dart-sdk"
77
fi
8-
if [ -z "$DART_SDK" ]; then
9-
echo "DART_SDK is not set"
8+
if [ -z "$DART_HOME" ]; then
9+
echo "DART_HOME is not set"
1010
exit 1
1111
fi
1212
if [ -z "$DART_VERSION" ]; then
13-
DART_VERSION=$(cat $DART_SDK/version)
13+
DART_VERSION=$(cat $DART_HOME/version)
1414
fi
1515

16-
DART="$DART_SDK/bin/dartaotruntime"
17-
FE_SNAPSHOT="$DART_SDK/bin/snapshots/frontend_server_aot.dart.snapshot"
18-
VM_PLATFORM="$DART_SDK/lib/_internal/vm_platform_strong_product.dill"
16+
echo "DART_HOME: $DART_HOME"
17+
echo "DART_VERSION: $DART_VERSION"
18+
19+
DART="$DART_HOME/bin/dartaotruntime"
20+
FE_SNAPSHOT="$DART_HOME/bin/snapshots/frontend_server_aot.dart.snapshot"
21+
VM_PLATFORM="$DART_HOME/lib/_internal/vm_platform_strong_product.dill"
1922

2023
SCRIPT_DIR=$(cd $(dirname $0); pwd)
2124

@@ -26,7 +29,7 @@ trap "cd $SCRIPT_DIR" EXIT
2629
OUT_DIR=$SCRIPT_DIR/out
2730

2831
$DART $FE_SNAPSHOT \
29-
--sdk-root $DART_SDK \
32+
--sdk-root $DART_HOME \
3033
--platform $VM_PLATFORM \
3134
--aot \
3235
--tfa \

apps/distroless/flutter/test/test-docker.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ set -e
44

55
if [ -n "$FLUTTER_ROOT" ]; then
66
FLUTTER_SDK="$FLUTTER_ROOT"
7-
FLUTTER_VERSION=$(cat $FLUTTER_SDK/version)
87
fi
98
if [ -z "$FLUTTER_VERSION" ]; then
10-
echo "FLUTTER_VERSION is not set"
11-
echo "Defaulting to 3.29.3"
12-
FLUTTER_VERSION=3.29.3
9+
FLUTTER_VERSION=$(cat $FLUTTER_SDK/version)
1310
fi
1411

12+
echo "FLUTTER_SDK: $FLUTTER_SDK"
13+
echo "FLUTTER_VERSION: $FLUTTER_VERSION"
14+
1515
SCRIPT_DIR=$(cd $(dirname $0); pwd)
1616

17+
rm -rf out/release
1718
mkdir -p out/release
1819
cd out/release
1920
trap "cd $SCRIPT_DIR" EXIT

0 commit comments

Comments
 (0)