github.com/kubeshop/testkube@v1.17.23/.github/workflows/test.yaml (about)

     1  name: Code build and checks
     2  
     3  on:
     4    push:
     5      branches: [main, develop]
     6      paths-ignore: "docs/**"
     7    pull_request:
     8      paths-ignore: "docs/**"
     9      branches: [main, develop]
    10  
    11  jobs:
    12    unit-tests:
    13      name: Unit Tests
    14      runs-on: ubuntu-latest
    15  
    16      steps:
    17        - uses: actions/checkout@v3
    18  
    19        # setup-go@v4 handles Go cache by default
    20        - name: Set up Go
    21          uses: actions/setup-go@v4
    22          with:
    23            go-version: 1.21
    24  
    25        - name: Setup gotestsum
    26          run: go install gotest.tools/gotestsum@latest
    27  
    28        - name: Unit Test
    29          id: unit_test
    30          run: gotestsum --format pkgname --junitfile unit-tests.xml --jsonfile unit-tests.json -- -coverprofile=coverage.out -covermode=atomic ./...
    31  
    32        - name: Unit Test Summary
    33          if: always()
    34          uses: test-summary/action@v2
    35          with:
    36            paths: |
    37              unit-tests.xml
    38  
    39        - name: Annotate Unit Tests
    40          if: always()
    41          uses: guyarb/golang-test-annotations@v0.6.0
    42          with:
    43            test-results: unit-tests.json
    44  
    45        - name: Upload code coverage artifact
    46          if: always()
    47          uses: actions/upload-artifact@v3
    48          with:
    49            name: unit-test-coverage
    50            path: coverage.out
    51            if-no-files-found: error
    52            retention-days: 1
    53  
    54        - name: Send coverage report to Codecov
    55          if: always()
    56          uses: codecov/codecov-action@v3
    57          with:
    58            file: ./coverage.out
    59            flags: unittests
    60            name: codecov-testkube-unit-tests
    61            verbose: true
    62  
    63    integration-tests:
    64      name: Integration Tests
    65      runs-on: ubuntu-latest
    66  
    67      services:
    68        mongo:
    69          image: bitnami/mongodb
    70          ports:
    71            - 27017:27017
    72        nats:
    73          image: bitnami/nats
    74          ports:
    75            - 4222:4222
    76            - 6222:6222
    77            - 8222:8222
    78        minio:
    79          image: bitnami/minio
    80          ports:
    81            - 9000:9000
    82            - 9001:9001
    83          env:
    84            MINIO_ROOT_USER: minio99
    85            MINIO_ROOT_PASSWORD: minio123
    86  
    87      steps:
    88        - uses: actions/checkout@v3
    89  
    90        # setup-go@v4 handles Go cache by default
    91        - name: Set up Go
    92          uses: actions/setup-go@v4
    93          with:
    94            go-version: 1.21
    95  
    96        - name: Set up Java@11
    97          uses: actions/setup-java@v3
    98          with:
    99            distribution: "adopt"
   100            java-version: "11"
   101  
   102        - name: Install node@19
   103          uses: actions/setup-node@v3
   104          with:
   105            node-version: 19
   106  
   107        - name: Install pnpm@8.1
   108          uses: pnpm/action-setup@v2
   109          with:
   110            version: 8.1.0
   111  
   112        - name: Install Artillery@2.0
   113          run: npm install -g artillery@2.0.0-31
   114  
   115        - name: Install kubepug@1.7.1
   116          uses: cpanato/kubepug-installer@v1.2.0
   117          with:
   118            kubepug-release: "1.7.1"
   119  
   120        - name: Install k6
   121          run: |
   122            sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
   123            echo "deb https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
   124            sudo apt-get update
   125            sudo apt-get install k6
   126  
   127        - name: Set up JMeter@5.6.3
   128          run: |
   129            wget https://downloads.apache.org//jmeter/binaries/apache-jmeter-5.6.3.zip
   130            unzip apache-jmeter-5.6.3.zip
   131            mv apache-jmeter-5.6.3 jmeter
   132            sudo mv jmeter /opt
   133            echo "/opt/jmeter/bin" >> $GITHUB_PATH
   134  
   135        - name: Set up Newman@5.3
   136          run: |
   137            npm install -g newman@5.3.2
   138  
   139        - name: Install Ginkgo@2.9
   140          run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.9.2
   141  
   142        - name: Set up gotestsum@v1.9
   143          run: go install gotest.tools/gotestsum@v1.9.0
   144  
   145        - name: Set up Playwright
   146          run: pnpx playwright install --with-deps
   147  
   148        - name: Set up Tracetest
   149          run: curl -L https://raw.githubusercontent.com/kubeshop/tracetest/main/install-cli.sh | bash
   150  
   151        - name: Set up git
   152          run: sudo apt-get install -y git
   153  
   154        - name: Integration Tests
   155          run: INTEGRATION=y gotestsum --format pkgname --junitfile integration-tests.xml --jsonfile integration-tests.json -- -run _Integration -coverprofile=coverage.out -covermode=atomic ./...
   156  
   157        - name: Integration Test Summary
   158          if: always()
   159          uses: test-summary/action@v2
   160          with:
   161            paths: |
   162              integration-tests.xml
   163  
   164        - name: Annotate Integration Tests
   165          if: always()
   166          uses: guyarb/golang-test-annotations@v0.6.0
   167          with:
   168            test-results: integration-tests.json
   169  
   170        - name: Upload code coverage artifact
   171          if: always()
   172          uses: actions/upload-artifact@v3
   173          with:
   174            name: integration-test-coverage
   175            path: coverage.out
   176            if-no-files-found: error
   177            retention-days: 1
   178  
   179        - name: Send coverage report to Codecov
   180          if: always()
   181          uses: codecov/codecov-action@v3
   182          with:
   183            file: ./coverage.out
   184            flags: integrationtests
   185            name: codecov-testkube-integration-tests
   186            verbose: true