generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 39
107 lines (85 loc) · 2.98 KB
/
workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Builds, tests & co
on:
pull_request:
push:
schedule:
# Prime the caches every Monday
- cron: 0 1 * * MON
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
# Concurrent workflows are grouped by the PR or branch that triggered them
# (github.ref) and the name of the workflow (github.workflow). The
# 'cancel-in-progress' option then make sure that only one workflow is running
# at a time. This doesn't prevent new jobs from running, rather it cancels
# already running jobs before scheduling new jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'pull_request' || github.sha }}
cancel-in-progress: true
permissions: read-all
jobs:
hygiene:
name: Hygiene
runs-on: ubuntu-latest
steps:
- name: Checkout tree
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Set-up Node.js 20
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 20
- name: Get yarn cache folder path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >>"$GITHUB_OUTPUT"
- name: Retrieve yarn cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install npm packages
run: yarn install --immutable
- name: Check formatting
if: always()
run: yarn format:check
- name: Check lint
if: always()
run: yarn lint
- name: Check type
if: always()
run: yarn typecheck
- name: Ensure dist directory is up-to-date
shell: bash
run: |
yarn build
if [ "$(git status dist lint-doc lint-fmt lint-opam --porcelain | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
test:
name: Test
needs: hygiene
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
ocaml-compiler:
- "5.0"
include:
- os: windows-latest
ocaml-compiler: "4.14"
- os: ubuntu-latest
ocaml-compiler: ocaml-variants.5.0.0+options,ocaml-option-flambda,ocaml-option-musl,ocaml-option-static
runs-on: ${{ matrix.os }}
steps:
- name: Checkout tree
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Set-up OCaml ${{ matrix.ocaml-compiler }}
uses: ./
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: ${{ matrix.os != 'windows-latest' }}
- run: opam depext --install uri
- run: opam install ocamlbuild