@@ -23,107 +23,95 @@ jobs:
2323 rm -rf ${{ github.workspace }}/*
2424 - name : Configure Git for ec2-user
2525 run : |
26- # sudo chown -R ec2-user: /private
2726 git config --global --add safe.directory "*"
2827 shell : bash
2928 - uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
3029 with :
3130 go-version : ${{ env.GO_VERSION }}
3231 cache : false
33-
32+
3433 - name : Configure Go for ec2-user
3534 run : |
3635 # Ensure Go is properly configured for ec2-user
3736 chown -R ec2-user:staff $GOPATH || true
3837 chown -R ec2-user:staff $RUNNER_TOOL_CACHE/go || true
39- # - name: Clean up previous files
40- # run: |
41- # sudo -u ec2-user bash rm -rf /opt/finch
42- # sudo -u ec2-user bash rm -rf ~/.finch
43- # sudo -u ec2-user bash rm -rf ./_output
44- # if pgrep '^qemu-system'; then
45- # sudo -u ec2-user bash pkill '^qemu-system'
46- # fi
47- # if pgrep '^socket_vmnet'; then
48- # sudo -u ec2-user bash pkill '^socket_vmnet'
49- # fi
5038 # Debug step to see available users
51- - name : List available users and system info
52- run : |
53- su ec2-user -c 'echo "Current user: $(whoami)"
54- echo "Current user ID: $(id -u)"
55- echo "Current user home: $HOME"
56- echo "Console user: $(stat -f "%Su" /dev/console)"
57- echo "All users:"
58- dscl . -list /Users | grep -v "^_"
59- echo "Users with home directories:"
60- ls -la /Users/
61- echo "Environment variables:"
62- env | sort
63- echo "Brew info:"
64- which brew || echo "brew not found in PATH"
65- echo "PATH: $PATH"'
66-
39+ # - name: List available users and system info
40+ # run: |
41+ # su ec2-user -c 'echo "Current user: $(whoami)"
42+ # echo "Current user ID: $(id -u)"
43+ # echo "Current user home: $HOME"
44+ # echo "Console user: $(stat -f "%Su" /dev/console)"
45+ # echo "All users:"
46+ # dscl . -list /Users | grep -v "^_"
47+ # echo "Users with home directories:"
48+ # ls -la /Users/
49+ # echo "Environment variables:"
50+ # env | sort
51+ # echo "Brew info:"
52+ # which brew || echo "brew not found in PATH"
53+ # echo "PATH: $PATH"'
54+
6755 - name : Install Rosetta 2
6856 run : su ec2-user -c 'echo "A" | softwareupdate --install-rosetta || true'
69-
57+
7058 # Fix Homebrew permissions and setup environment
7159 - name : Fix Homebrew permissions and setup environment
7260 run : |
7361 echo "Fixing Homebrew permissions for ec2-user..."
7462 chown -R ec2-user:staff /opt/homebrew
75-
63+
7664 # Create a cache directory that ec2-user can access
7765 mkdir -p /tmp/homebrew-cache
7866 chown -R ec2-user:staff /tmp/homebrew-cache
79-
67+
8068 # Create a .brewrc file for ec2-user with environment settings
8169 su ec2-user -c 'cat > /Users/ec2-user/.brewrc << EOF
8270 export HOMEBREW_NO_AUTO_UPDATE=1
8371 export HOMEBREW_NO_INSTALL_CLEANUP=1
8472 export HOMEBREW_CACHE=/tmp/homebrew-cache
8573 export HOMEBREW_NO_ENV_HINTS=1
8674 EOF'
87-
75+
8876 # Make sure ec2-user sources the .brewrc file
8977 su ec2-user -c 'echo "source /Users/ec2-user/.brewrc" >> /Users/ec2-user/.zshrc'
9078 su ec2-user -c 'echo "source /Users/ec2-user/.brewrc" >> /Users/ec2-user/.bashrc'
91-
79+
9280 # Install dependencies using ec2-user with custom environment
9381 - name : Install dependencies
9482 run : |
9583 echo "Installing dependencies as ec2-user..."
96-
84+
9785 # Run brew with custom environment
9886 su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install lz4 automake autoconf libtool yq'
99-
87+
10088 # Verify installation
10189 su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep lz4 || echo "lz4 not installed"'
10290 shell : bash
103-
91+
10492 # Install Finch
10593 - name : Install Finch
10694 run : |
10795 echo "Installing Finch as ec2-user..."
108-
96+
10997 # Run brew with custom environment
11098 su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install finch --cask'
111-
99+
112100 # Verify installation
113101 su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep finch || echo "finch not installed"'
114-
102+
115103 # Create .finch directory and config for ec2-user
116104 echo "Creating .finch directory and config for ec2-user..."
117105 su ec2-user -c 'mkdir -p /Users/ec2-user/.finch'
118106 su ec2-user -c 'echo "cpus: 4" > /Users/ec2-user/.finch/finch.yaml'
119107 su ec2-user -c 'echo "memory: 8GiB" >> /Users/ec2-user/.finch/finch.yaml'
120-
108+
121109 # Fix ownership of var/run directories
122110 echo "Fixing ownership of /private/var/run directories..."
123111 chown -R root:wheel /private/var/run
124112 mkdir -p /private/var/run/finch-lima
125113 chown -R root:wheel /private/var/run/finch-lima
126-
114+
127115 # Check finch version with HOME set to ec2-user's home
128116 echo "Checking finch version..."
129117 if ! su ec2-user -c 'HOME=/Users/ec2-user finch version'; then
@@ -137,15 +125,15 @@ jobs:
137125 - name : Check for Finch socket
138126 run : |
139127 su ec2-user -c 'echo "Checking for Finch socket at /Applications/Finch/lima/data/finch/sock/finch.sock..."
140-
128+
141129 # Check if the socket file exists
142130 if test -S /Applications/Finch/lima/data/finch/sock/finch.sock; then
143131 echo "Socket file exists"
144- else
132+ else
145133 echo "ERROR: Socket file not found at expected location /Applications/Finch/lima/data/finch/sock/finch.sock"
146134 exit 1
147135 fi'
148-
136+
149137 # Store the socket path for later steps (this needs to run as root to modify GITHUB_ENV)
150138 echo "SOCKET_PATH=/Applications/Finch/lima/data/finch/sock/finch.sock" >> $GITHUB_ENV
151139 shell : bash
@@ -157,7 +145,7 @@ jobs:
157145 persist-credentials : false
158146 submodules : recursive
159147 ssh-user : ec2-user
160-
148+
161149 - name : Configure workspace for ec2-user
162150 run : |
163151 # Ensure workspace is properly owned by ec2-user
@@ -166,24 +154,15 @@ jobs:
166154 - name : Run e2e tests
167155 run : |
168156 echo "Running e2e tests as ec2-user..."
169-
157+
170158 su ec2-user -c "cd ${{ github.workspace }} && DOCKER_HOST=unix:///Applications/Finch/lima/data/finch/sock/finch.sock make test-e2e-inside-vm"
171159 shell : bash
172-
173- # Run e2e tests with OPA authorization
174- - name : Run opa e2e tests
175- run : |
176- echo "Running e2e tests with OPA authorization as ec2-user..."
177-
178- echo "Using DOCKER_HOST=unix:///Applications/Finch/lima/data/finch/sock/finch.sock"
179- su ec2-user -c "cd ${{ github.workspace }} && DOCKER_HOST=unix:///Applications/Finch/lima/data/finch/sock/finch.sock make test-e2e-opa"
180- shell : bash
181-
160+
182161 # Cleanup
183162 - name : Stop Finch VM
184163 run : |
185164 echo "Stopping Finch VM as ec2-user..."
186-
165+
187166 # Stop VM using ec2-user with custom environment
188167 su ec2-user -c "source /Users/ec2-user/.brewrc && HOME=/Users/ec2-user finch vm stop"
189168 shell : bash
0 commit comments