github.com/kubevela/workflow@v0.6.0/.github/workflows/e2e.yaml (about)

     1  name: E2E Test
     2  
     3  on:
     4    push:
     5      branches:
     6        - main
     7        - release-*
     8      tags:
     9        - v*
    10    workflow_dispatch: {}
    11    pull_request:
    12      branches:
    13        - main
    14        - release-*
    15  
    16  env:
    17    # Common versions
    18    GO_VERSION: '1.19'
    19    GOLANGCI_VERSION: 'v1.49'
    20    K3D_IMAGE_VERSION: '[\"v1.26\"]'
    21    K3D_IMAGE_VERSIONS: '[\"v1.26\"]'
    22  
    23  jobs:
    24  
    25    detect-noop:
    26      runs-on: ubuntu-20.04
    27      outputs:
    28        noop: ${{ steps.noop.outputs.should_skip }}
    29      steps:
    30        - name: Detect No-op Changes
    31          id: noop
    32          uses: fkirc/skip-duplicate-actions@v5.3.0
    33          with:
    34            github_token: ${{ secrets.GITHUB_TOKEN }}
    35            paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
    36            do_not_skip: '["workflow_dispatch", "schedule", "push"]'
    37            concurrent_skipping: false
    38  
    39    set-k8s-matrix:
    40      runs-on: ubuntu-22.04
    41      outputs:
    42        matrix: ${{ steps.set-k8s-matrix.outputs.matrix }}
    43      steps:
    44        - id: set-k8s-matrix
    45          run: |
    46            if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
    47              echo "pushing tag: ${{ github.ref_name }}"
    48              echo "::set-output name=matrix::${{ env.K3D_IMAGE_VERSIONS }}"
    49            else
    50              echo "::set-output name=matrix::${{ env.K3D_IMAGE_VERSION }}"
    51            fi
    52  
    53    e2e-tests:
    54      runs-on: ubuntu-22.04
    55      needs: [ detect-noop,set-k8s-matrix ]
    56      if: needs.detect-noop.outputs.noop != 'true'
    57      strategy:
    58        matrix:
    59          k8s-version: ${{ fromJson(needs.set-k8s-matrix.outputs.matrix) }}
    60      concurrency:
    61        group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k8s-version }}
    62        cancel-in-progress: true
    63  
    64  
    65      steps:
    66        - name: Check out code into the Go module directory
    67          uses: actions/checkout@v2
    68  
    69        - name: Setup Go
    70          uses: actions/setup-go@v2
    71          with:
    72            go-version: ${{ env.GO_VERSION }}
    73  
    74        - name: Get dependencies
    75          run: |
    76            go get -v -t -d ./...
    77  
    78        - name: Tear down K3d if exist
    79          run: |
    80            k3d cluster delete || true
    81            k3d cluster delete worker || true
    82  
    83        - name: Calculate K3d args
    84          run: |
    85            EGRESS_ARG=""
    86            if [[ "${{ matrix.k8s-version }}" == v1.26 ]]; then
    87              EGRESS_ARG="--k3s-arg --egress-selector-mode=disabled@server:0"
    88            fi
    89            echo "EGRESS_ARG=${EGRESS_ARG}" >> $GITHUB_ENV 
    90  
    91        - name: Setup K3d
    92          uses: nolar/setup-k3d-k3s@v1.0.8
    93          with:
    94            version: ${{ matrix.k8s-version }}
    95            github-token: ${{ secrets.GITHUB_TOKEN }}
    96            k3d-args: ${{ env.EGRESS_ARG }}
    97  
    98        - name: Load image to k3d cluster
    99          run: make image-load
   100  
   101        - name: Prepare for e2e tests
   102          run: |
   103            make e2e-setup-controller-pre-hook
   104            make e2e-setup-controller
   105  
   106        - name: Run e2e tests
   107          run: make e2e-test
   108  
   109        - name: Stop controller, get profile
   110          run: make end-e2e
   111  
   112        - name: Upload coverage report
   113          uses: codecov/codecov-action@v1
   114          with:
   115            token: ${{ secrets.CODECOV_TOKEN }}
   116            files: /tmp/e2e-profile.out
   117            flags: e2etests
   118            name: codecov-umbrella
   119  
   120        - name: Clean e2e profile
   121          run: rm /tmp/e2e-profile.out