3434 sudo rm -rf /private/var/run/finch-lima/*.sock || true
3535 sudo rm -rf /Applications/Finch/lima/data/finch/_cache || true
3636 # Clean up containers and images via Finch CLI
37- su ec2-user -c 'finch container prune -f' || true
38- su ec2-user -c 'finch image prune -a -f' || true
37+ su ec2-user -c 'finch system prune -f' || true
3938
4039 - name : Configure Git for ec2-user
4140 run : |
@@ -111,9 +110,44 @@ jobs:
111110 submodules : recursive
112111 path : finch-daemon-pr
113112
113+ - name : Configure Finch
114+ run : |
115+ echo "Original config:"
116+ su ec2-user -c 'cat ~/.finch/finch.yaml || echo "No config file found"'
117+ echo "Configuring Finch to use QEMU+VZ"
118+ su ec2-user -c 'yq eval ".vmType = \"vz\"" -i ~/.finch/finch.yaml'
119+ su ec2-user -c 'yq eval ".rosetta = false" -i ~/.finch/finch.yaml'
120+ echo "Updated config:"
121+ su ec2-user -c 'cat ~/.finch/finch.yaml'
122+
114123 - name : Build and setup Finch VM
115124 run : ./finch-daemon-pr/scripts/build-and-setup-finch-vm.sh
116125
126+ - name : Verify Finch socket
127+ run : |
128+ # Test socket connectivity
129+ if su ec2-user -c 'curl -s --unix-socket /Applications/Finch/lima/data/finch/sock/finch.sock http://localhost/version' > /dev/null; then
130+ echo "✓ Finch daemon is accessible"
131+ else
132+ echo "✗ Finch daemon connection failed"
133+ ls -la /Applications/Finch/lima/data/finch/sock/ || echo "Socket directory not found"
134+ exit 1
135+ fi
136+
137+ - name : Ensure Docker is not available (force Finch usage)
138+ run : |
139+ echo "Ensuring Docker is not accessible to force SAM CLI to use Finch..."
140+ # Remove docker binaries from PATH
141+ sudo rm -f /usr/local/bin/docker /opt/homebrew/bin/docker || true
142+ # Verify docker is not accessible
143+ if su ec2-user -c 'which docker' > /dev/null 2>&1; then
144+ echo "WARNING: Docker is still accessible"
145+ su ec2-user -c 'which docker'
146+ else
147+ echo "SUCCESS: Docker is not accessible - SAM CLI will use Finch"
148+ fi
149+ shell : bash
150+
117151 - name : Configure AWS credentials
118152 uses : aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
119153 with :
@@ -122,23 +156,19 @@ jobs:
122156 aws-region : ${{ secrets.REGION }}
123157 role-duration-seconds : 14400
124158
125- - name : Install Docker CLI for SAM CLI compatibility
159+ - name : Get latest SAM CLI tag
160+ id : sam-tag
126161 run : |
127- echo "Checking Docker CLI installation..."
128- if ! su ec2-user -c 'which docker' > /dev/null 2>&1; then
129- echo "Installing Docker CLI..."
130- su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install --formula docker'
131- else
132- echo "Docker CLI already installed"
133- fi
134- shell : bash
162+ TAG=$(curl -s https://api.github.com/repos/aws/aws-sam-cli/releases/latest | jq -r .tag_name)
163+ echo "tag=$TAG" >> $GITHUB_OUTPUT
135164
136165 - name : Checkout SAM CLI
137166 uses : actions/checkout@v4
138167 with :
139168 repository : aws/aws-sam-cli
140169 submodules : recursive
141170 path : aws-sam-cli
171+ ref : ${{ steps.sam-tag.outputs.tag }}
142172
143173 - name : Set up SAM CLI from source
144174 run : |
@@ -154,33 +184,26 @@ jobs:
154184 shell : bash
155185
156186 - name : Run unit tests
157- timeout-minutes : 30
158187 run : ./finch-daemon-pr/scripts/samcli-vm/run-unit-tests.sh
159188
160- - name : Patch SAM CLI for Docker image cleanup
161- run : |
162- # Apply patch to handle ImageNotFound exceptions for all Docker tests
163- su ec2-user -c 'cd /Users/ec2-user/aws-sam-cli && patch -p1 tests/integration/local/invoke/test_integrations_cli.py < ${{ github.workspace }}/finch-daemon-pr/scripts/samcli-vm/invoke-teardown.patch'
164- shell : bash
165-
166189 - name : Run invoke tests
167190 timeout-minutes : 40
168191 run : ./finch-daemon-pr/scripts/samcli-vm/run-invoke-tests.sh
169192
170193 - name : Run start-api tests
171- timeout-minutes : 70
194+ timeout-minutes : 60
172195 run : ./finch-daemon-pr/scripts/samcli-vm/run-start-api-tests.sh
173196
174197 - name : Run sync tests
175198 timeout-minutes : 20
176199 run : ./finch-daemon-pr/scripts/samcli-vm/run-sync-tests.sh
177200
178201 - name : Run package tests
179- timeout-minutes : 10
202+ timeout-minutes : 5
180203 run : ./finch-daemon-pr/scripts/samcli-vm/run-package-tests.sh
181204
182205 - name : Run start-lambda tests
183- timeout-minutes : 30
206+ timeout-minutes : 20
184207 run : ./finch-daemon-pr/scripts/samcli-vm/run-start-lambda-tests.sh
185208
186209 # ensuring resources are clean post-test
0 commit comments