github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/.github/workflows/ci-profiling.yaml (about)

     1  name: CI Profiling
     2  
     3  on:
     4    push:
     5      branches: [main]
     6    pull_request:
     7      branches: [main]
     8  
     9  jobs:
    10    check:
    11      runs-on: ubuntu-latest
    12      outputs:
    13        inputsChecked: ${{ steps.pyroscope_cloud_token_gate.outputs.inputsChecked }}
    14      steps:
    15        - uses: svrooij/secret-gate-action@v1
    16          id: pyroscope_cloud_token_gate
    17          with:
    18            inputsToCheck: 'token'
    19          env:
    20            token: ${{ secrets.PYROSCOPE_CLOUD_TOKEN }}
    21    go-tests:
    22      runs-on: ubuntu-latest
    23      # skip if user has not access to the token
    24      if: needs.check.outputs.inputsChecked == 'true'
    25      needs: check
    26      steps:
    27        - name: Checkout
    28          uses: actions/checkout@v2
    29        - uses: actions/setup-go@v2
    30          with:
    31            go-version: '^1.18.0'
    32        - name: Cache go mod directories
    33          uses: actions/cache@v2
    34          with:
    35            path: ~/go/pkg/mod
    36            key: go-${{ hashFiles('**/go.sum') }}
    37            restore-keys: |
    38              ${{ runner.os }}-go-
    39        - name: Install go-task
    40          uses: jaxxstorm/action-install-gh-release@v1.5.0
    41          with:
    42            repo: pyroscope-io/ci
    43            tag: latest
    44          env:
    45            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    46        - name: install
    47          run: pyroscope-ci go install --applicationName=pyroscope-oss pkg/
    48        - name: uninstall from gospy since profiler is already running
    49          run: rm pkg/agent/gospy/pyroscope_test.go
    50        - name: Run Go tests and upload
    51          run: pyroscope-ci exec --exportLocally --apiKey=${{ secrets.PYROSCOPE_CLOUD_TOKEN }} make test
    52        - uses: pyroscope-io/flamegraph.com-github-action@main
    53          with:
    54            file: pyroscope-ci-output/*
    55            postInPR: true
    56            token: ${{ github.token }}
    57            id: go-tests
    58    js-tests:
    59      runs-on: ubuntu-latest
    60      # skip if user has not access to the token
    61      if: needs.check.outputs.inputsChecked == 'true'
    62      needs: check
    63      steps:
    64        - name: Checkout
    65          uses: actions/checkout@v2
    66        - uses: actions/setup-node@v2
    67          with:
    68            node-version: '16.18'
    69        - name: Get yarn cache directory path
    70          id: yarn-cache-dir-path
    71          run: echo "::set-output name=dir::$(yarn cache dir)"
    72  
    73        - uses: actions/cache@v2
    74          id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
    75          with:
    76            path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
    77            key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
    78            restore-keys: |
    79              ${{ runner.os }}-yarn
    80        - name: Install go-task
    81          uses: jaxxstorm/action-install-gh-release@v1.5.0
    82          with:
    83            repo: pyroscope-io/ci
    84            tag: latest
    85          env:
    86            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    87        - name: Install Webapp dependencies
    88          run: yarn install --frozen-lockfile
    89        - name: Run tests and upload
    90          run: pyroscope-ci exec --apiKey=${{ secrets.PYROSCOPE_CLOUD_TOKEN }} --exportLocally yarn test --no-cache --max-workers=1
    91        - uses: pyroscope-io/flamegraph.com-github-action@main
    92          with:
    93            file: pyroscope-ci-output/*
    94            postInPR: true
    95            token: ${{ github.token }}