|
| 1 | +name: CI accelerator benchmark |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - workflows-global-build-image |
| 8 | + |
| 9 | +env: |
| 10 | + NODE_OPTIONS: --max_old_space_size=6144 |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + baseline: |
| 17 | + name: Baseline / ${{ matrix.workload }} |
| 18 | + runs-on: ubuntu-latest |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + workload: |
| 23 | + - lint |
| 24 | + - test |
| 25 | + steps: |
| 26 | + - name: Check out files from GitHub |
| 27 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 28 | + with: |
| 29 | + persist-credentials: false |
| 30 | + - name: Setup Node and install |
| 31 | + uses: ./.github/actions/setup |
| 32 | + - name: Check for duplicate dependencies |
| 33 | + if: matrix.workload == 'lint' |
| 34 | + run: yarn dedupe --check |
| 35 | + - name: Build resources |
| 36 | + id: build_resources |
| 37 | + run: >- |
| 38 | + ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data |
| 39 | + ${{ matrix.workload == 'lint' && 'gather-gallery-pages' || '' }} |
| 40 | + env: |
| 41 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + - name: Setup lint cache |
| 43 | + if: matrix.workload == 'lint' |
| 44 | + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| 45 | + with: |
| 46 | + path: | |
| 47 | + node_modules/.cache/prettier |
| 48 | + node_modules/.cache/eslint |
| 49 | + node_modules/.cache/typescript |
| 50 | + key: benchmark-baseline-lint-${{ github.run_id }}-${{ github.run_attempt }} |
| 51 | + restore-keys: lint- |
| 52 | + - name: Run eslint |
| 53 | + if: matrix.workload == 'lint' |
| 54 | + run: yarn run lint:eslint --quiet |
| 55 | + - name: Run tsc |
| 56 | + if: matrix.workload == 'lint' && !cancelled() && steps.build_resources.outcome == 'success' |
| 57 | + run: yarn run lint:types |
| 58 | + - name: Run lit-analyzer |
| 59 | + if: matrix.workload == 'lint' && !cancelled() && steps.build_resources.outcome == 'success' |
| 60 | + run: yarn run lint:lit --quiet |
| 61 | + - name: Run prettier |
| 62 | + if: matrix.workload == 'lint' && !cancelled() && steps.build_resources.outcome == 'success' |
| 63 | + run: yarn run lint:prettier |
| 64 | + - name: Check dependency licenses |
| 65 | + if: matrix.workload == 'lint' && !cancelled() && steps.build_resources.outcome == 'success' |
| 66 | + run: yarn run lint:licenses |
| 67 | + - name: Run tests |
| 68 | + if: matrix.workload == 'test' |
| 69 | + run: yarn run test |
| 70 | + |
| 71 | + image: |
| 72 | + name: Image / ${{ matrix.workload }} |
| 73 | + runs-on: ubuntu-latest |
| 74 | + container: |
| 75 | + image: ghcr.io/timmo001/home-assistant-frontend-ci-images/frontend-workflow@sha256:ba6eed31fb0a11f5adcce3b1265b896eb406efc0a7ccf03df9559618c25797fe |
| 76 | + strategy: |
| 77 | + fail-fast: false |
| 78 | + matrix: |
| 79 | + workload: |
| 80 | + - lint |
| 81 | + - test |
| 82 | + steps: |
| 83 | + - name: Check out files from GitHub |
| 84 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 85 | + with: |
| 86 | + persist-credentials: false |
| 87 | + - name: Install dependencies |
| 88 | + run: frontend-install |
| 89 | + - name: Check for duplicate dependencies |
| 90 | + if: matrix.workload == 'lint' |
| 91 | + run: yarn dedupe --check |
| 92 | + - name: Build resources |
| 93 | + id: build_resources |
| 94 | + run: >- |
| 95 | + ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data |
| 96 | + ${{ matrix.workload == 'lint' && 'gather-gallery-pages' || '' }} |
| 97 | + env: |
| 98 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 99 | + - name: Setup lint cache |
| 100 | + if: matrix.workload == 'lint' |
| 101 | + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| 102 | + with: |
| 103 | + path: | |
| 104 | + node_modules/.cache/prettier |
| 105 | + node_modules/.cache/eslint |
| 106 | + node_modules/.cache/typescript |
| 107 | + key: benchmark-image-lint-${{ github.run_id }}-${{ github.run_attempt }} |
| 108 | + restore-keys: lint- |
| 109 | + - name: Run eslint |
| 110 | + if: matrix.workload == 'lint' |
| 111 | + run: yarn run lint:eslint --quiet |
| 112 | + - name: Run tsc |
| 113 | + if: matrix.workload == 'lint' && !cancelled() && steps.build_resources.outcome == 'success' |
| 114 | + run: yarn run lint:types |
| 115 | + - name: Run lit-analyzer |
| 116 | + if: matrix.workload == 'lint' && !cancelled() && steps.build_resources.outcome == 'success' |
| 117 | + run: yarn run lint:lit --quiet |
| 118 | + - name: Run prettier |
| 119 | + if: matrix.workload == 'lint' && !cancelled() && steps.build_resources.outcome == 'success' |
| 120 | + run: yarn run lint:prettier |
| 121 | + - name: Check dependency licenses |
| 122 | + if: matrix.workload == 'lint' && !cancelled() && steps.build_resources.outcome == 'success' |
| 123 | + run: yarn run lint:licenses |
| 124 | + - name: Run tests |
| 125 | + if: matrix.workload == 'test' |
| 126 | + run: yarn run test |
0 commit comments