Skip to content

Commit 69536cd

Browse files
authored
Merge pull request #297 from smorimoto/extends
Extends
2 parents b483f77 + be7533e commit 69536cd

File tree

8 files changed

+199
-4
lines changed

8 files changed

+199
-4
lines changed

.prettierrc.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
2-
"proseWrap": "always",
3-
"endOfLine": "auto"
2+
"endOfLine": "auto",
3+
"overrides": [
4+
{
5+
"files": "*.md",
6+
"options": {
7+
"proseWrap": "always"
8+
}
9+
}
10+
]
411
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to
88

99
## [unreleased]
1010

11+
### Added
12+
13+
- Added "extends" experimentally.
14+
1115
### Changed
1216

1317
- Remove some hacks as `--no-depexts` is now used in CLI 2.0 mode from opam

README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,116 @@ jobs:
142142
- run: opam exec -- dune runtest
143143
```
144144
145+
## Extends
146+
147+
**STATUS: EXPERIMENTAL**
148+
149+
Note: All extends are recommended to use in separate jobs run on
150+
`ubuntu-latest`.
151+
152+
- [deploy-doc](#deploy-doc)
153+
- [lint-doc](#lint-doc)
154+
- [lint-fmt](#lint-fmt)
155+
- [lint-opam](#lint-opam)
156+
157+
### deploy-doc
158+
159+
```yml
160+
name: Deploy odoc
161+
162+
on:
163+
push:
164+
branches:
165+
- master
166+
167+
jobs:
168+
deploy-doc:
169+
runs-on: ubuntu-latest
170+
steps:
171+
- name: Checkout code
172+
uses: actions/checkout@v2
173+
174+
- name: Use OCaml 4.13.x
175+
uses: ocaml/setup-ocaml@v2
176+
with:
177+
ocaml-compiler: 4.13.x
178+
dune-cache: true
179+
180+
- name: Deploy odoc to GitHub Pages
181+
uses: ocaml/setup-ocaml/deploy-doc@v2
182+
```
183+
184+
See [action.yml](deploy-doc/action.yml) for inputs.
185+
186+
### lint-doc
187+
188+
```yml
189+
jobs:
190+
lint-doc:
191+
runs-on: ubuntu-latest
192+
steps:
193+
- name: Checkout code
194+
uses: actions/checkout@v2
195+
196+
- name: Use OCaml 4.13.x
197+
uses: ocaml/setup-ocaml@v2
198+
with:
199+
ocaml-compiler: 4.13.x
200+
dune-cache: true
201+
202+
- name: Lint doc
203+
uses: ocaml/setup-ocaml/lint-doc@v2
204+
```
205+
206+
See [action.yml](lint-doc/action.yml) for inputs.
207+
208+
### lint-fmt
209+
210+
Note: The ocamlformat configuration file must have the version of the
211+
ocamlformat used in the project.
212+
213+
```yml
214+
jobs:
215+
lint-fmt:
216+
runs-on: ubuntu-latest
217+
steps:
218+
- name: Checkout code
219+
uses: actions/checkout@v2
220+
221+
- name: Use OCaml 4.13.x
222+
uses: ocaml/setup-ocaml@v2
223+
with:
224+
ocaml-compiler: 4.13.x
225+
dune-cache: true
226+
227+
- name: Lint fmt
228+
uses: ocaml/setup-ocaml/lint-fmt@v2
229+
```
230+
231+
See [action.yml](lint-fmt/action.yml) for inputs.
232+
233+
### lint-opam
234+
235+
```yml
236+
jobs:
237+
lint-opam:
238+
runs-on: ubuntu-latest
239+
steps:
240+
- name: Checkout code
241+
uses: actions/checkout@v2
242+
243+
- name: Use OCaml 4.13.x
244+
uses: ocaml/setup-ocaml@v2
245+
with:
246+
ocaml-compiler: 4.13.x
247+
dune-cache: true
248+
249+
- name: Lint opam
250+
uses: ocaml/setup-ocaml/lint-opam@v2
251+
```
252+
253+
See [action.yml](lint-opam/action.yml) for inputs.
254+
145255
## Advanced Configurations
146256

147257
See [Examples](examples.md) for more complex patterns.

action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ inputs:
99
description: The OCaml compiler packages to initialise.
1010
required: true
1111
opam-repositories:
12-
description:
13-
The name and URL pair of the repository to fetch the packages from.
12+
description: The name and URL pair of the repository to fetch the packages from.
1413
required: false
1514
default:
1615
opam-pin:

deploy-doc/action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Deploy odoc
2+
description: Deploy odoc to GitHub Pages
3+
author: Sora Morimoto
4+
branding:
5+
icon: package
6+
color: orange
7+
inputs:
8+
publish-dir:
9+
description: The directory where the document is stored
10+
required: false
11+
default: _build/default/_doc/_html
12+
destination-dir:
13+
description: The subdirectory to deploy
14+
required: false
15+
default:
16+
runs:
17+
using: composite
18+
steps:
19+
- run: opam install . --deps-only --with-doc
20+
shell: bash
21+
- run: opam depext --install doc
22+
shell: bash
23+
- run: opam exec -- dune build @doc
24+
shell: bash
25+
- name: Deploy odoc to GitHub Pages
26+
uses: peaceiris/actions-gh-pages@v3
27+
with:
28+
github_token: ${{ github.token }}
29+
publish_dir: ${{ inputs.publish-dir }}
30+
destination_dir: ${{ inputs.destination-dir }}

lint-doc/action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Lint doc
2+
description: Check if your doc comments are error-and-warning-free
3+
author: Sora Morimoto
4+
branding:
5+
icon: package
6+
color: orange
7+
runs:
8+
using: composite
9+
steps:
10+
- run: opam depext --install conf-m4 dune 'odoc>=1.5.0'
11+
shell: bash
12+
- run: opam exec -- dune build @doc || (echo "dune build @doc failed"; exit 2)
13+
shell: bash
14+
env:
15+
ODOC_WARN_ERROR: true

lint-fmt/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Lint fmt
2+
description: Check if your files are well-formatted
3+
author: Sora Morimoto
4+
branding:
5+
icon: package
6+
color: orange
7+
runs:
8+
using: composite
9+
steps:
10+
- run: opam depext --install ocamlformat=$(awk -F = '/version/{print $2}' .ocamlformat)
11+
shell: bash
12+
- run: opam exec -- dune build @fmt
13+
shell: bash

lint-opam/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Lint opam
2+
description: Check if your dune and opam dependencies are consistent
3+
author: Sora Morimoto
4+
branding:
5+
icon: package
6+
color: orange
7+
runs:
8+
using: composite
9+
steps:
10+
- run: opam install . --deps-only --with-test --with-doc
11+
shell: bash
12+
- run: opam depext --install opam-dune-lint
13+
shell: bash
14+
- run: opam lint
15+
shell: bash
16+
- run: opam exec -- opam-dune-lint
17+
shell: bash

0 commit comments

Comments
 (0)