|
| 1 | +name: build-lint-test |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | +jobs: |
| 5 | + build: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + env: |
| 8 | + GH_PR_NUM: ${{ github.event.number }} |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v4 |
| 11 | + - run: | |
| 12 | + if [[ ! -z "${GH_PR_NUM}" ]]; then |
| 13 | + echo "Checking out PR" |
| 14 | + git fetch origin pull/$GH_PR_NUM/head:tmp |
| 15 | + git checkout tmp |
| 16 | + fi |
| 17 | + - uses: actions/setup-node@v4 |
| 18 | + with: |
| 19 | + node-version: '20' |
| 20 | + - name: Enable Corepack |
| 21 | + shell: bash |
| 22 | + run: corepack enable |
| 23 | + - uses: actions/cache@v4 |
| 24 | + id: yarn-cache |
| 25 | + name: Cache npm deps |
| 26 | + with: |
| 27 | + path: | |
| 28 | + node_modules |
| 29 | + **/node_modules |
| 30 | + key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} |
| 31 | + - run: yarn install --immutable |
| 32 | + if: steps.yarn-cache.outputs.cache-hit != 'true' |
| 33 | + - uses: actions/cache@v4 |
| 34 | + id: dist |
| 35 | + name: Cache dist |
| 36 | + with: |
| 37 | + path: | |
| 38 | + packages/*/dist |
| 39 | + key: ${{ runner.os }}-dist-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock', 'package.json', 'packages/*/*', '!packages/*/dist', '!packages/*/node_modules') }} |
| 40 | + - name: Build dist |
| 41 | + run: yarn build |
| 42 | + if: steps.dist.outputs.cache-hit != 'true' |
| 43 | + lint: |
| 44 | + runs-on: ubuntu-latest |
| 45 | + env: |
| 46 | + GH_PR_NUM: ${{ github.event.number }} |
| 47 | + needs: build |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + - run: | |
| 51 | + if [[ ! -z "${GH_PR_NUM}" ]]; then |
| 52 | + echo "Checking out PR" |
| 53 | + git fetch origin pull/$GH_PR_NUM/head:tmp |
| 54 | + git checkout tmp |
| 55 | + fi |
| 56 | + - uses: actions/setup-node@v4 |
| 57 | + with: |
| 58 | + node-version: '20' |
| 59 | + - name: Enable Corepack |
| 60 | + shell: bash |
| 61 | + run: corepack enable |
| 62 | + - uses: actions/cache@v4 |
| 63 | + id: yarn-cache |
| 64 | + name: Cache npm deps |
| 65 | + with: |
| 66 | + path: | |
| 67 | + node_modules |
| 68 | + **/node_modules |
| 69 | + key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} |
| 70 | + - run: yarn install --immutable |
| 71 | + if: steps.yarn-cache.outputs.cache-hit != 'true' |
| 72 | + - uses: actions/cache@v4 |
| 73 | + id: lint-cache |
| 74 | + name: Load lint cache |
| 75 | + with: |
| 76 | + path: '.eslintcache' |
| 77 | + key: ${{ runner.os }}-lint-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} |
| 78 | + - name: Enable Corepack |
| 79 | + shell: bash |
| 80 | + run: corepack enable |
| 81 | + - name: ESLint |
| 82 | + run: yarn lint:js |
| 83 | + - name: MDLint |
| 84 | + run: yarn lint:md |
| 85 | + test_jest: |
| 86 | + runs-on: ubuntu-latest |
| 87 | + env: |
| 88 | + GH_PR_NUM: ${{ github.event.number }} |
| 89 | + needs: build |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v4 |
| 92 | + # Yes, we really want to checkout the PR |
| 93 | + - run: | |
| 94 | + if [[ ! -z "${GH_PR_NUM}" ]]; then |
| 95 | + echo "Checking out PR" |
| 96 | + git fetch origin pull/$GH_PR_NUM/head:tmp |
| 97 | + git checkout tmp |
| 98 | + fi |
| 99 | + - uses: actions/setup-node@v4 |
| 100 | + with: |
| 101 | + node-version: '20' |
| 102 | + - name: Enable Corepack |
| 103 | + shell: bash |
| 104 | + run: corepack enable |
| 105 | + - uses: actions/cache@v4 |
| 106 | + id: yarn-cache |
| 107 | + name: Cache npm deps |
| 108 | + with: |
| 109 | + path: | |
| 110 | + node_modules |
| 111 | + **/node_modules |
| 112 | + ~/.cache/Cypress |
| 113 | + key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} |
| 114 | + - run: yarn install --immutable |
| 115 | + if: steps.yarn-cache.outputs.cache-hit != 'true' |
| 116 | + - uses: actions/cache@v4 |
| 117 | + id: dist |
| 118 | + name: Cache dist |
| 119 | + with: |
| 120 | + path: | |
| 121 | + packages/*/dist |
| 122 | + packages/react-styles/css |
| 123 | + key: ${{ runner.os }}-dist-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock', 'package.json', 'packages/*/*', '!packages/*/dist', '!packages/*/node_modules') }} |
| 124 | + - name: Build dist |
| 125 | + run: yarn build |
| 126 | + if: steps.dist.outputs.cache-hit != 'true' |
| 127 | + - name: PF6 Jest Tests |
| 128 | + run: yarn test --maxWorkers=2 |
| 129 | + test_a11y: |
| 130 | + runs-on: ubuntu-latest |
| 131 | + env: |
| 132 | + GH_PR_NUM: ${{ github.event.number }} |
| 133 | + needs: build |
| 134 | + steps: |
| 135 | + - uses: actions/checkout@v4 |
| 136 | + # Yes, we really want to checkout the PR |
| 137 | + - run: | |
| 138 | + if [[ ! -z "${GH_PR_NUM}" ]]; then |
| 139 | + echo "Checking out PR" |
| 140 | + git fetch origin pull/$GH_PR_NUM/head:tmp |
| 141 | + git checkout tmp |
| 142 | + fi |
| 143 | + - uses: actions/setup-node@v4 |
| 144 | + with: |
| 145 | + node-version: '20' |
| 146 | + - name: Enable Corepack |
| 147 | + shell: bash |
| 148 | + run: corepack enable |
| 149 | + - uses: actions/cache@v4 |
| 150 | + id: yarn-cache |
| 151 | + name: Cache npm deps |
| 152 | + with: |
| 153 | + path: | |
| 154 | + node_modules |
| 155 | + **/node_modules |
| 156 | + ~/.cache/Cypress |
| 157 | + key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} |
| 158 | + - run: yarn install --immutable |
| 159 | + if: steps.yarn-cache.outputs.cache-hit != 'true' |
| 160 | + - uses: actions/cache@v4 |
| 161 | + id: dist |
| 162 | + name: Cache dist |
| 163 | + with: |
| 164 | + path: | |
| 165 | + packages/*/dist |
| 166 | + packages/react-styles/css |
| 167 | + key: ${{ runner.os }}-dist-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock', 'package.json', 'packages/*/*', '!packages/*/dist', '!packages/*/node_modules') }} |
| 168 | + - name: Build dist |
| 169 | + run: yarn build |
| 170 | + if: steps.dist.outputs.cache-hit != 'true' |
| 171 | + - name: Build docs |
| 172 | + run: yarn build:docs |
| 173 | + - name: A11y tests |
| 174 | + run: yarn serve:docs & yarn test:a11y |
0 commit comments