|
1 | 1 | name: CI |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | 4 | push: |
6 | | - schedule: |
7 | | - # Prime the caches every Monday |
8 | | - - cron: 0 1 * * MON |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
9 | 8 |
|
10 | 9 | jobs: |
11 | 10 | test: |
12 | 11 | strategy: |
13 | 12 | fail-fast: false |
14 | 13 | matrix: |
15 | | - os: |
16 | | - - macos-latest |
17 | | - - ubuntu-latest |
18 | | - - windows-latest |
19 | | - ocaml-compiler: |
20 | | - - 4.06.x |
21 | | - |
| 14 | + os: [macos-latest, ubuntu-latest, windows-latest] |
22 | 15 |
|
23 | | - |
24 | | - runs-on: ${{ matrix.os }} |
| 16 | + runs-on: ${{matrix.os}} |
25 | 17 |
|
26 | 18 | steps: |
27 | | - - name: Checkout code |
28 | | - uses: actions/checkout@v2 |
29 | | - |
30 | | - - name: Use Node.js 14.x |
31 | | - uses: actions/setup-node@v2 |
32 | | - with: |
33 | | - node-version: 14.x |
34 | | - |
35 | | - - run: npm ci |
36 | | - |
37 | | - - name: Use OCaml ${{ matrix.ocaml-compiler }} |
38 | | - uses: avsm/setup-ocaml@v2 |
39 | | - with: |
40 | | - ocaml-compiler: ${{ matrix.ocaml-compiler }} |
41 | | - |
42 | | - - run: opam install . --deps-only |
43 | | - |
44 | | - - run: opam exec -- dune build |
| 19 | + |
| 20 | + |
| 21 | + - name: Cache OCaml's opam |
| 22 | + |
| 23 | + with: |
| 24 | + path: ~/.opam |
| 25 | + key: ${{matrix.os}}-latest-ocaml-4.06.1 |
| 26 | + |
| 27 | + - name: Use OCaml |
| 28 | + |
| 29 | + with: |
| 30 | + ocaml-version: 4.06.1 |
| 31 | + |
| 32 | + - name: Use Node.js |
| 33 | + |
| 34 | + with: |
| 35 | + node-version: 14.4.0 |
| 36 | + |
| 37 | + - run: npm ci |
| 38 | + |
| 39 | + # These 2 runs (or just the second?) are for when you have opam dependencies. We don't. |
| 40 | + # Don't add deps. But if you ever do, un-comment these |
| 41 | + # - run: opam pin add rescript-editor-support.dev . --no-action |
| 42 | + # - run: opam install . --deps-only --with-doc --with-test |
| 43 | + |
| 44 | + - run: eval $(opam env) && make |
| 45 | + if: matrix.os != 'windows-latest' |
| 46 | + - run: "& $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make" |
| 47 | + if: matrix.os == 'windows-latest' |
| 48 | + |
| 49 | + # Also avoids artifacts upload permission loss: |
| 50 | + # https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss |
| 51 | + - name: Compress files |
| 52 | + run: tar -cvf rescript-editor-support.tar -C lib rescript-editor-support.exe |
| 53 | + |
| 54 | + - uses: actions/upload-artifact@v2 |
| 55 | + with: |
| 56 | + name: ${{matrix.os}}-rescript-editor-support.exe |
| 57 | + path: rescript-editor-support.tar |
0 commit comments