github.com/kubevela/workflow@v0.6.0/.github/workflows/unit-test.yaml (about)

     1  name: Unit-Test
     2  
     3  on:
     4    push:
     5      branches:
     6        - main
     7        - release-*
     8    workflow_dispatch: {}
     9    pull_request:
    10      branches:
    11        - main
    12        - release-*
    13  
    14  env:
    15    # Common versions
    16    GO_VERSION: '1.19'
    17    GOLANGCI_VERSION: 'v1.49'
    18    KIND_VERSION: 'v0.7.0'
    19  
    20  jobs:
    21  
    22    detect-noop:
    23      runs-on: ubuntu-20.04
    24      outputs:
    25        noop: ${{ steps.noop.outputs.should_skip }}
    26      steps:
    27        - name: Detect No-op Changes
    28          id: noop
    29          uses: fkirc/skip-duplicate-actions@v5.3.0
    30          with:
    31            github_token: ${{ secrets.GITHUB_TOKEN }}
    32            paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
    33            do_not_skip: '["workflow_dispatch", "schedule", "push"]'
    34            concurrent_skipping: false
    35  
    36    unit-tests:
    37      runs-on: ubuntu-20.04
    38      needs: detect-noop
    39      if: needs.detect-noop.outputs.noop != 'true'
    40  
    41      steps:
    42        - name: Set up Go
    43          uses: actions/setup-go@v1
    44          with:
    45            go-version: ${{ env.GO_VERSION }}
    46          id: go
    47  
    48        - name: Check out code into the Go module directory
    49          uses: actions/checkout@v2
    50          with:
    51            submodules: true
    52  
    53        - name: Cache Go Dependencies
    54          uses: actions/cache@v2
    55          with:
    56            path: .work/pkg
    57            key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
    58            restore-keys: ${{ runner.os }}-pkg-
    59  
    60        - name: Install ginkgo
    61          run: |
    62            sudo apt-get install -y golang-ginkgo-dev
    63  
    64        - name: install Kubebuilder
    65          uses: RyanSiu1995/kubebuilder-action@v1.2
    66          with:
    67            version: 3.1.0
    68            kubebuilderOnly: false
    69            kubernetesVersion: v1.21.2
    70  
    71        - name: Run Make test
    72          run: make test
    73  
    74        - name: Upload coverage report
    75          uses: codecov/codecov-action@v1
    76          with:
    77            token: ${{ secrets.CODECOV_TOKEN }}
    78            file: ./coverage.txt
    79            flags: unit-test
    80            name: codecov-umbrella