Skip to content

Commit 28b73f6

Browse files
committed
chore: base tests running
Signed-off-by: Arjun Raja Yogidas <[email protected]>
1 parent ce69e15 commit 28b73f6

File tree

1 file changed

+21
-63
lines changed

1 file changed

+21
-63
lines changed

.github/workflows/mac-test.yaml

Lines changed: 21 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,12 @@ jobs:
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
3737
chown -R ec2-user:staff $GOPATH || true
3838
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
50-
# Debug step to see available users
5139
- name: List available users and system info
5240
run: |
5341
su ec2-user -c 'echo "Current user: $(whoami)"
@@ -63,67 +51,46 @@ jobs:
6351
echo "Brew info:"
6452
which brew || echo "brew not found in PATH"
6553
echo "PATH: $PATH"'
66-
54+
6755
- name: Install Rosetta 2
68-
run: su ec2-user -c 'echo "A" | softwareupdate --install-rosetta || true'
69-
70-
# Fix Homebrew permissions and setup environment
71-
- name: Fix Homebrew permissions and setup environment
72-
run: |
73-
echo "Fixing Homebrew permissions for ec2-user..."
74-
chown -R ec2-user:staff /opt/homebrew
75-
76-
# Create a cache directory that ec2-user can access
77-
mkdir -p /tmp/homebrew-cache
78-
chown -R ec2-user:staff /tmp/homebrew-cache
79-
80-
# Create a .brewrc file for ec2-user with environment settings
81-
su ec2-user -c 'cat > /Users/ec2-user/.brewrc << EOF
82-
export HOMEBREW_NO_AUTO_UPDATE=1
83-
export HOMEBREW_NO_INSTALL_CLEANUP=1
84-
export HOMEBREW_CACHE=/tmp/homebrew-cache
85-
export HOMEBREW_NO_ENV_HINTS=1
86-
EOF'
87-
88-
# Make sure ec2-user sources the .brewrc file
89-
su ec2-user -c 'echo "source /Users/ec2-user/.brewrc" >> /Users/ec2-user/.zshrc'
90-
su ec2-user -c 'echo "source /Users/ec2-user/.brewrc" >> /Users/ec2-user/.bashrc'
91-
56+
run: su ec2-user -c 'echo "A" | /usr/sbin/softwareupdate --install-rosetta --agree-to-license || true'
57+
58+
9259
# Install dependencies using ec2-user with custom environment
9360
- name: Install dependencies
9461
run: |
9562
echo "Installing dependencies as ec2-user..."
96-
63+
9764
# Run brew with custom environment
9865
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install lz4 automake autoconf libtool yq'
99-
66+
10067
# Verify installation
10168
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep lz4 || echo "lz4 not installed"'
10269
shell: bash
103-
70+
10471
# Install Finch
10572
- name: Install Finch
10673
run: |
10774
echo "Installing Finch as ec2-user..."
108-
75+
10976
# Run brew with custom environment
11077
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install finch --cask'
111-
78+
11279
# Verify installation
11380
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep finch || echo "finch not installed"'
114-
81+
11582
# Create .finch directory and config for ec2-user
11683
echo "Creating .finch directory and config for ec2-user..."
11784
su ec2-user -c 'mkdir -p /Users/ec2-user/.finch'
11885
su ec2-user -c 'echo "cpus: 4" > /Users/ec2-user/.finch/finch.yaml'
11986
su ec2-user -c 'echo "memory: 8GiB" >> /Users/ec2-user/.finch/finch.yaml'
120-
87+
12188
# Fix ownership of var/run directories
12289
echo "Fixing ownership of /private/var/run directories..."
12390
chown -R root:wheel /private/var/run
12491
mkdir -p /private/var/run/finch-lima
12592
chown -R root:wheel /private/var/run/finch-lima
126-
93+
12794
# Check finch version with HOME set to ec2-user's home
12895
echo "Checking finch version..."
12996
if ! su ec2-user -c 'HOME=/Users/ec2-user finch version'; then
@@ -133,19 +100,19 @@ jobs:
133100
fi
134101
shell: bash
135102

136-
# Check for Finch socket
103+
# Check for Finch socket
137104
- name: Check for Finch socket
138105
run: |
139106
su ec2-user -c 'echo "Checking for Finch socket at /Applications/Finch/lima/data/finch/sock/finch.sock..."
140-
107+
141108
# Check if the socket file exists
142109
if test -S /Applications/Finch/lima/data/finch/sock/finch.sock; then
143110
echo "Socket file exists"
144-
else
111+
else
145112
echo "ERROR: Socket file not found at expected location /Applications/Finch/lima/data/finch/sock/finch.sock"
146113
exit 1
147114
fi'
148-
115+
149116
# Store the socket path for later steps (this needs to run as root to modify GITHUB_ENV)
150117
echo "SOCKET_PATH=/Applications/Finch/lima/data/finch/sock/finch.sock" >> $GITHUB_ENV
151118
shell: bash
@@ -157,7 +124,7 @@ jobs:
157124
persist-credentials: false
158125
submodules: recursive
159126
ssh-user: ec2-user
160-
127+
161128
- name: Configure workspace for ec2-user
162129
run: |
163130
# Ensure workspace is properly owned by ec2-user
@@ -166,24 +133,15 @@ jobs:
166133
- name: Run e2e tests
167134
run: |
168135
echo "Running e2e tests as ec2-user..."
169-
136+
170137
su ec2-user -c "cd ${{ github.workspace }} && DOCKER_HOST=unix:///Applications/Finch/lima/data/finch/sock/finch.sock make test-e2e-inside-vm"
171138
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-
139+
182140
# Cleanup
183141
- name: Stop Finch VM
184142
run: |
185143
echo "Stopping Finch VM as ec2-user..."
186-
144+
187145
# Stop VM using ec2-user with custom environment
188146
su ec2-user -c "source /Users/ec2-user/.brewrc && HOME=/Users/ec2-user finch vm stop"
189147
shell: bash

0 commit comments

Comments
 (0)