vitess.io/vitess@v0.16.2/.github/workflows/vtadmin_web_unit_tests.yml (about)

     1  name: vtadmin-web unit tests
     2  
     3  # In specifying the 'paths' property, we need to include the path to this workflow .yml file. 
     4  # See https://github.community/t/trigger-a-workflow-on-change-to-the-yml-file-itself/17792/4)
     5  on:
     6    push:
     7      paths:
     8        - '.github/workflows/vtadmin_web_unit_tests.yml'
     9        - 'web/vtadmin/**'
    10    pull_request:
    11      paths:
    12        - '.github/workflows/vtadmin_web_unit_tests.yml'
    13        - 'web/vtadmin/**'
    14  
    15  jobs:
    16    unit-tests:
    17      runs-on: ubuntu-22.04
    18      steps:
    19        - name: Skip CI
    20          run: |
    21            if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then
    22              echo "skipping CI due to the 'Skip CI' label"
    23              exit 1
    24            fi
    25  
    26        - name: Check if workflow needs to be skipped
    27          id: skip-workflow
    28          run: |
    29            skip='false'
    30            if [[ "${{github.event.pull_request}}" ==  "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
    31            skip='true'
    32            fi
    33            echo Skip ${skip}
    34            echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT
    35  
    36        - uses: actions/checkout@v3
    37          if: steps.skip-workflow.outputs.skip-workflow == 'false'
    38  
    39        - uses: actions/setup-node@v3
    40          if: steps.skip-workflow.outputs.skip-workflow == 'false'
    41          with:
    42            # node-version should match package.json
    43            node-version: '16.19.0'
    44  
    45        - name: Install dependencies
    46          if: steps.skip-workflow.outputs.skip-workflow == 'false'
    47          run: cd ./web/vtadmin && npm ci
    48  
    49        - name: Run unit tests
    50          if: steps.skip-workflow.outputs.skip-workflow == 'false'
    51          run: cd ./web/vtadmin && CI=true npm run test
    52          
    53      # Cancel pending and in-progress runs of this workflow if a newer ref is pushed to CI.
    54      concurrency: 
    55        group: ${{ github.workflow }}-${{ github.ref }}
    56        cancel-in-progress: true