github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/.github/workflows/cypress-tests.yml (about)

     1  name: Cypress Tests
     2  
     3  on:
     4    push:
     5      branches: [main]
     6    pull_request:
     7      branches: [main]
     8  
     9  jobs:
    10    cypress-tests:
    11      runs-on: ubuntu-latest
    12      env:
    13        ENABLED_SPIES: none
    14      steps:
    15        - name: Checkout
    16          uses: actions/checkout@v2
    17        - uses: actions/setup-node@v2
    18          with:
    19            node-version: '16.18'
    20        - uses: actions/setup-go@v2
    21          with:
    22            go-version: '^1.19.0'
    23        - name: Cache go mod directories
    24          uses: actions/cache@v2
    25          with:
    26            path: ~/go/pkg/mod
    27            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    28            restore-keys: |
    29              ${{ runner.os }}-go-
    30        - name: Get yarn cache directory path
    31          id: yarn-cache-dir-path
    32          run: echo "::set-output name=dir::$(yarn cache dir)"
    33        - uses: actions/cache@v2
    34          id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
    35          with:
    36            path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
    37            key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
    38            restore-keys: |
    39              ${{ runner.os }}-yarn
    40        - run: yarn install --frozen-lockfile
    41        - run: make --version
    42        - run: make -j e2e-build
    43        - name: Cypress run
    44          uses: cypress-io/github-action@v4
    45          with:
    46            wait-on: http://localhost:4040
    47            start: make server
    48            config-file: cypress/cypress.json
    49          env:
    50            # keep the server quiet
    51            PYROSCOPE_LOG_LEVEL: error
    52            ENABLED_SPIES: none
    53        - uses: actions/upload-artifact@v2
    54          if: always()
    55          with:
    56            name: cypress-screenshots
    57            path: cypress/screenshots
    58  
    59    cypress-tests-auth:
    60      runs-on: ubuntu-latest
    61      env:
    62        ENABLED_SPIES: none
    63      steps:
    64        - name: Checkout
    65          uses: actions/checkout@v2
    66        - uses: actions/setup-go@v2
    67          with:
    68            go-version: '^1.19.0'
    69        - uses: actions/setup-node@v2
    70          with:
    71            node-version: '16.18'
    72        - name: Cache go mod directories
    73          uses: actions/cache@v2
    74          with:
    75            path: ~/go/pkg/mod
    76            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    77            restore-keys: |
    78              ${{ runner.os }}-go-
    79        - name: Get yarn cache directory path
    80          id: yarn-cache-dir-path
    81          run: echo "::set-output name=dir::$(yarn cache dir)"
    82  
    83        - uses: actions/cache@v2
    84          id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
    85          with:
    86            path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
    87            key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
    88            restore-keys: |
    89              ${{ runner.os }}-yarn
    90        - run: yarn install --frozen-lockfile
    91        - run: make -j e2e-build
    92        - name: Cypress run
    93          uses: cypress-io/github-action@v4
    94          with:
    95            wait-on: http://localhost:4040
    96            start: |
    97              node ./scripts/oauth-mock/oauth-mock.js
    98              make server SERVERPARAMS=--config=scripts/oauth-mock/pyroscope-config.yml
    99            config-file: cypress/integration/auth/cypress.json
   100          env:
   101            # keep the server quiet
   102            PYROSCOPE_LOG_LEVEL: error
   103            ENABLED_SPIES: none
   104        - uses: actions/upload-artifact@v2
   105          if: always()
   106          with:
   107            name: cypress-screenshots
   108            path: cypress/screenshots
   109  
   110    cypress-tests-base-url:
   111      runs-on: ubuntu-latest
   112      env:
   113        ENABLED_SPIES: none
   114      steps:
   115        - name: Checkout
   116          uses: actions/checkout@v2
   117        - uses: actions/setup-go@v2
   118          with:
   119            go-version: '^1.19.0'
   120        - uses: actions/setup-node@v2
   121          with:
   122            node-version: '16.18'
   123        - name: Cache go mod directories
   124          uses: actions/cache@v2
   125          with:
   126            path: ~/go/pkg/mod
   127            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
   128            restore-keys: |
   129              ${{ runner.os }}-go-
   130        - name: Get yarn cache directory path
   131          id: yarn-cache-dir-path
   132          run: echo "::set-output name=dir::$(yarn cache dir)"
   133  
   134        - uses: actions/cache@v2
   135          id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
   136          with:
   137            path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
   138            key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
   139            restore-keys: |
   140              ${{ runner.os }}-yarn
   141        - run: yarn install --frozen-lockfile
   142        - run: make -j e2e-build
   143        - name: run nginx with /pyroscope
   144          run: docker-compose -f cypress/base-url/base-url-docker-compose.yml up -d
   145        - name: Cypress run
   146          uses: cypress-io/github-action@v2
   147          with:
   148            wait-on: http://localhost:8080/pyroscope
   149            start: make server
   150            config-file: cypress/base-url/cypress.json
   151          env:
   152            # keep the server quiet
   153            PYROSCOPE_BASE_URL: 'http://localhost:8080/pyroscope'
   154            PYROSCOPE_LOG_LEVEL: error
   155        - uses: actions/upload-artifact@v2
   156          if: always()
   157          with:
   158            name: cypress-screenshots
   159            path: cypress/screenshots
   160  
   161    # Test auth when baseUrl is set
   162    # We run the same tests from auth
   163    # But with a different CYPRESS_BASE_URL
   164    cypress-tests-base-url-auth:
   165      runs-on: ubuntu-latest
   166      env:
   167        ENABLED_SPIES: none
   168      steps:
   169        - name: Checkout
   170          uses: actions/checkout@v2
   171        - uses: actions/setup-go@v2
   172          with:
   173            go-version: '^1.19.0'
   174        - uses: actions/setup-node@v2
   175          with:
   176            node-version: '16.18'
   177        - name: Cache go mod directories
   178          uses: actions/cache@v2
   179          with:
   180            path: ~/go/pkg/mod
   181            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
   182            restore-keys: |
   183              ${{ runner.os }}-go-
   184        - name: Get yarn cache directory path
   185          id: yarn-cache-dir-path
   186          run: echo "::set-output name=dir::$(yarn cache dir)"
   187  
   188        - uses: actions/cache@v2
   189          id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
   190          with:
   191            path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
   192            key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
   193            restore-keys: |
   194              ${{ runner.os }}-yarn
   195        - run: yarn install --frozen-lockfile
   196        - run: make -j e2e-build
   197        - name: run nginx with /pyroscope
   198          run: docker-compose -f cypress/base-url/base-url-docker-compose.yml up -d
   199        - name: Cypress run
   200          uses: cypress-io/github-action@v2
   201          with:
   202            wait-on: http://localhost:8080/pyroscope
   203            start: |
   204              node ./scripts/oauth-mock/oauth-mock.js
   205              make server SERVERPARAMS=--config=scripts/oauth-mock/pyroscope-config-base-url.yml
   206            config-file: cypress/integration/auth/cypress.json
   207          env:
   208            PYROSCOPE_BASE_URL: 'http://localhost:8080/pyroscope'
   209            PYROSCOPE_LOG_LEVEL: error
   210            CYPRESS_BASE_URL: 'http://localhost:8080/pyroscope'
   211        - uses: actions/upload-artifact@v2
   212          if: always()
   213          with:
   214            name: cypress-screenshots
   215            path: cypress/screenshots