sigs.k8s.io/kubebuilder/v3@v3.14.0/.github/workflows/unit-tests.yml (about) 1 name: Unit tests 2 3 # Trigger the workflow on pull requests and direct pushes to any branch 4 on: 5 push: 6 pull_request: 7 8 jobs: 9 test: 10 name: ${{ matrix.os }} 11 runs-on: ${{ matrix.os }} 12 strategy: 13 matrix: 14 os: 15 - ubuntu-latest 16 - macos-latest 17 # Pull requests from the same repository won't trigger this checks as they were already triggered by the push 18 if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) 19 steps: 20 - name: Clone the code 21 uses: actions/checkout@v4 22 - name: Setup Go 23 uses: actions/setup-go@v5 24 with: 25 go-version: '~1.21' 26 # This step is needed as the following one tries to remove 27 # kustomize for each test but has no permission to do so 28 - name: Remove pre-installed kustomize 29 run: sudo rm -f /usr/local/bin/kustomize 30 - name: Perform the test 31 run: make test 32 - name: Report failure 33 uses: nashmaniac/create-issue-action@v1.2 34 # Only report failures of pushes (PRs have are visible through the Checks section) to the default branch 35 if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master' 36 with: 37 title: 🐛 Unit tests failed on ${{ matrix.os }} for ${{ github.sha }} 38 token: ${{ secrets.GITHUB_TOKEN }} 39 labels: kind/bug 40 body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} 41 42 coverage: 43 name: Code coverage 44 needs: 45 - test 46 runs-on: ubuntu-latest 47 # Pull requests from the same repository won't trigger this checks as they were already triggered by the push 48 if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) 49 steps: 50 - name: Clone the code 51 uses: actions/checkout@v4 52 - name: Setup Go 53 uses: actions/setup-go@v5 54 with: 55 go-version: "1.21" 56 - name: Generate the coverage output 57 run: make test-coverage 58 - name: Send the coverage output 59 uses: shogo82148/actions-goveralls@v1 60 with: 61 path-to-profile: coverage-all.out