github.com/minio/console@v1.4.1/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 - name: Enable Corepack 57 run: corepack enable 58 - uses: actions/setup-node@v3 59 with: 60 node-version: ${{ env.NVMRC }} 61 cache: "yarn" 62 cache-dependency-path: web-app/yarn.lock 63 - uses: actions/cache@v3 64 id: assets-cache-istanbul-coverage 65 name: Assets Cache Istanbul Coverage 66 with: 67 path: | 68 ./web-app/build/ 69 key: ${{ runner.os }}-assets-istanbul-coverage-${{ github.run_id }} 70 - name: Install Dependencies 71 working-directory: ./web-app 72 continue-on-error: false 73 run: | 74 yarn install --immutable --no-check-resolutions 75 - name: Check for Warnings in build output 76 working-directory: ./web-app 77 continue-on-error: false 78 run: | 79 ./check-warnings-istanbul-coverage.sh 80 - name: Check if Files are Prettified 81 working-directory: ./web-app 82 continue-on-error: false 83 run: | 84 ./check-prettier.sh 85 86 reuse-golang-dependencies: 87 name: reuse golang dependencies 88 runs-on: ubuntu-latest 89 strategy: 90 matrix: 91 go-version: [1.20.x] 92 os: [ubuntu-latest] 93 steps: 94 - name: Check out code 95 uses: actions/checkout@v3 96 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} 97 uses: actions/setup-go@v3 98 with: 99 go-version: ${{ matrix.go-version }} 100 cache: true 101 id: go 102 - name: Build on ${{ matrix.os }} 103 env: 104 GO111MODULE: on 105 GOOS: linux 106 run: | 107 go mod download 108 109 semgrep-static-code-analysis: 110 name: "semgrep checks" 111 runs-on: ubuntu-latest 112 strategy: 113 matrix: 114 os: [ubuntu-latest] 115 steps: 116 - name: Check out source code 117 uses: actions/checkout@v3 118 - name: Scanning code on ${{ matrix.os }} 119 continue-on-error: false 120 run: | 121 # Install semgrep rather than using a container due to: 122 # https://github.com/actions/checkout/issues/334 123 sudo apt install -y python3-pip || apt install -y python3-pip 124 pip3 install semgrep 125 semgrep --config semgrep.yaml $(pwd)/web-app --error 126 127 compile-binary-istanbul-coverage: 128 name: "Compile Console Binary with Istanbul Plugin for Coverage" 129 needs: 130 - lint-job 131 - ui-assets-istanbul-coverage 132 - reuse-golang-dependencies 133 - semgrep-static-code-analysis 134 runs-on: ${{ matrix.os }} 135 strategy: 136 matrix: 137 go-version: [1.20.x] 138 os: [ubuntu-latest] 139 steps: 140 - name: Check out code 141 uses: actions/checkout@v3 142 143 - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} 144 uses: actions/setup-go@v3 145 with: 146 go-version: ${{ matrix.go-version }} 147 cache: true 148 id: go 149 - uses: actions/cache@v3 150 name: Console Binary Cache Istanbul Coverage 151 with: 152 path: | 153 ./console 154 key: ${{ runner.os }}-binary-istanbul-coverage-${{ github.run_id }} 155 - uses: actions/cache@v3 156 id: assets-cache-istanbul-coverage 157 name: Assets Cache Istanbul Coverage 158 with: 159 path: | 160 ./web-app/build/ 161 key: ${{ runner.os }}-assets-istanbul-coverage-${{ github.run_id }} 162 - name: Build on ${{ matrix.os }} 163 env: 164 GO111MODULE: on 165 GOOS: linux 166 run: | 167 make console 168 169 playwright: 170 needs: 171 - compile-binary-istanbul-coverage 172 timeout-minutes: 60 173 runs-on: ubuntu-latest 174 steps: 175 - uses: actions/checkout@v3 176 - name: Enable Corepack 177 run: corepack enable 178 - uses: actions/setup-node@v3 179 with: 180 node-version: 18 181 182 - name: Install dependencies 183 run: | 184 echo "Install dependencies" 185 cd $GITHUB_WORKSPACE/web-app 186 yarn add -D playwright 187 yarn add -D @playwright/test 188 yarn add -D babel-plugin-istanbul 189 yarn add -D nyc 190 yarn add -D react-app-rewired 191 yarn add -D create-react-app 192 yarn init -y 193 echo "yarn install" 194 yarn install --no-check-resolutions 195 196 - name: Install Playwright Browsers 197 run: npx playwright install --with-deps 198 199 - uses: actions/cache@v3 200 name: Console Binary Cache Istanbul Coverage 201 with: 202 path: | 203 ./console 204 key: ${{ runner.os }}-binary-istanbul-coverage-${{ github.run_id }} 205 206 - name: Start Console, front-end app and initialize users/policies 207 run: | 208 (./console server) & (make initialize-permissions) 209 210 - name: Run Playwright tests 211 run: | 212 echo "Run tests under playwright folder only" 213 cd $GITHUB_WORKSPACE/web-app 214 yarn remove playwright 215 yarn add --dev @playwright/test 216 echo "npx playwright test" 217 npx playwright test # To run the tests 218 echo "npx nyc report" 219 npx nyc report # To see report printed in logs as text 220 echo "npx nyc report --reporter=html" 221 npx nyc report --reporter=html # to see report in ./coverage/index.html 222 - uses: actions/upload-artifact@v3 223 if: always() 224 with: 225 name: playwright-report 226 path: playwright-report/ 227 retention-days: 30 228 - uses: actions/upload-artifact@v3 229 if: always() 230 with: 231 name: coverage 232 path: coverage/ 233 retention-days: 30