|
| 1 | +name: Build, Lint, and Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + |
| 6 | +jobs: |
| 7 | + prepare: |
| 8 | + name: Prepare |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v3 |
| 12 | + - name: Use Node.js |
| 13 | + uses: actions/setup-node@v3 |
| 14 | + with: |
| 15 | + node-version-file: '.nvmrc' |
| 16 | + cache: 'yarn' |
| 17 | + - name: Install Yarn dependencies |
| 18 | + run: yarn --immutable |
| 19 | + |
| 20 | + build: |
| 21 | + name: Build |
| 22 | + runs-on: ubuntu-latest |
| 23 | + needs: |
| 24 | + - prepare |
| 25 | + strategy: |
| 26 | + matrix: |
| 27 | + node-version: [16.x, 18.x, 20.x] |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v3 |
| 30 | + - name: Use Node.js ${{ matrix.node-version }} |
| 31 | + uses: actions/setup-node@v3 |
| 32 | + with: |
| 33 | + node-version: ${{ matrix.node-version }} |
| 34 | + cache: 'yarn' |
| 35 | + - run: yarn --immutable --immutable-cache |
| 36 | + - run: yarn build |
| 37 | + - name: Require clean working directory |
| 38 | + shell: bash |
| 39 | + run: | |
| 40 | + if ! git diff --exit-code; then |
| 41 | + echo "Working tree dirty at end of job" |
| 42 | + exit 1 |
| 43 | + fi |
| 44 | +
|
| 45 | + lint: |
| 46 | + name: Lint |
| 47 | + runs-on: ubuntu-latest |
| 48 | + needs: |
| 49 | + - prepare |
| 50 | + strategy: |
| 51 | + matrix: |
| 52 | + node-version: [16.x, 18.x, 20.x] |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v3 |
| 55 | + - name: Use Node.js ${{ matrix.node-version }} |
| 56 | + uses: actions/setup-node@v3 |
| 57 | + with: |
| 58 | + node-version: ${{ matrix.node-version }} |
| 59 | + cache: 'yarn' |
| 60 | + - run: yarn --immutable --immutable-cache |
| 61 | + - run: yarn lint |
| 62 | + - name: Validate RC changelog |
| 63 | + if: ${{ startsWith(github.head_ref, 'release/') }} |
| 64 | + run: yarn auto-changelog validate --rc |
| 65 | + - name: Validate changelog |
| 66 | + if: ${{ !startsWith(github.head_ref, 'release/') }} |
| 67 | + run: yarn auto-changelog validate |
| 68 | + - name: Require clean working directory |
| 69 | + shell: bash |
| 70 | + run: | |
| 71 | + if ! git diff --exit-code; then |
| 72 | + echo "Working tree dirty at end of job" |
| 73 | + exit 1 |
| 74 | + fi |
| 75 | +
|
| 76 | + test: |
| 77 | + name: Test |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: |
| 80 | + - prepare |
| 81 | + strategy: |
| 82 | + matrix: |
| 83 | + node-version: [16.x, 18.x, 20.x] |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v3 |
| 86 | + - name: Use Node.js ${{ matrix.node-version }} |
| 87 | + uses: actions/setup-node@v3 |
| 88 | + with: |
| 89 | + node-version: ${{ matrix.node-version }} |
| 90 | + cache: 'yarn' |
| 91 | + - run: yarn --immutable --immutable-cache |
| 92 | + - run: yarn test |
| 93 | + - name: Require clean working directory |
| 94 | + shell: bash |
| 95 | + run: | |
| 96 | + if ! git diff --exit-code; then |
| 97 | + echo "Working tree dirty at end of job" |
| 98 | + exit 1 |
| 99 | + fi |
0 commit comments