Skip to content

Commit b9c250f

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

File tree

9 files changed

+65
-413
lines changed

9 files changed

+65
-413
lines changed

.github/workflows/mac-test.yaml

Lines changed: 64 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
GO_VERSION: '1.23.8'
1616
jobs:
1717
mac-test:
18-
runs-on: codebuild-Test-fd-codebuild-mac-${{ github.run_id }}-${{ github.run_attempt }}
18+
runs-on: codebuild-newFD-CI-test-${{ github.run_id }}-${{ github.run_attempt }}
1919
timeout-minutes: 30
2020
steps:
2121
- name: Clean macOS runner workspace
@@ -30,100 +30,75 @@ 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
39+
# - name: List available users and system info
4040
# 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
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-
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
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-
9763
# Run brew with custom environment
9864
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install lz4 automake autoconf libtool yq'
99-
100-
# Verify installation
101-
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep lz4 || echo "lz4 not installed"'
10265
shell: bash
103-
66+
67+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
68+
with:
69+
# We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail.
70+
fetch-depth: 0
71+
persist-credentials: false
72+
submodules: recursive
73+
74+
- name: Configure workspace for ec2-user
75+
run: |
76+
# Ensure workspace is properly owned by ec2-user
77+
chown -R ec2-user:staff ${{ github.workspace }}
78+
10479
# Install Finch
10580
- name: Install Finch
10681
run: |
10782
echo "Installing Finch as ec2-user..."
108-
83+
10984
# Run brew with custom environment
11085
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install finch --cask'
111-
86+
11287
# Verify installation
11388
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep finch || echo "finch not installed"'
114-
89+
11590
# Create .finch directory and config for ec2-user
11691
echo "Creating .finch directory and config for ec2-user..."
11792
su ec2-user -c 'mkdir -p /Users/ec2-user/.finch'
11893
su ec2-user -c 'echo "cpus: 4" > /Users/ec2-user/.finch/finch.yaml'
11994
su ec2-user -c 'echo "memory: 8GiB" >> /Users/ec2-user/.finch/finch.yaml'
120-
95+
12196
# Fix ownership of var/run directories
12297
echo "Fixing ownership of /private/var/run directories..."
12398
chown -R root:wheel /private/var/run
12499
mkdir -p /private/var/run/finch-lima
125100
chown -R root:wheel /private/var/run/finch-lima
126-
101+
127102
# Check finch version with HOME set to ec2-user's home
128103
echo "Checking finch version..."
129104
if ! su ec2-user -c 'HOME=/Users/ec2-user finch version'; then
@@ -133,57 +108,42 @@ jobs:
133108
fi
134109
shell: bash
135110

136-
# Check for Finch socket
137-
- name: Check for Finch socket
138-
run: |
139-
su ec2-user -c 'echo "Checking for Finch socket at /Applications/Finch/lima/data/finch/sock/finch.sock..."
140-
141-
# Check if the socket file exists
142-
if test -S /Applications/Finch/lima/data/finch/sock/finch.sock; then
143-
echo "Socket file exists"
144-
else
145-
echo "ERROR: Socket file not found at expected location /Applications/Finch/lima/data/finch/sock/finch.sock"
146-
exit 1
147-
fi'
148-
149-
# Store the socket path for later steps (this needs to run as root to modify GITHUB_ENV)
150-
echo "SOCKET_PATH=/Applications/Finch/lima/data/finch/sock/finch.sock" >> $GITHUB_ENV
151-
shell: bash
111+
# Check for Finch socket
112+
# - name: Check for Finch socket
113+
# run: |
114+
# su ec2-user -c 'echo "Checking for Finch socket at /Applications/Finch/lima/data/finch/sock/finch.sock..."
152115

153-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
154-
with:
155-
# We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail.
156-
fetch-depth: 0
157-
persist-credentials: false
158-
submodules: recursive
159-
ssh-user: ec2-user
160-
161-
- name: Configure workspace for ec2-user
162-
run: |
163-
# Ensure workspace is properly owned by ec2-user
164-
chown -R ec2-user:staff ${{ github.workspace }}
116+
# # Check if the socket file exists
117+
# if test -S /Applications/Finch/lima/data/finch/sock/finch.sock; then
118+
# echo "Socket file exists"
119+
# else
120+
# echo "ERROR: Socket file not found at expected location /Applications/Finch/lima/data/finch/sock/finch.sock"
121+
# exit 1
122+
# fi'
123+
124+
# # Store the socket path for later steps (this needs to run as root to modify GITHUB_ENV)
125+
# echo "SOCKET_PATH=/Applications/Finch/lima/data/finch/sock/finch.sock" >> $GITHUB_ENV
126+
# shell: bash
127+
128+
165129
# Run e2e tests inside the Finch VM
166130
- name: Run e2e tests
167131
run: |
168132
echo "Running e2e tests as ec2-user..."
169-
170-
su ec2-user -c "cd ${{ github.workspace }} && DOCKER_HOST=unix:///Applications/Finch/lima/data/finch/sock/finch.sock make test-e2e-inside-vm"
171-
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"
133+
su ec2-user -c "cd ${{ github.workspace }} && STATIC=1 GOPROXY=direct GOOS=linux GOARCH=$(GOARCH) make"
134+
su ec2-user -c 'HOME=/Users/ec2-user finch vm stop'
135+
su ec2-user -c 'HOME=/Users/ec2-user finch vm remove'
136+
137+
su ec2-user -c "cp ${{ github.workspace }}/bin/finch-daemon -f /Applications/Finch/finch-daemon/finch-daemon"
138+
su ec2-user -c 'HOME=/Users/ec2-user finch vm init'
139+
su ec2-user -c make test-e2e-inside-vm
180140
shell: bash
181-
141+
182142
# Cleanup
183143
- name: Stop Finch VM
184144
run: |
185145
echo "Stopping Finch VM as ec2-user..."
186-
146+
187147
# Stop VM using ec2-user with custom environment
188148
su ec2-user -c "source /Users/ec2-user/.brewrc && HOME=/Users/ec2-user finch vm stop"
189149
shell: bash

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ endif
147147

148148

149149
DAEMON_DOCKER_HOST := "unix:///Applications/Finch/lima/data/finch/sock/finch.sock"
150+
# DAEMON_ROOT
150151

151152
.PHONY: test-e2e-inside-vm
152153
test-e2e-inside-vm: macos

docs/finch-daemon-with-systemd.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)