Skip to content

Commit 5f21687

Browse files
committed
Add mlx syntax support
- Allow mlx patch versions (0.28.1.x) in config checks to be compatible with upstream 0.28.1 configs
1 parent 86f8112 commit 5f21687

File tree

39 files changed

+909
-244
lines changed

39 files changed

+909
-244
lines changed

.github/workflows/build-linux.yml

Lines changed: 90 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ on:
77
push:
88
branches:
99
- main
10+
tags:
11+
- '*'
1012
pull_request:
1113
workflow_dispatch:
1214

15+
permissions: read-all
16+
1317
jobs:
1418
build-linux:
1519
strategy:
@@ -36,81 +40,114 @@ jobs:
3640
- name: Opam dependencies
3741
run: opam install --deps-only -t .
3842

39-
- name: Format
40-
run: opam exec -- dune fmt
43+
# - name: Format
44+
# run: opam exec -- dune fmt
4145

4246
- name: Build
4347
run: |
4448
opam exec -- dune subst
45-
opam exec -- dune build -p ocamlformat-lib,ocamlformat
49+
opam exec -- dune build -p ocamlformat-mlx-lib,ocamlformat-mlx
4650
4751
- name: Runtest
4852
run: opam exec -- dune runtest
4953

50-
- name: Check manpages
51-
run: opam exec -- dune build @gen_manpage --auto-promote
54+
# - name: Check manpages
55+
# run: opam exec -- dune build @gen_manpage --auto-promote
5256

5357
- name: Upload binary
5458
# Using a specific version because of https://github.com/actions/upload-artifact/issues/590
5559
uses: actions/upload-artifact@v4.3.4
5660
with:
5761
name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
58-
path: _build/install/default/bin/ocamlformat
62+
path: _build/install/default/bin/ocamlformat-mlx
5963

60-
test-branch:
61-
if: ${{ github.ref != 'refs/heads/main' }}
64+
release:
6265
needs: build-linux
66+
permissions:
67+
contents: write # Required for pushing tags and creating releases
68+
pull-requests: write # Required for pushing opam PR
69+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
6370
runs-on: ubuntu-latest
64-
strategy:
65-
matrix:
66-
profile:
67-
- conventional
68-
- ocamlformat
69-
- janestreet
70-
# To enable comparing with ocp-indent:
71-
# include:
72-
# - ocp_indent: true
73-
# ocp_indent_config: JaneStreet
74-
# profile: janestreet
7571

7672
steps:
77-
- name: Install ocp-indent
78-
if: ${{ matrix.ocp_indent }}
79-
run: |
80-
sudo apt install -y ocp-indent
81-
sudo touch /etc/ocamlfind.conf
82-
83-
# Clone the project
84-
- uses: actions/checkout@v3
73+
- name: checkout tree
74+
uses: actions/checkout@v4
8575
with:
86-
fetch-depth: 0
76+
submodules: 'true'
8777

88-
- uses: actions/cache@v3
78+
- name: set-up OCaml
79+
uses: ocaml/setup-ocaml@v3
8980
with:
90-
path: test-extra/code
91-
key: test-extra-code
81+
ocaml-compiler: "5.4"
9282

93-
- name: Fetch main build of ocamlformat
94-
uses: dawidd6/action-download-artifact@v6
95-
with:
96-
workflow: build-linux.yml
97-
workflow_conclusion: ""
98-
check_artifacts: true
99-
branch: main
100-
name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
101-
path: ocamlformat-a
83+
- name: Opam dependencies
84+
run: opam install --deps-only -t .
10285

103-
- name: Fetch new build of ocamlformat
104-
uses: actions/download-artifact@v4.1.7
105-
with:
106-
name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
107-
path: ocamlformat-b
86+
- run: opam install dune-release -y
10887

