|
1 | | -# This CI workflow was adapted from flarum/core |
2 | | -# and davwheat/let-me-really-google-that-for-you |
3 | | - |
4 | 1 | name: Smoketest |
5 | 2 |
|
6 | 3 | on: |
7 | 4 | push: |
8 | | - branches: |
9 | | - - 'main' |
10 | 5 |
|
11 | 6 | jobs: |
12 | 7 | install: |
13 | 8 | runs-on: ubuntu-latest |
14 | | - name: Prepare repo |
15 | | - |
16 | | - strategy: |
17 | | - matrix: |
18 | | - node-version: [14.x] |
19 | | - |
20 | | - steps: |
21 | | - - name: Checkout code |
22 | | - uses: actions/checkout@v2 |
23 | | - |
24 | | - - name: Use Node.js ${{ matrix.node-version }} |
25 | | - uses: actions/setup-node@v1 |
26 | | - with: |
27 | | - node-version: ${{ matrix.node-version }} |
28 | | - |
29 | | - - name: Enter JS directory |
30 | | - run: cd js |
31 | | - |
32 | | - - name: Get yarn cache directory path |
33 | | - id: yarn-cache-dir-path |
34 | | - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" |
35 | | - |
36 | | - - name: Restore dependencies cache |
37 | | - uses: actions/cache@v2 |
38 | | - id: yarnCache |
39 | | - with: |
40 | | - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
41 | | - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
42 | | - restore-keys: | |
43 | | - ${{ runner.os }}-yarn- |
44 | | -
|
45 | | - - name: Restore node_modules |
46 | | - uses: actions/cache@v2 |
47 | | - id: moduleCache |
48 | | - with: |
49 | | - path: ./js/node_modules |
50 | | - key: ${{ runner.os }}-node-modules-${{ github.sha }}-${{ hashFiles('**/yarn.lock') }} |
51 | | - restore-keys: | |
52 | | - ${{ runner.os }}-node-modules-${{ github.sha }}- |
53 | | - ${{ runner.os }}-node-modules- |
54 | | -
|
55 | | - - name: Install dependencies on cache miss |
56 | | - run: cd js && yarn install --frozen-lockfile |
57 | | - if: steps.yarn-cache.outputs.cache-hit != 'true' |
58 | | - |
59 | | - - name: Install project dependencies from cache |
60 | | - run: cd js && yarn --prefer-offline --frozen-lockfile |
61 | | - if: steps.yarn-cache.outputs.cache-hit == 'true' |
62 | | - |
63 | | - formatting: |
64 | | - runs-on: ubuntu-latest |
65 | | - needs: [install] |
66 | | - name: Verify formatting |
| 9 | + name: Format and build |
67 | 10 |
|
68 | 11 | strategy: |
69 | 12 | matrix: |
|
74 | 17 | uses: actions/checkout@v2 |
75 | 18 |
|
76 | 19 | - name: Use Node.js ${{ matrix.node-version }} |
77 | | - uses: actions/setup-node@v1 |
| 20 | + uses: actions/setup-node@v2 |
78 | 21 | with: |
79 | 22 | node-version: ${{ matrix.node-version }} |
80 | 23 |
|
|
92 | 35 | - name: Verify formatting |
93 | 36 | run: composer run format:check |
94 | 37 |
|
95 | | - build: |
96 | | - name: Build JS bundle |
97 | | - runs-on: ubuntu-latest |
98 | | - needs: [formatting] |
99 | | - |
100 | | - strategy: |
101 | | - matrix: |
102 | | - node-version: [14.x] |
103 | | - |
104 | | - steps: |
105 | | - - name: Checkout code |
106 | | - uses: actions/checkout@v2 |
107 | | - |
108 | | - - uses: davwheat/[email protected] |
109 | | - env: |
110 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + - uses: flarum/action-build@2 |
| 39 | + if: github.ref == 'refs/heads/main' && github.event_name == 'push' |
| 40 | + with: |
| 41 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + package_manager: yarn |
0 commit comments