github.com/minio/console@v1.3.0/web-app/playwright/jobs.yaml (about)

     1  name: Workflow
     2  
     3  on:
     4    pull_request:
     5      branches:
     6        - master
     7    push:
     8      branches:
     9        - master
    10  
    11  # This ensures that previous jobs for the PR are canceled when the PR is
    12  # updated.
    13  concurrency:
    14    group: ${{ github.workflow }}-${{ github.head_ref }}
    15    cancel-in-progress: true
    16  
    17  jobs:
    18    lint-job:
    19      name: Checking Lint
    20      runs-on: [ubuntu-latest]
    21      strategy:
    22        matrix:
    23          go-version: [1.20.x]
    24          os: [ubuntu-latest]
    25      steps:
    26        - name: Check out code
    27          uses: actions/checkout@v3
    28  
    29        - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
    30          uses: actions/setup-go@v3
    31          with:
    32            go-version: ${{ matrix.go-version }}
    33            cache: true
    34          id: go
    35  
    36        - name: Build on ${{ matrix.os }}
    37          env:
    38            GO111MODULE: on
    39            GOOS: linux
    40          run: |
    41            make verifiers
    42  
    43    ui-assets-istanbul-coverage:
    44      name: "Assets with Istanbul Plugin for coverage"
    45      runs-on: ubuntu-latest
    46      strategy:
    47        matrix:
    48          go-version: [1.20.x]
    49          os: [ubuntu-latest]
    50      steps:
    51        - name: Check out code
    52          uses: actions/checkout@v3
    53        - name: Read .nvmrc
    54          id: node_version
    55          run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
    56        - uses: actions/setup-node@v3
    57          with:
    58            node-version: ${{ env.NVMRC }}
    59            cache: "yarn"
    60            cache-dependency-path: web-app/yarn.lock
    61        - uses: actions/cache@v3
    62          id: assets-cache-istanbul-coverage
    63          name: Assets Cache Istanbul Coverage
    64          with:
    65            path: |
    66              ./web-app/build/
    67            key: ${{ runner.os }}-assets-istanbul-coverage-${{ github.run_id }}
    68        - name: Install Dependencies
    69          working-directory: ./web-app
    70          continue-on-error: false
    71          run: |
    72            yarn install --frozen-lockfile --immutable
    73        - name: Check for Warnings in build output
    74          working-directory: ./web-app
    75          continue-on-error: false
    76          run: |
    77            ./check-warnings-istanbul-coverage.sh
    78        - name: Check if Files are Prettified
    79          working-directory: ./web-app
    80          continue-on-error: false
    81          run: |
    82            ./check-prettier.sh
    83  
    84    reuse-golang-dependencies:
    85      name: reuse golang dependencies
    86      runs-on: ubuntu-latest
    87      strategy:
    88        matrix:
    89          go-version: [1.20.x]
    90          os: [ubuntu-latest]
    91      steps:
    92        - name: Check out code
    93          uses: actions/checkout@v3
    94        - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
    95          uses: actions/setup-go@v3
    96          with:
    97            go-version: ${{ matrix.go-version }}
    98            cache: true
    99          id: go
   100        - name: Build on ${{ matrix.os }}
   101          env:
   102            GO111MODULE: on
   103            GOOS: linux
   104          run: |
   105            go mod download
   106  
   107    semgrep-static-code-analysis:
   108      name: "semgrep checks"
   109      runs-on: ubuntu-latest
   110      strategy:
   111        matrix:
   112          os: [ubuntu-latest]
   113      steps:
   114        - name: Check out source code
   115          uses: actions/checkout@v3
   116        - name: Scanning code on ${{ matrix.os }}
   117          continue-on-error: false
   118          run: |
   119            # Install semgrep rather than using a container due to:
   120            # https://github.com/actions/checkout/issues/334
   121            sudo apt install -y python3-pip || apt install -y python3-pip
   122            pip3 install semgrep
   123            semgrep --config semgrep.yaml $(pwd)/web-app --error
   124  
   125    compile-binary-istanbul-coverage:
   126      name: "Compile Console Binary with Istanbul Plugin for Coverage"
   127      needs:
   128        - lint-job
   129        - ui-assets-istanbul-coverage
   130        - reuse-golang-dependencies
   131        - semgrep-static-code-analysis
   132      runs-on: ${{ matrix.os }}
   133      strategy:
   134        matrix:
   135          go-version: [1.20.x]
   136          os: [ubuntu-latest]
   137      steps:
   138        - name: Check out code
   139          uses: actions/checkout@v3
   140  
   141        - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
   142          uses: actions/setup-go@v3
   143          with:
   144            go-version: ${{ matrix.go-version }}
   145            cache: true
   146          id: go
   147        - uses: actions/cache@v3
   148          name: Console Binary Cache Istanbul Coverage
   149          with:
   150            path: |
   151              ./console
   152            key: ${{ runner.os }}-binary-istanbul-coverage-${{ github.run_id }}
   153        - uses: actions/cache@v3
   154          id: assets-cache-istanbul-coverage
   155          name: Assets Cache Istanbul Coverage
   156          with:
   157            path: |
   158              ./web-app/build/
   159            key: ${{ runner.os }}-assets-istanbul-coverage-${{ github.run_id }}
   160        - name: Build on ${{ matrix.os }}
   161          env:
   162            GO111MODULE: on
   163            GOOS: linux
   164          run: |
   165            make console
   166  
   167    playwright:
   168      needs:
   169        - compile-binary-istanbul-coverage
   170      timeout-minutes: 60
   171      runs-on: ubuntu-latest
   172      steps:
   173        - uses: actions/checkout@v3
   174        - uses: actions/setup-node@v3
   175          with:
   176            node-version: 18
   177  
   178        - name: Install dependencies
   179          run: |
   180            echo "Install dependencies"
   181            cd $GITHUB_WORKSPACE/web-app
   182            yarn add -D playwright
   183            yarn add -D @playwright/test
   184            yarn add -D babel-plugin-istanbul
   185            yarn add -D nyc
   186            yarn add -D react-app-rewired
   187            yarn add -D create-react-app
   188            yarn init -y
   189            echo "yarn install"
   190            yarn install
   191  
   192        - name: Install Playwright Browsers
   193          run: npx playwright install --with-deps
   194  
   195        - uses: actions/cache@v3
   196          name: Console Binary Cache Istanbul Coverage
   197          with:
   198            path: |
   199              ./console
   200            key: ${{ runner.os }}-binary-istanbul-coverage-${{ github.run_id }}
   201  
   202        - name: Start Console, front-end app and initialize users/policies
   203          run: |
   204            (./console server) & (make initialize-permissions)
   205  
   206        - name: Run Playwright tests
   207          run: |
   208            echo "Run tests under playwright folder only"
   209            cd $GITHUB_WORKSPACE/web-app
   210            yarn remove playwright
   211            yarn add --dev @playwright/test
   212            echo "npx playwright test"
   213            npx playwright test # To run the tests
   214            echo "npx nyc report"
   215            npx nyc report # To see report printed in logs as text
   216            echo "npx nyc report --reporter=html"
   217            npx nyc report --reporter=html # to see report in ./coverage/index.html
   218        - uses: actions/upload-artifact@v3
   219          if: always()
   220          with:
   221            name: playwright-report
   222            path: playwright-report/
   223            retention-days: 30
   224        - uses: actions/upload-artifact@v3
   225          if: always()
   226          with:
   227            name: coverage
   228            path: coverage/
   229            retention-days: 30