|
28 | 28 | - name: Clean macOS runner workspace |
29 | 29 | run: | |
30 | 30 | rm -rf ${{ github.workspace }}/* |
| 31 | + # Clean up any leftover Finch VM state |
| 32 | + su ec2-user -c 'finch vm remove -f' || true |
| 33 | + sudo pkill -f socket_vmnet || true |
| 34 | + sudo rm -rf /private/var/run/finch-lima/*.sock || true |
| 35 | + sudo rm -rf /Applications/Finch/lima/data/finch/_cache || true |
| 36 | + # 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 |
31 | 39 |
|
32 | 40 | - name: Configure Git for ec2-user |
33 | 41 | run: | |
@@ -85,49 +93,26 @@ jobs: |
85 | 93 | su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install lz4 automake autoconf libtool yq' |
86 | 94 | shell: bash |
87 | 95 |
|
88 | | - - name: Checkout finch-daemon repo |
89 | | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 96 | + - name: Checkout mainline finch repo |
| 97 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
90 | 98 | with: |
| 99 | + ref: main |
| 100 | + repository: runfinch/finch |
91 | 101 | fetch-depth: 0 |
92 | 102 | persist-credentials: false |
93 | 103 | submodules: recursive |
94 | 104 |
|
95 | | - - name: Configure workspace for ec2-user |
96 | | - run: | |
97 | | - chown -R ec2-user:staff ${{ github.workspace }} |
98 | | -
|
99 | | - - name: Install Finch |
100 | | - run: | |
101 | | - echo "Installing Finch as ec2-user..." |
102 | | - su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install finch --cask' |
103 | | - su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep finch || echo "finch not installed"' |
104 | | - mkdir -p /private/var/run/finch-lima |
105 | | - cat /etc/passwd |
106 | | - chown ec2-user:daemon /private/var/run/finch-lima |
107 | | - shell: bash |
108 | | - |
109 | | - - name: Build binaries |
110 | | - run: | |
111 | | - echo "Building cross architecture binaries..." |
112 | | - su ec2-user -c 'cd ${{ github.workspace }} && STATIC=1 GOPROXY=direct GOOS=linux GOARCH=arm64 make' |
113 | | - su ec2-user -c 'finch vm remove -f' || true |
114 | | - cp -f ${{ github.workspace }}/bin/finch-daemon /Applications/Finch/finch-daemon/finch-daemon |
115 | | - # Restart finch-daemon with new binary |
116 | | - su ec2-user -c 'finch vm stop' || true |
117 | | - su ec2-user -c 'finch vm start' || true |
118 | | - shell: bash |
| 105 | + - name: Checkout finch-daemon PR |
| 106 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 107 | + with: |
| 108 | + ref: ${{ github.head_ref }} |
| 109 | + fetch-depth: 0 |
| 110 | + persist-credentials: false |
| 111 | + submodules: recursive |
| 112 | + path: finch-daemon-pr |
119 | 113 |
|
120 | | - - name: Check Finch version |
121 | | - run: | |
122 | | - echo "Initializing VM and checking version..." |
123 | | - # Clean up any leftover network state |
124 | | - sudo pkill -f socket_vmnet || true |
125 | | - sudo rm -f /private/var/run/finch-lima/*.sock || true |
126 | | - su ec2-user -c 'finch vm init' |
127 | | - sleep 5 # Wait for services to be ready |
128 | | - echo "Checking Finch version..." |
129 | | - su ec2-user -c 'LIMA_HOME=/Applications/Finch/lima/data /Applications/Finch/lima/bin/limactl shell finch curl --unix-socket /var/run/finch.sock -X GET http:/v1.43/version' |
130 | | - shell: bash |
| 114 | + - name: Build and setup Finch VM |
| 115 | + run: ./finch-daemon-pr/scripts/build-and-setup-finch-vm.sh |
131 | 116 |
|
132 | 117 | - name: Configure AWS credentials |
133 | 118 | uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1 |
@@ -169,58 +154,56 @@ jobs: |
169 | 154 | shell: bash |
170 | 155 |
|
171 | 156 | - name: Run unit tests |
172 | | - continue-on-error: true |
173 | | - run: | |
174 | | - ./scripts/samcli-vm/run-unit-tests.sh |
175 | | - echo "UNIT_EXIT_CODE=$(cat /tmp/unit_exit_code 2>/dev/null || echo 1)" >> $GITHUB_ENV |
176 | | -
|
177 | | - - name: Run sync tests |
178 | | - continue-on-error: true |
179 | | - run: | |
180 | | - ./scripts/samcli-vm/run-sync-tests.sh |
181 | | - echo "SYNC_EXIT_CODE=$(cat /tmp/sync_exit_code 2>/dev/null || echo 1)" >> $GITHUB_ENV |
182 | | -
|
183 | | - - name: Run package tests |
184 | | - continue-on-error: true |
185 | | - run: | |
186 | | - ./scripts/samcli-vm/run-package-tests.sh |
187 | | - echo "PACKAGE_EXIT_CODE=$(cat /tmp/package_exit_code 2>/dev/null || echo 1)" >> $GITHUB_ENV |
188 | | -
|
189 | | - - name: Run start-api tests |
190 | | - continue-on-error: true |
191 | | - run: | |
192 | | - ./scripts/samcli-vm/run-start-api-tests.sh |
193 | | - echo "START_API_EXIT_CODE=$(cat /tmp/start_api_exit_code 2>/dev/null || echo 1)" >> $GITHUB_ENV |
194 | | -
|
195 | | - - name: Run start-lambda tests |
196 | | - continue-on-error: true |
197 | | - run: | |
198 | | - ./scripts/samcli-vm/run-start-lambda-tests.sh |
199 | | - echo "START_LAMBDA_EXIT_CODE=$(cat /tmp/start_lambda_exit_code 2>/dev/null || echo 1)" >> $GITHUB_ENV |
| 157 | + timeout-minutes: 30 |
| 158 | + run: ./finch-daemon-pr/scripts/samcli-vm/run-unit-tests.sh |
200 | 159 |
|
201 | 160 | - name: Patch SAM CLI for Docker image cleanup |
202 | | - continue-on-error: true |
203 | 161 | run: | |
204 | 162 | # Apply git patch to handle ImageNotFound exceptions for all Docker tests |
205 | | - su ec2-user -c 'cd /Users/ec2-user/aws-sam-cli && git apply ${{ github.workspace }}/scripts/samcli-vm/invoke-teardown.patch' |
206 | | - echo "PATCH_EXIT_CODE=$?" >> $GITHUB_ENV |
| 163 | + su ec2-user -c 'cd /Users/ec2-user/aws-sam-cli && git apply ${{ github.workspace }}/finch-daemon-pr/scripts/samcli-vm/invoke-teardown.patch' |
207 | 164 | shell: bash |
208 | 165 |
|
209 | 166 | - name: Run invoke tests |
210 | | - continue-on-error: true |
211 | | - run: | |
212 | | - ./scripts/samcli-vm/run-invoke-tests.sh |
213 | | - echo "INVOKE_EXIT_CODE=$(cat /tmp/invoke_exit_code 2>/dev/null || echo 1)" >> $GITHUB_ENV |
| 167 | + timeout-minutes: 40 |
| 168 | + run: ./finch-daemon-pr/scripts/samcli-vm/run-invoke-tests.sh |
| 169 | + |
| 170 | + - name: Run start-api tests |
| 171 | + timeout-minutes: 70 |
| 172 | + run: ./finch-daemon-pr/scripts/samcli-vm/run-start-api-tests.sh |
| 173 | + |
| 174 | + - name: Run sync tests |
| 175 | + timeout-minutes: 20 |
| 176 | + run: ./finch-daemon-pr/scripts/samcli-vm/run-sync-tests.sh |
214 | 177 |
|
215 | | - - name: Check test results |
216 | | - run: ./scripts/samcli-vm/check-test-results.sh |
| 178 | + - name: Run package tests |
| 179 | + timeout-minutes: 10 |
| 180 | + run: ./finch-daemon-pr/scripts/samcli-vm/run-package-tests.sh |
| 181 | + |
| 182 | + - name: Run start-lambda tests |
| 183 | + timeout-minutes: 30 |
| 184 | + run: ./finch-daemon-pr/scripts/samcli-vm/run-start-lambda-tests.sh |
217 | 185 |
|
218 | 186 | # ensuring resources are clean post-test |
219 | 187 | cleanup: |
220 | | - runs-on: ubuntu-latest |
| 188 | + runs-on: codebuild-finch-daemon-arm64-2-instance-${{ github.run_id }}-${{ github.run_attempt }} |
221 | 189 | needs: samcli-vm-test |
222 | 190 | if: always() |
223 | 191 | steps: |
| 192 | + - name: Final cleanup |
| 193 | + run: | |
| 194 | + # Stop and remove VM |
| 195 | + su ec2-user -c 'finch vm stop' || true |
| 196 | + su ec2-user -c 'finch vm remove -f' || true |
| 197 | +
|
| 198 | + # Clean up processes and sockets |
| 199 | + sudo pkill -f socket_vmnet || true |
| 200 | + sudo pkill -f finch-daemon || true |
| 201 | + sudo rm -rf /private/var/run/finch-lima/*.sock || true |
| 202 | +
|
| 203 | + # Clean up cache and temporary files |
| 204 | + sudo rm -rf /Applications/Finch/lima/data/finch/_cache || true |
| 205 | + sudo rm -rf /tmp/finch-* || true |
| 206 | +
|
224 | 207 | - name: Checkout repository |
225 | 208 | uses: actions/checkout@v4 |
226 | 209 |
|
|
0 commit comments