1515 GO_VERSION : ' 1.23.8'
1616jobs :
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,93 @@ 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
56+ run : su ec2-user -c 'echo "A" | /usr/sbin/softwareupdate --install-rosetta --agree-to-license || true'
57+
58+ - name : Configure Homebrew for ec2-user
7259 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
60+ echo "Creating .brewrc file for ec2-user..."
61+ cat > /Users/ec2-user/.brewrc << 'EOF'
62+ # Homebrew environment setup
63+ export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
64+ export HOMEBREW_PREFIX="/opt/homebrew"
65+ export HOMEBREW_CELLAR="/opt/homebrew/Cellar"
66+ export HOMEBREW_REPOSITORY="/opt/homebrew"
8267 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'
68+ EOF
69+ chown ec2-user:staff /Users/ec2-user/.brewrc
9170
71+ # Fix Homebrew permissions
72+ echo "Setting permissions for Homebrew directories..."
73+ mkdir -p /opt/homebrew/Cellar
74+ chown -R ec2-user:staff /opt/homebrew
75+ shell : bash
76+
9277 # Install dependencies using ec2-user with custom environment
9378 - name : Install dependencies
9479 run : |
9580 echo "Installing dependencies as ec2-user..."
96-
9781 # Run brew with custom environment
9882 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"'
10283 shell : bash
103-
84+
85+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
86+ with :
87+ # We need to get all the git tags to make version injection work. See VERSION in Makefile for more detail.
88+ fetch-depth : 0
89+ persist-credentials : false
90+ submodules : recursive
91+
92+ - name : Configure workspace for ec2-user
93+ run : |
94+ # Ensure workspace is properly owned by ec2-user
95+ chown -R ec2-user:staff ${{ github.workspace }}
96+
10497 # Install Finch
10598 - name : Install Finch
10699 run : |
107100 echo "Installing Finch as ec2-user..."
108-
101+
109102 # Run brew with custom environment
110103 su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install finch --cask'
111-
104+
112105 # Verify installation
113106 su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep finch || echo "finch not installed"'
114-
107+
115108 # Create .finch directory and config for ec2-user
116109 echo "Creating .finch directory and config for ec2-user..."
117110 su ec2-user -c 'mkdir -p /Users/ec2-user/.finch'
118111 su ec2-user -c 'echo "cpus: 4" > /Users/ec2-user/.finch/finch.yaml'
119112 su ec2-user -c 'echo "memory: 8GiB" >> /Users/ec2-user/.finch/finch.yaml'
120-
113+
121114 # Fix ownership of var/run directories
122115 echo "Fixing ownership of /private/var/run directories..."
123116 chown -R root:wheel /private/var/run
124117 mkdir -p /private/var/run/finch-lima
125118 chown -R root:wheel /private/var/run/finch-lima
126-
119+
127120 # Check finch version with HOME set to ec2-user's home
128121 echo "Checking finch version..."
129122 if ! su ec2-user -c 'HOME=/Users/ec2-user finch version'; then
@@ -133,57 +126,42 @@ jobs:
133126 fi
134127 shell : bash
135128
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
129+ # Check for Finch socket
130+ # - name: Check for Finch socket
131+ # run: |
132+ # su ec2-user -c 'echo "Checking for Finch socket at /Applications/Finch/lima/data/finch/sock/finch.sock..."
152133
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 }}
134+ # # Check if the socket file exists
135+ # if test -S /Applications/Finch/lima/data/finch/sock/finch.sock; then
136+ # echo "Socket file exists"
137+ # else
138+ # echo "ERROR: Socket file not found at expected location /Applications/Finch/lima/data/finch/sock/finch.sock"
139+ # exit 1
140+ # fi'
141+
142+ # # Store the socket path for later steps (this needs to run as root to modify GITHUB_ENV)
143+ # echo "SOCKET_PATH=/Applications/Finch/lima/data/finch/sock/finch.sock" >> $GITHUB_ENV
144+ # shell: bash
145+
146+
165147 # Run e2e tests inside the Finch VM
166148 - name : Run e2e tests
167149 run : |
168150 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"
151+ su ec2-user -c "cd ${{ github.workspace }} && STATIC=1 GOPROXY=direct GOOS=linux GOARCH=$(GOARCH) make"
152+ su ec2-user -c 'HOME=/Users/ec2-user finch vm stop'
153+ su ec2-user -c 'HOME=/Users/ec2-user finch vm remove'
154+
155+ su ec2-user -c "cp ${{ github.workspace }}/bin/finch-daemon -f /Applications/Finch/finch-daemon/finch-daemon"
156+ su ec2-user -c 'HOME=/Users/ec2-user finch vm init'
157+ su ec2-user -c make test-e2e-inside-vm
180158 shell : bash
181-
159+
182160 # Cleanup
183161 - name : Stop Finch VM
184162 run : |
185163 echo "Stopping Finch VM as ec2-user..."
186-
164+
187165 # Stop VM using ec2-user with custom environment
188166 su ec2-user -c "source /Users/ec2-user/.brewrc && HOME=/Users/ec2-user finch vm stop"
189167 shell : bash
0 commit comments