15
15
GO_VERSION : ' 1.23.8'
16
16
jobs :
17
17
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 }}
19
19
timeout-minutes : 30
20
20
steps :
21
21
- name : Clean macOS runner workspace
@@ -30,160 +30,137 @@ jobs:
30
30
with :
31
31
go-version : ${{ env.GO_VERSION }}
32
32
cache : false
33
-
33
+
34
34
- name : Configure Go for ec2-user
35
35
run : |
36
36
# Ensure Go is properly configured for ec2-user
37
37
chown -R ec2-user:staff $GOPATH || true
38
38
chown -R ec2-user:staff $RUNNER_TOOL_CACHE/go || true
39
- # - name: Clean up previous files
39
+ # - name: List available users and system info
40
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
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
+
67
55
- 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
72
59
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"
82
67
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
91
70
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
+
92
77
# Install dependencies using ec2-user with custom environment
93
78
- name : Install dependencies
94
79
run : |
95
80
echo "Installing dependencies as ec2-user..."
96
-
97
81
# Run brew with custom environment
98
82
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"'
102
83
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
+
104
97
# Install Finch
105
98
- name : Install Finch
106
99
run : |
107
100
echo "Installing Finch as ec2-user..."
108
-
101
+
109
102
# Run brew with custom environment
110
103
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew install finch --cask'
111
-
104
+
112
105
# Verify installation
113
106
su ec2-user -c 'source /Users/ec2-user/.brewrc && brew list | grep finch || echo "finch not installed"'
114
-
107
+
115
108
# Create .finch directory and config for ec2-user
116
109
echo "Creating .finch directory and config for ec2-user..."
117
110
su ec2-user -c 'mkdir -p /Users/ec2-user/.finch'
118
111
su ec2-user -c 'echo "cpus: 4" > /Users/ec2-user/.finch/finch.yaml'
119
112
su ec2-user -c 'echo "memory: 8GiB" >> /Users/ec2-user/.finch/finch.yaml'
120
-
113
+
121
114
# Fix ownership of var/run directories
122
115
echo "Fixing ownership of /private/var/run directories..."
123
116
chown -R root:wheel /private/var/run
124
117
mkdir -p /private/var/run/finch-lima
125
118
chown -R root:wheel /private/var/run/finch-lima
126
-
119
+
127
120
# Check finch version with HOME set to ec2-user's home
128
121
echo "Checking finch version..."
129
122
if ! su ec2-user -c 'HOME=/Users/ec2-user finch version'; then
130
123
echo "finch version command failed, starting VM..."
131
- su ec2-user -c 'HOME=/Users/ec2-user finch vm remove'
132
- su ec2-user -c 'HOME=/Users/ec2-user finch vm init'
124
+ su ec2-user -c 'HOME=/Users/ec2-user finch vm start'
133
125
fi
134
126
shell : bash
135
127
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
128
+ # Check for Finch socket
129
+ # - name: Check for Finch socket
130
+ # run: |
131
+ # su ec2-user -c 'echo "Checking for Finch socket at /Applications/Finch/lima/data/finch/sock/finch.sock..."
152
132
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 }}
133
+ # # Check if the socket file exists
134
+ # if test -S /Applications/Finch/lima/data/finch/sock/finch.sock; then
135
+ # echo "Socket file exists"
136
+ # else
137
+ # echo "ERROR: Socket file not found at expected location /Applications/Finch/lima/data/finch/sock/finch.sock"
138
+ # exit 1
139
+ # fi'
140
+
141
+ # # Store the socket path for later steps (this needs to run as root to modify GITHUB_ENV)
142
+ # echo "SOCKET_PATH=/Applications/Finch/lima/data/finch/sock/finch.sock" >> $GITHUB_ENV
143
+ # shell: bash
144
+
145
+
165
146
# Run e2e tests inside the Finch VM
166
147
- name : Run e2e tests
167
148
run : |
168
149
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"
150
+ su ec2-user -c "cd ${{ github.workspace }} && STATIC=1 GOPROXY=direct GOOS=linux GOARCH=$(GOARCH) make"
151
+ su ec2-user -c 'HOME=/Users/ec2-user finch vm stop'
152
+ su ec2-user -c 'HOME=/Users/ec2-user finch vm remove'
153
+
154
+ su ec2-user -c "cp ${{ github.workspace }}/bin/finch-daemon -f /Applications/Finch/finch-daemon/finch-daemon"
155
+ su ec2-user -c 'HOME=/Users/ec2-user finch vm init'
156
+ su ec2-user -c make test-e2e-inside-vm
180
157
shell : bash
181
-
158
+
182
159
# Cleanup
183
160
- name : Stop Finch VM
184
161
run : |
185
162
echo "Stopping Finch VM as ec2-user..."
186
-
163
+
187
164
# Stop VM using ec2-user with custom environment
188
165
su ec2-user -c "source /Users/ec2-user/.brewrc && HOME=/Users/ec2-user finch vm stop"
189
166
shell : bash
0 commit comments