File: macOS.yml

package info (click to toggle)
pcp 7.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 253,896 kB
  • sloc: ansic: 1,488,097; sh: 185,322; xml: 160,462; cpp: 83,813; python: 25,576; perl: 18,365; yacc: 6,877; lex: 2,864; makefile: 2,759; exp: 250; awk: 165; fortran: 60; java: 22
file content (434 lines) | stat: -rw-r--r-- 17,757 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
name: macOS CI
on:
  push:
jobs:
  build:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v6
        with:
          ref: ${{ github.ref_name }}
      - name: Install Homebrew
        run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
      - name: Update Homebrew
        run: brew update
      - name: Install Homebrew deps
        id: install-brew-deps
        run: |
          PACKAGES=$(grep -v '^#' build/mac/brew-packages.txt | grep -v '^$' | tr '\n' ' ')
          echo "Installing: $PACKAGES"
          brew install $PACKAGES
      - name: Set up Python build environment
        id: install-python-deps
        run: |
          python3 --version
          ./build/mac/setup-python-env.sh build/mac/requirements-test.txt
          python3 -c "import requests; print('requests', requests.__version__)"
      - name: Build on macOS
        id: Build
        run: |
          xcodebuild -version
          ./Makepkgs -verbose
      # Validate PMID consistency
      - name: Validate PMID Consistency
        id: pmid-validation
        if: success()
        run: |
          echo "Validating PMID consistency across pmns, metrics.c, and darwin.h..."
          ./build/mac/test/integration/test-pmid-consistency.sh
      # Darwin PMDA Unit Tests (pre-installation)
      - name: Run Darwin PMDA Unit Tests
        id: unit-tests
        if: success()
        run: |
          echo "Running all PMDA unit tests..."
          cd build/mac/test
          ./run-unit-tests.sh
      - name: Debug on unit test failure
        if: failure() && steps.unit-tests.conclusion == 'failure'
        run: |
          echo "Unit tests failed. Checking build artifacts..."
          find . -name "pmda_darwin.dylib" -o -name "pmdadarwin"
          echo "Checking for dbpmda..."
          find . -name "dbpmda"
      - name: Debug on failure
        if: failure() && steps.Build.conclusion == 'failure'
        run: |
          cat /Users/runner/work/pcp/pcp/Logs/pcp
      - name: Debug on Python installation failure
        if: failure() && steps.install-python-deps.conclusion == 'failure'
        run: |
          echo "Python installation failed. Collecting debug info..."
          brew --version
          brew config
          brew doctor
          ls -la /usr/local/bin | grep python
          df -h
          brew list
      - name: Debug on brew dependency installation failure
        if: failure() && steps.install-brew-deps.conclusion == 'failure'
        run: |
          echo "Dependency installation failed. Collecting debug info..."
          brew --version
          brew config
          brew doctor
          ls -la /usr/local/bin | grep python
          df -h
          brew list
      # Start valkey before install so pmproxy can connect on startup
      - name: Start valkey
        run: brew services start valkey
      # Installation testing steps
      - name: Mount DMG and Install PKG
        if: success()
        id: install-test
        run: |
          # Find the generated DMG
          DMG_PATH=$(find pcp-**/build/mac -name "pcp-*.dmg" | head -1)
          echo "Found DMG: $DMG_PATH"

          # Mount the DMG
          MOUNT_OUTPUT=$(hdiutil attach "$DMG_PATH" | tail -1)
          VOLUME_PATH=$(echo "$MOUNT_OUTPUT" | awk '{print $3}')
          echo "Mounted at: $VOLUME_PATH"

          # Find and install the PKG
          PKG_PATH=$(find "$VOLUME_PATH" -name "*.pkg" | head -1)
          echo "Found PKG: $PKG_PATH"

          # Install (sudo is passwordless in GitHub Actions)
          sudo installer -pkg "$PKG_PATH" -target / -verbose -dumplog
      - name: Debug on install failure
        if: failure() && steps.install-test.conclusion == 'failure'
        run: |
          echo "=== /var/log/install.log (last 100 lines) ==="
          sudo tail -100 /var/log/install.log
      - name: Verify Installation
        if: success() && steps.install-test.conclusion == 'success'
        run: |
          # Check critical binaries exist (will fail build if not found)
          echo "Checking for installed binaries..."
          which pminfo && echo "✓ pminfo found at $(which pminfo)"
          which pmval && echo "✓ pmval found at $(which pmval)"
          which pmlogger && echo "✓ pmlogger found at $(which pmlogger)"

          # Check for expected directories (will fail build if not found)
          echo "Checking for expected directories..."
          test -d /etc/pcp && echo "✓ /etc/pcp exists"
          test -d /var/lib/pcp && echo "✓ /var/lib/pcp exists"
      # Darwin PMDA Integration Tests (post-installation)
      - name: Wait for pmcd to start
        if: success() && steps.install-test.conclusion == 'success'
        id: wait-for-pmcd
        run: |
          echo "=== Installation Verification ==="
          echo "PCP installation check:"
          which pmcd && echo "pmcd binary: $(which pmcd)" || echo "pmcd not in PATH"
          which pminfo && echo "pminfo binary: $(which pminfo)" || echo "pminfo not in PATH"
          which pcp && echo "pcp binary: $(which pcp)" || echo "pcp not in PATH"

          echo ""
          echo "Critical directories:"
          test -d /etc/pcp && echo "✓ /etc/pcp exists" || echo "✗ /etc/pcp MISSING"
          test -d /var/lib/pcp && echo "✓ /var/lib/pcp exists" || echo "✗ /var/lib/pcp MISSING"
          test -d /var/log/pcp && echo "✓ /var/log/pcp exists" || echo "✗ /var/log/pcp MISSING"
          test -d /var/log/pcp/pmcd && echo "✓ /var/log/pcp/pmcd exists" || echo "✗ /var/log/pcp/pmcd MISSING"

          echo ""
          echo "pmcd.conf contents:"
          cat /etc/pcp/pmcd/pmcd.conf 2>/dev/null || echo "pmcd.conf not found"

          echo ""
          echo "Checking launchd plist:"
          test -f /Library/LaunchDaemons/org.pcp.pmcd.plist && echo "✓ org.pcp.pmcd.plist exists" || echo "✗ org.pcp.pmcd.plist MISSING"

          echo ""
          echo "=== Waiting for pmcd service to start (post-install) ==="
          echo "The installer should have started pmcd via launchd..."

          TIMEOUT=60  # Wait up to 60 seconds
          ELAPSED=0
          INTERVAL=3

          while [ $ELAPSED -lt $TIMEOUT ]; do
            echo "Checking if pmcd is responding (${ELAPSED}s elapsed)..."

            # Check if pcp command works (like in .cirrus.yml)
            if pcp 2>/dev/null; then
              echo "✓ pmcd service is responding!"
              break
            fi

            # Also check if pminfo can connect
            if pminfo -h localhost -f hinv.ncpu 2>/dev/null; then
              echo "✓ pmcd is accepting connections!"
              break
            fi

            sleep $INTERVAL
            ELAPSED=$((ELAPSED + INTERVAL))
          done

          if [ $ELAPSED -ge $TIMEOUT ]; then
            echo "✗ ERROR: pmcd service failed to start within $TIMEOUT seconds"

            echo ""
            echo "=== Diagnostic Information ==="
            echo "pmcd process status:"
            pgrep pmcd && echo "pmcd is running (PID: $(pgrep pmcd))" || echo "pmcd NOT running"

            echo ""
            echo "pmcd full process details:"
            ps aux | grep pmcd | grep -v grep || echo "No pmcd process found"

            echo ""
            echo "pmcd command line:"
            sudo ps -p $(pgrep pmcd) -o pid,ppid,user,command 2>/dev/null || echo "Cannot get process details"

            echo ""
            echo "pmcd network connections:"
            sudo lsof -i -P | grep pmcd || echo "No network connections"

            echo ""
            echo "pmcd log (last 30 lines):"
            sudo tail -30 /var/log/pcp/pmcd/pmcd.log 2>/dev/null || echo "No pmcd.log"

            echo ""
            echo "launchd plist stdout/stderr:"
            sudo cat /var/log/pcp/pmcd/plist.stdout 2>/dev/null || echo "No plist.stdout"
            sudo cat /var/log/pcp/pmcd/plist.stderr 2>/dev/null || echo "No plist.stderr"

            exit 1
          fi

          echo ""
          echo "=== pmcd Service Verification ==="
          echo "pmcd process status:"
          pgrep pmcd && echo "✓ pmcd is running (PID: $(pgrep pmcd))" || echo "✗ pmcd failed to start"

          echo ""
          echo "pmcd command line:"
          sudo ps -p $(pgrep pmcd) -o pid,ppid,user,command || echo "Cannot get process details"

          echo ""
          echo "pmcd listening ports:"
          sudo lsof -i -P | grep pmcd || echo "No network connections found for pmcd"

          echo ""
          echo "Test localhost connectivity to pmcd port (44321):"
          nc -z localhost 44321 && echo "✓ Can connect to localhost:44321" || echo "✗ Cannot connect to localhost:44321"

          echo ""
          echo "Test 127.0.0.1 connectivity to pmcd port (44321):"
          nc -z 127.0.0.1 44321 && echo "✓ Can connect to 127.0.0.1:44321" || echo "✗ Cannot connect to 127.0.0.1:44321"
      - name: Run Darwin PMDA Integration Tests
        id: integration-tests
        if: success() && steps.wait-for-pmcd.conclusion == 'success'
        run: |
          echo "=== Python and pmrep debugging ==="
          echo "pmrep location:"
          which pmrep
          head -1 $(which pmrep)

          echo ""
          echo "Python versions available:"
          which python3 && python3 --version || echo "python3 not found"
          which python && python --version || echo "python not found"

          echo ""
          echo "Python sys.path for pmrep's Python:"
          $(head -1 $(which pmrep) | sed 's/#!//') -c "import sys; print('\n'.join(sys.path))"

          echo ""
          echo "Looking for pcp module:"
          find /usr/local -name "pcp.py" -o -name "pcp" -type d 2>/dev/null | grep -i python || echo "No pcp module found in /usr/local"
          cat python3-pcp.list || echo "Doesn't look like the Python3 installation bit triggered"

          echo ""
          echo "Check if pcp module is installed:"
          $(head -1 $(which pmrep) | sed 's/#!//') -c "import pcp; print('pcp module location:', pcp.__file__)" 2>&1 || echo "pcp module not importable"

          echo ""
          echo "Running Darwin PMDA integration tests..."
          cd build/mac/test/integration
          ./run-integration-tests.sh
      - name: Test pmstat with Darwin metrics
        if: success() && steps.integration-tests.conclusion == 'success'
        run: |
          echo "Testing pmstat output..."
          cd build/mac/test/integration
          ./test-pmstat.sh
      - name: Verify openmetrics PMDA enabled
        if: success() && steps.wait-for-pmcd.conclusion == 'success'
        run: |
          echo "Checking openmetrics PMDA status..."
          if pminfo openmetrics 2>/dev/null | head -5; then
            echo "openmetrics PMDA is active"
          else
            echo "WARNING: openmetrics PMDA not active (may need pmcd restart for .NeedInstall processing)"
            test -f /var/lib/pcp/pmdas/openmetrics/.NeedInstall && echo ".NeedInstall marker exists (pending)" || true
            test -f /var/lib/pcp/pmdas/openmetrics/.NeedInstall.failed && echo ".NeedInstall.failed exists (installation failed)" || true
            sudo grep -i "openmetrics\|NeedInstall\|pmda_setup" /var/log/pcp/pmcd/pmcd.log 2>/dev/null | tail -20 || true
          fi
      - name: Verify zeroconf pmlogconf configs installed
        if: success() && steps.install-test.conclusion == 'success'
        run: |
          echo "Checking for zeroconf pmlogconf configs..."
          if test -d /var/lib/pcp/config/pmlogconf/zeroconf; then
            echo "zeroconf configs installed:"
            ls /var/lib/pcp/config/pmlogconf/zeroconf/
          else
            echo "ERROR: zeroconf config directory not found"
            exit 1
          fi
      - name: Wait for pmproxy to start
        id: wait-for-pmproxy
        if: success() && steps.integration-tests.conclusion == 'success'
        run: |
          echo "=== Waiting for pmproxy service to start ==="
          echo "The installer should have started pmproxy via launchd..."

          TIMEOUT=60
          ELAPSED=0
          INTERVAL=3

          while [ $ELAPSED -lt $TIMEOUT ]; do
            echo "Checking pmproxy (${ELAPSED}s elapsed)..."

            # Check if pmproxy responds to ping
            if curl -s http://localhost:44322/series/ping 2>/dev/null | grep -q '"success":true'; then
              echo "✓ pmproxy is responding!"
              break
            fi

            sleep $INTERVAL
            ELAPSED=$((ELAPSED + INTERVAL))
          done

          echo ""
          echo "=== pmproxy log files debug ==="
          if [ -d /var/log/pcp/pmproxy ]; then
            echo "✓ pmproxy log directory exists"
            echo "Log directory contents:"
            ls -la /var/log/pcp/pmproxy/ 2>/dev/null || echo "Cannot list directory"

            echo ""
            for logfile in /var/log/pcp/pmproxy/*.log; do
              if [ -f "$logfile" ]; then
                echo "=== Contents of $logfile ==="
                sudo cat "$logfile" 2>/dev/null || echo "Cannot read $logfile"
                echo ""
              fi
            done
          else
            echo "✗ pmproxy log directory does not exist"
          fi

          if [ $ELAPSED -ge $TIMEOUT ]; then
            echo "✗ Timeout waiting for pmproxy"
            exit 1
          fi

          echo ""
          echo "=== pmproxy connectivity checks ==="
          nc -z localhost 44322 && echo "✓ Port 44322 open" || echo "✗ Port 44322 closed"

          echo ""
          echo "=== pmproxy process status ==="
          pgrep pmproxy && echo "✓ pmproxy running (PID: $(pgrep pmproxy))" || echo "✗ pmproxy not running"

          echo ""
          echo "pmproxy command line:"
          sudo ps -p $(pgrep pmproxy) -o pid,ppid,user,command 2>/dev/null || echo "Cannot get process details"

          echo ""
          echo "pmproxy listening ports:"
          sudo lsof -i -P | grep pmproxy || echo "No network connections found for pmproxy"
      - name: Debug on integration test failure
        if: failure() && (steps.integration-tests.conclusion == 'failure' || steps.wait-for-pmcd.conclusion == 'failure')
        run: |
          echo "Integration tests failed. Collecting diagnostics..."

          echo "=== PCP Configuration ==="
          pmconfig 2>&1 || echo "pmconfig failed"

          echo ""
          echo "=== pmcd.conf contents ==="
          cat /etc/pcp/pmcd/pmcd.conf 2>/dev/null || echo "pmcd.conf not found"

          echo ""
          echo "=== pmcd status ==="
          pgrep pmcd && echo "pmcd is running (PID: $(pgrep pmcd))" || echo "pmcd not running"

          echo ""
          echo "=== pmcd network connections ==="
          sudo lsof -i -P | grep pmcd || echo "No network connections for pmcd"

          echo ""
          echo "=== All listening ports ==="
          sudo lsof -i -P | grep LISTEN || echo "No listening ports found"

          echo ""
          echo "=== Connectivity tests ==="
          nc -z localhost 44321 && echo "✓ localhost:44321 is reachable" || echo "✗ localhost:44321 is NOT reachable"
          nc -z 127.0.0.1 44321 && echo "✓ 127.0.0.1:44321 is reachable" || echo "✗ 127.0.0.1:44321 is NOT reachable"

          echo ""
          echo "=== pmcd log (last 50 lines) ==="
          sudo tail -50 /var/log/pcp/pmcd/pmcd.log 2>/dev/null || echo "No pmcd log found"

          echo ""
          echo "=== darwin PMDA log (last 50 lines) ==="
          sudo tail -50 /var/log/pcp/pmcd/darwin.log 2>/dev/null || echo "No darwin PMDA log found"

          echo ""
          echo "=== darwin PMDA status ==="
          pminfo -f pmcd.agent.status 2>/dev/null | grep darwin || echo "Darwin PMDA not loaded"

          echo ""
          echo "=== Available PMDAs ==="
          ls -la /usr/local/lib/pcp/pmdas/ 2>/dev/null || ls -la /Library/PCP/pmdas/ 2>/dev/null || echo "PMDA directory not found"

          echo ""
          echo "=== Test simple metric with explicit localhost ==="
          pminfo -h localhost -f hinv.ncpu 2>&1 || echo "pminfo with localhost failed"

          echo ""
          echo "=== Test simple metric with explicit 127.0.0.1 ==="
          pminfo -h 127.0.0.1 -f hinv.ncpu 2>&1 || echo "pminfo with 127.0.0.1 failed"

          echo ""
          echo "=== Test simple metric with default host ==="
          pminfo -f hinv.ncpu 2>&1 || echo "pminfo with default host failed"

          echo ""
          echo "=== PCP environment variables ==="
          env | grep PCP || echo "No PCP env vars set"
      - name: Cleanup - Unmount DMG
        if: always()
        run: |
          # Unmount any mounted PCP volumes
          hdiutil detach /Volumes/pcp* 2>/dev/null || true
      # New steps for handling releases on version tags below
      - name: Check if version tag
        if: github.ref_type == 'tag'
        id: check_tag
        uses: actions-ecosystem/action-regex-match@v2
        with:
          text: ${{ github.ref_name }}
          regex: '^[0-9]+\.[0-9]+\.[0-9]+$'
          flags: g  # Global flag, but optional if just checking match
      - name: Generate Github Summary - version tag detected
        if: steps.check_tag.outputs.match != ''
        run: |
          echo "RELEASE DETECTED!" >> $GITHUB_STEP_SUMMARY
      - name: Generate Github Summary - no version tag
        if: steps.check_tag.outputs.match == ''
        run: |
          echo "Not a Release!" >> $GITHUB_STEP_SUMMARY
      - name: Release
        uses: softprops/action-gh-release@v2
        if: steps.check_tag.outputs.match != ''
        with:
          files: |
              pcp-**/build/mac/pcp-*.dmg