/ .github / workflows / execd-test.yml
execd-test.yml
  1  name: Execd Tests
  2  
  3  on:
  4    pull_request:
  5      branches: [ main ]
  6      paths:
  7        - 'components/execd/**'
  8        - 'components/internal/**'
  9  
 10  permissions:
 11    contents: read
 12  
 13  concurrency:
 14    group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
 15    cancel-in-progress: true
 16  
 17  jobs:
 18    test:
 19      runs-on: ubuntu-latest
 20      steps:
 21        - name: Checkout code
 22          uses: actions/checkout@v6
 23  
 24        - name: Set up Go
 25          uses: actions/setup-go@v6
 26          with:
 27            go-version: '1.24.0'
 28  
 29        - name: Run golint
 30          run: |
 31            cd components/execd
 32            make golint
 33  
 34        - name: Build (Multi platform compile)
 35          run: |
 36            cd components/execd
 37            #
 38            make multi-build
 39  
 40        - name: Run tests with coverage
 41          run: |
 42            cd components/execd
 43            go test -v -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./pkg/...
 44  
 45        - name: Calculate coverage and generate summary
 46          id: coverage
 47          run: |
 48            cd components/execd
 49            # Extract total coverage percentage
 50            TOTAL_COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}')
 51            echo "total_coverage=$TOTAL_COVERAGE" >> $GITHUB_OUTPUT
 52            
 53            # Generate GitHub Actions job summary
 54            echo "## 📊 execd Test Coverage Report" >> $GITHUB_STEP_SUMMARY
 55            echo "" >> $GITHUB_STEP_SUMMARY
 56            echo "**Total Line Coverage:** $TOTAL_COVERAGE" >> $GITHUB_STEP_SUMMARY
 57            echo "" >> $GITHUB_STEP_SUMMARY
 58            echo "Coverage report generated for commit \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
 59            echo "" >> $GITHUB_STEP_SUMMARY
 60            echo "---" >> $GITHUB_STEP_SUMMARY
 61            echo "*Coverage targets: Core packages >80%, API layer >70%*" >> $GITHUB_STEP_SUMMARY
 62  
 63    smoke:
 64      strategy:
 65        fail-fast: false
 66        matrix:
 67          os: [ubuntu-latest, windows-latest]
 68      runs-on: ${{ matrix.os }}
 69      defaults:
 70        run:
 71          shell: bash
 72      steps:
 73        - name: Checkout code
 74          uses: actions/checkout@v6
 75  
 76        - name: Set up Go
 77          uses: actions/setup-go@v6
 78          with:
 79            go-version: '1.24.0'
 80  
 81        - name: Set up Python
 82          uses: actions/setup-python@v6
 83          with:
 84            python-version: '3.10'
 85  
 86        - name: Install make (Windows)
 87          if: matrix.os == 'windows-latest'
 88          shell: powershell
 89          run: choco install make -y
 90  
 91        - name: Build
 92          run: |
 93            cd components/execd
 94            make build
 95  
 96        - name: Run smoke test
 97          run: |
 98            cd components/execd
 99            chmod +x tests/smoke.sh
100            ./tests/smoke.sh
101  
102            sleep 5
103            python3 tests/smoke_api.py
104        - name: Show logs
105          if: always()
106          run: |
107            set -x
108            cat components/execd/startup.log || true
109            cat components/execd/execd.log || true