forked from runfinch/finch-daemon
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (95 loc) · 3.43 KB
/
finch-vm-test.yaml
File metadata and controls
106 lines (95 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Finch VM
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
workflow_dispatch:
env:
GO_VERSION: '1.24.x'
jobs:
mac-test-e2e:
runs-on: codebuild-finch-daemon-arm64-2-instance-${{ github.run_id }}-${{ github.run_attempt }}
timeout-minutes: 30
steps:
- name: Clean macOS runner workspace
run: |
rm -rf ${{ github.workspace }}/*
- name: Configure Git for ec2-user
run: |
git config --global --add safe.directory "*"
shell: bash
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Configure Go for ec2-user
run: |
# Ensure Go is properly configured for ec2-user
chown -R ec2-user:staff $GOPATH || true
chown -R ec2-user:staff $RUNNER_TOOL_CACHE/go || true
- name: Install Rosetta 2
run: su ec2-user -c 'echo "A" | /usr/sbin/softwareupdate --install-rosetta --agree-to-license || true'
- name: Configure Homebrew for ec2-user
run: |
echo "Creating .brewrc file for ec2-user..."
cat > /Users/ec2-user/.brewrc << 'EOF'
# Homebrew environment setup
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
export HOMEBREW_PREFIX="/opt/homebrew"
export HOMEBREW_CELLAR="/opt/homebrew/Cellar"
export HOMEBREW_REPOSITORY="/opt/homebrew"
export HOMEBREW_NO_AUTO_UPDATE=1
EOF
chown ec2-user:staff /Users/ec2-user/.brewrc
# Fix Homebrew permissions
echo "Setting permissions for Homebrew directories..."
mkdir -p /opt/homebrew/Cellar
chown -R ec2-user:staff /opt/homebrew
shell: bash
# Install dependencies using ec2-user with custom environment
- name: Install dependencies
run: |
echo "Installing dependencies as ec2-user..."
# Run brew with custom environment
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install lz4 automake autoconf libtool yq'
shell: bash
- name: Checkout mainline finch repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: main
repository: runfinch/finch
fetch-depth: 0
persist-credentials: false
submodules: recursive
- name: Checkout finch-daemon PR
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
persist-credentials: false
submodules: recursive
path: finch-daemon-pr
- name: Build and setup Finch VM
run: ./finch-daemon-pr/scripts/build-and-setup-finch-vm.sh
# Run e2e tests
- name: Run e2e tests
run: |
echo "Running e2e tests..."
su ec2-user -c 'finch version' || true
su ec2-user -c 'cd ${{ github.workspace }}/finch-daemon-pr && make test-e2e-inside-vm'
shell: bash
# Cleanup
- name: Stop Finch VM
run: |
echo "Stopping Finch VM as ec2-user..."
# Stop VM using ec2-user with custom environment
su ec2-user -c "source /Users/ec2-user/.brewrc && HOME=/Users/ec2-user finch vm stop"
shell: bash
if: always()