109-
- name: Test ${{ matrix.profile }} profile
110-
run: |
111-
chmod +x ocamlformat-a/ocamlformat ocamlformat-b/ocamlformat
112-
./tools/test_branch.sh $TEST_BRANCH_ARGS -n -a ocamlformat-a/ocamlformat -b ocamlformat-b/ocamlformat 'profile=${{ matrix.profile }}'
113-
shell: bash
114-
env:
115-
OCP_INDENT_CONFIG: ${{ matrix.ocp_indent_config }}
116-
TEST_BRANCH_ARGS: ${{ matrix.ocp_indent && '-o -s' || '' }}
88+
- name: Run dune-release
89+
uses: davesnx/dune-release-action@v0.2.13
90+
with:
91+
packages: "ocamlformat-mlx,ocamlformat-mlx-lib"
92+
github-token: ${{ secrets.GH_TOKEN }}
93+
to-opam-repository: true
94+
to-github-releases: true
95+
96+
# test-branch:
97+
# if: ${{ github.ref != 'refs/heads/main' }}
98+
# needs: build-linux
99+
# runs-on: ubuntu-latest
100+
# strategy:
101+
# matrix:
102+
# profile:
103+
# - conventional
104+
# - ocamlformat
105+
# - janestreet
106+
# # To enable comparing with ocp-indent:
107+
# # include:
108+
# # - ocp_indent: true
109+
# # ocp_indent_config: JaneStreet
110+
# # profile: janestreet
111+
#
112+
# steps:
113+
# - name: Install ocp-indent
114+
# if: ${{ matrix.ocp_indent }}
115+
# run: |
116+
# sudo apt install -y ocp-indent
117+
# sudo touch /etc/ocamlfind.conf
118+
#
119+
# # Clone the project
120+
# - uses: actions/checkout@v3
121+
# with:
122+
# fetch-depth: 0
123+
#
124+
# - uses: actions/cache@v3
125+
# with:
126+
# path: test-extra/code
127+
# key: test-extra-code
128+
#
129+
# - name: Fetch main build of ocamlformat
130+
# uses: dawidd6/action-download-artifact@v6
131+
# with:
132+
# workflow: build-linux.yml
133+
# workflow_conclusion: ""
134+
# check_artifacts: true
135+
# branch: main
136+
# name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
137+
# path: ocamlformat-a
138+
# allow_forks: true
139+
#
140+
# - name: Fetch new build of ocamlformat
141+
# uses: actions/download-artifact@v4.1.7
142+
# with:
143+
# name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
144+
# path: ocamlformat-b
145+
#
146+
# - name: Test ${{ matrix.profile }} profile
147+
# run: |
148+
# chmod +x ocamlformat-a/ocamlformat ocamlformat-b/ocamlformat
149+
#./tools/test_branch.sh $TEST_BRANCH_ARGS -n -a ocamlformat-a/ocamlformat -b ocamlformat-b/ocamlformat 'profile=${{ matrix.profile }}'
150+
# shell: bash
151+
# env:
152+
# OCP_INDENT_CONFIG: ${{ matrix.ocp_indent_config }}
153+
# TEST_BRANCH_ARGS: ${{ matrix.ocp_indent && '-o -s' || '' }}

.github/workflows/build-mingw64.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,21 @@ jobs:
4343

4444
- name: Install dependencies
4545
run: |
46-
opam pin add -yn ocamlformat-lib.dev .
47-
opam pin add -yn ocamlformat.dev .
48-
opam install -y --deps-only ocamlformat
46+
opam pin add -yn ocamlformat-mlx-lib.dev .
47+
opam pin add -yn ocamlformat-mlx.dev .
48+
opam install -y --deps-only ocamlformat-mlx
4949
5050
- name: Build
5151
run: |
5252
opam exec -- dune subst
53-
opam exec -- dune build -p ocamlformat-lib,ocamlformat @install
54-
opam exec -- dune install --prefix=install ocamlformat
55-
Copy-Item ${{ github.workspace }}\\install\\bin\\ocamlformat.exe -Destination .\${{ env.artifact_name }}
53+
opam exec -- dune build -p ocamlformat-mlx-lib,ocamlformat-mlx @install
54+
opam exec -- dune install --prefix=install ocamlformat-mlx
55+
Copy-Item ${{ github.workspace }}\\install\\bin\\ocamlformat-mlx.exe -Destination .\${{ env.artifact_name }}
5656
5757
- name: Version check
5858
run: |
5959
echo "Version check:"
60-
install/bin/ocamlformat.exe --version
60+
install/bin/ocamlformat-mlx.exe --version
6161
6262
- name: Upload Artifact
6363
uses: actions/upload-artifact@v4

.github/workflows/build-others.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
- name: Opam dependencies
3838
run: opam install --deps-only -t .
3939

40-
- name: Format
41-
run: opam exec -- dune fmt
40+
# - name: Format
41+
# run: opam exec -- dune fmt
4242

4343
- name: Runtest
4444
run: opam exec -- dune runtest

.github/workflows/changelog-check.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: tarides/changelog-check-action@v1
14+
# We don't push changelog entries
15+
# steps:
16+
# - uses: tarides/changelog-check-action@v1

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ default: exe
1414

1515
.PHONY: exe
1616
exe:
17-
@dune build bin/ocamlformat/main.exe bin/ocamlformat-rpc/main.exe
17+
@dune build bin/ocamlformat/main.exe
1818

1919
.PHONY: clean
2020
clean:

bin/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(data_only_dirs ocamlformat-rpc)

bin/ocamlformat/dune

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111

1212
(executable
1313
(name main)
14-
(public_name ocamlformat)
15-
(package ocamlformat)
14+
(public_name ocamlformat-mlx)
15+
(package ocamlformat-mlx)
1616
(modules main)
1717
(flags
1818
(:standard -open Ocamlformat_stdlib))
1919
(instrumentation
2020
(backend bisect_ppx))
21-
(libraries ocamlformat-lib bin_conf))
21+
(libraries ocamlformat-mlx-lib bin_conf))
2222

2323
(rule
2424
(with-stdout-to
2525
ocamlformat.1
2626
(run ./main.exe --help=groff)))
2727

28-
(install
29-
(section man)
30-
(files ocamlformat.1)
31-
(package ocamlformat))
28+
; (install
29+
; (section man)
30+
; (files ocamlformat.1)
31+
; (package ocamlformat))

dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
(flags
1515
(:standard -noassert))))
1616

17-
(data_only_dirs test-extra)
17+
(data_only_dirs test-extra mlx lib-rpc lib-rpc-server emacs doc bench tools)
1818

1919
(rule
2020
(with-stdout-to

0 commit comments

Comments
 (0)