3030 with :
3131 go-version : ${{ env.GO_VERSION }}
3232 cache : false
33-
33+
3434 - name : Configure Go for ec2-user
3535 run : |
3636 # Ensure Go is properly configured for ec2-user
@@ -63,67 +63,67 @@ jobs:
6363 echo "Brew info:"
6464 which brew || echo "brew not found in PATH"
6565 echo "PATH: $PATH"'
66-
66+
6767 - name : Install Rosetta 2
6868 run : su ec2-user -c 'echo "A" | softwareupdate --install-rosetta || true'
69-
69+
7070 # Fix Homebrew permissions and setup environment
7171 - name : Fix Homebrew permissions and setup environment
7272 run : |
7373 echo "Fixing Homebrew permissions for ec2-user..."
7474 chown -R ec2-user:staff /opt/homebrew
75-
75+
7676 # Create a cache directory that ec2-user can access
7777 mkdir -p /tmp/homebrew-cache
7878 chown -R ec2-user:staff /tmp/homebrew-cache
79-
79+
8080 # Create a .brewrc file for ec2-user with environment settings
8181 su ec2-user -c 'cat > /Users/ec2-user/.brewrc << EOF
8282 export HOMEBREW_NO_AUTO_UPDATE=1
8383 export HOMEBREW_NO_INSTALL_CLEANUP=1
8484 export HOMEBREW_CACHE=/tmp/homebrew-cache
8585 export HOMEBREW_NO_ENV_HINTS=1
8686 EOF'
87-
87+
8888 # Make sure ec2-user sources the .brewrc file
8989 su ec2-user -c 'echo "source /Users/ec2-user/.brewrc" >> /Users/ec2-user/.zshrc'
9090 su ec2-user -c 'echo "source /Users/ec2-user/.brewrc" >> /Users/ec2-user/.bashrc'
91-
91+
9292 # Install dependencies using ec2-user with custom environment
9393 - name : Install dependencies
9494 run : |
9595 echo "Installing dependencies as ec2-user..."
96-
96+
9797 # Run brew with custom environment
9898 su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install lz4 automake autoconf libtool yq'
99-
99+
100100 # Verify installation
101101 su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep lz4 || echo "lz4 not installed"'
102102 shell : bash
103-
103+
104104 # Install Finch
105105 - name : Install Finch
106106 run : |
107107 echo "Installing Finch as ec2-user..."
108-
108+
109109 # Run brew with custom environment
110110 su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install finch --cask'
111-
111+
112112 # Verify installation
113113 su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep finch || echo "finch not installed"'
114-
114+
115115 # Create .finch directory and config for ec2-user
116116 echo "Creating .finch directory and config for ec2-user..."
117117 su ec2-user -c 'mkdir -p /Users/ec2-user/.finch'
118118 su ec2-user -c 'echo "cpus: 4" > /Users/ec2-user/.finch/finch.yaml'
119119 su ec2-user -c 'echo "memory: 8GiB" >> /Users/ec2-user/.finch/finch.yaml'
120-
120+
121121 # Fix ownership of var/run directories
122122 echo "Fixing ownership of /private/var/run directories..."
123123 chown -R root:wheel /private/var/run
124124 mkdir -p /private/var/run/finch-lima
125125 chown -R root:wheel /private/var/run/finch-lima
126-
126+
127127 # Check finch version with HOME set to ec2-user's home
128128 echo "Checking finch version..."
129129 if ! su ec2-user -c 'HOME=/Users/ec2-user finch version'; then
@@ -133,19 +133,19 @@ jobs:
133133 fi
134134 shell : bash
135135
136- # Check for Finch socket
136+ # Check for Finch socket
137137 - name : Check for Finch socket
138138 run : |
139139 su ec2-user -c 'echo "Checking for Finch socket at /Applications/Finch/lima/data/finch/sock/finch.sock..."
140-
140+
141141 # Check if the socket file exists
142142 if test -S /Applications/Finch/lima/data/finch/sock/finch.sock; then
143143 echo "Socket file exists"
144- else
144+ else
145145 echo "ERROR: Socket file not found at expected location /Applications/Finch/lima/data/finch/sock/finch.sock"
146146 exit 1
147147 fi'
148-
148+
149149 # Store the socket path for later steps (this needs to run as root to modify GITHUB_ENV)
150150 echo "SOCKET_PATH=/Applications/Finch/lima/data/finch/sock/finch.sock" >> $GITHUB_ENV
151151 shell : bash
@@ -157,7 +157,7 @@ jobs:
157157 persist-credentials : false
158158 submodules : recursive
159159 ssh-user : ec2-user
160-
160+
161161 - name : Configure workspace for ec2-user
162162 run : |
163163 # Ensure workspace is properly owned by ec2-user
@@ -166,24 +166,15 @@ jobs:
166166 - name : Run e2e tests
167167 run : |
168168 echo "Running e2e tests as ec2-user..."
169-
169+
170170 su ec2-user -c "cd ${{ github.workspace }} && DOCKER_HOST=unix:///Applications/Finch/lima/data/finch/sock/finch.sock make test-e2e-inside-vm"
171171 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-
172+
182173 # Cleanup
183174 - name : Stop Finch VM
184175 run : |
185176 echo "Stopping Finch VM as ec2-user..."
186-
177+
187178 # Stop VM using ec2-user with custom environment
188179 su ec2-user -c "source /Users/ec2-user/.brewrc && HOME=/Users/ec2-user finch vm stop"
189180 shell : bash
0 commit comments