github.com/oam-dev/cluster-gateway@v1.9.0/.github/workflows/ci.yaml (about)

     1  name: Go
     2  
     3  on:
     4    push:
     5      branches:
     6        - master
     7    workflow_dispatch: {}
     8    pull_request:
     9      branches:
    10        - master
    11  
    12  env:
    13    # Common versions
    14    GO_VERSION: '1.20'
    15    GOLANGCI_VERSION: 'v1.49'
    16    KIND_VERSION: 'v0.19.0'
    17  
    18  jobs:
    19  
    20    detect-noop:
    21      runs-on: ubuntu-22.04
    22      outputs:
    23        noop: ${{ steps.noop.outputs.should_skip }}
    24      steps:
    25        - name: Detect No-op Changes
    26          id: noop
    27          uses: fkirc/skip-duplicate-actions@v3.3.0
    28          with:
    29            github_token: ${{ secrets.GITHUB_TOKEN }}
    30            paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
    31            do_not_skip: '["workflow_dispatch", "schedule", "push"]'
    32            concurrent_skipping: false
    33  
    34    test:
    35      runs-on: ubuntu-22.04
    36      needs: detect-noop
    37      if: needs.detect-noop.outputs.noop != 'true'
    38      steps:
    39        - name: Set up Go
    40          uses: actions/setup-go@v1
    41          with:
    42            go-version: ${{ env.GO_VERSION }}
    43          id: go
    44        - name: Checkout
    45          uses: actions/checkout@v2
    46          with:
    47            submodules: true
    48        - name: Cache Go Dependencies
    49          uses: actions/cache@v2
    50          with:
    51            path: .work/pkg
    52            key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
    53            restore-keys: ${{ runner.os }}-pkg-
    54        - name: install Kubebuilder
    55          uses: RyanSiu1995/kubebuilder-action@v1.2
    56          with:
    57            version: 3.1.0
    58            kubebuilderOnly: false
    59            kubernetesVersion: v1.22.0
    60        - name: Run Make test
    61          run: make test
    62        - name: Upload coverage report
    63          uses: codecov/codecov-action@v3
    64          with:
    65            token: ${{ secrets.CODECOV_TOKEN }}
    66            file: cover.out
    67            flags: unit-test
    68            name: codecov-umbrella
    69            fail_ci_if_error: true
    70            verbose: true
    71        - name: Run Make
    72          run: make
    73  
    74    e2e-cluster-gateway:
    75      runs-on: ubuntu-22.04
    76      needs: detect-noop
    77      if: needs.detect-noop.outputs.noop != 'true'
    78      steps:
    79        - name: Set up Go
    80          uses: actions/setup-go@v1
    81          with:
    82            go-version: ${{ env.GO_VERSION }}
    83          id: go
    84        - name: Checkout
    85          uses: actions/checkout@v2
    86          with:
    87            submodules: true
    88        - name: Cache Go Dependencies
    89          uses: actions/cache@v2
    90          with:
    91            path: .work/pkg
    92            key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
    93            restore-keys: ${{ runner.os }}-pkg-
    94        - name: Create k8s Kind Cluster
    95          uses: helm/kind-action@v1.2.0
    96        - name: Build Image
    97          run: |
    98            make image
    99            kind load docker-image oamdev/cluster-gateway:latest --name chart-testing
   100        - name: Prepare ClusterGateway E2E Environment
   101          run: |
   102            helm install --create-namespace -n vela-system \
   103              cluster-gateway ./charts/cluster-gateway \
   104              --set featureGate.healthiness=true \
   105              --set featureGate.secretCache=true \
   106              --set tag=latest
   107            kubectl wait --for=condition=Available apiservice/v1alpha1.cluster.core.oam.dev
   108            go run ./e2e/env/prepare | kubectl apply -f -
   109        - name: Run Make test
   110          run: |
   111            kubectl get clustergateway
   112            make test-e2e
   113  
   114    e2e-ocm-addon-cluster-gateway:
   115      runs-on: ubuntu-22.04
   116      needs: detect-noop
   117      if: needs.detect-noop.outputs.noop != 'true'
   118      steps:
   119        - name: Set up Go
   120          uses: actions/setup-go@v1
   121          with:
   122            go-version: ${{ env.GO_VERSION }}
   123          id: go
   124        - name: Checkout
   125          uses: actions/checkout@v2
   126          with:
   127            submodules: true
   128        - name: Cache Go Dependencies
   129          uses: actions/cache@v2
   130          with:
   131            path: .work/pkg
   132            key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
   133            restore-keys: ${{ runner.os }}-pkg-
   134        - name: Install clusteradm
   135          run: curl -L https://raw.githubusercontent.com/open-cluster-management-io/clusteradm/main/install.sh | bash
   136        - name: Create k8s Kind Cluster
   137          uses: helm/kind-action@v1.2.0
   138        - name: Prepare OCM testing environment
   139          run: |
   140            clusteradm init --output-join-command-file join.sh --wait
   141            sh -c "$(cat join.sh) loopback --force-internal-endpoint-lookup"
   142            clusteradm accept --clusters loopback --wait 30
   143            kubectl wait --for=condition=ManagedClusterConditionAvailable managedcluster/loopback
   144        - name: Build image
   145          run: |
   146            make image
   147            kind load docker-image oamdev/cluster-gateway:latest  --name chart-testing
   148            kind load docker-image oamdev/cluster-gateway-addon-manager:latest  --name chart-testing
   149        - name: Install latest cluster-gateway
   150          run: |
   151            helm install --create-namespace -n open-cluster-management-addon \
   152              cluster-gateway ./charts/addon-manager \
   153              --set tag=latest
   154            go run ./e2e/env/prepare | kubectl apply -f -
   155        - name: Run e2e test
   156          run: |
   157            make test-e2e-ocm