Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 90 additions & 53 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ on:
push:
branches:
- main
tags:
- '*'
pull_request:
workflow_dispatch:

permissions: read-all

jobs:
build-linux:
strategy:
Expand All @@ -36,81 +40,114 @@ jobs:
- name: Opam dependencies
run: opam install --deps-only -t .

- name: Format
run: opam exec -- dune fmt
# - name: Format
# run: opam exec -- dune fmt

- name: Build
run: |
opam exec -- dune subst
opam exec -- dune build -p ocamlformat-lib,ocamlformat
opam exec -- dune build -p ocamlformat-mlx-lib,ocamlformat-mlx

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

- name: Check manpages
run: opam exec -- dune build @gen_manpage --auto-promote
# - name: Check manpages
# run: opam exec -- dune build @gen_manpage --auto-promote

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

test-branch:
if: ${{ github.ref != 'refs/heads/main' }}
release:
needs: build-linux
permissions:
contents: write # Required for pushing tags and creating releases
pull-requests: write # Required for pushing opam PR
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
strategy:
matrix:
profile:
- conventional
- ocamlformat
- janestreet
# To enable comparing with ocp-indent:
# include:
# - ocp_indent: true
# ocp_indent_config: JaneStreet
# profile: janestreet

steps:
- name: Install ocp-indent
if: ${{ matrix.ocp_indent }}
run: |
sudo apt install -y ocp-indent
sudo touch /etc/ocamlfind.conf

# Clone the project
- uses: actions/checkout@v3
- name: checkout tree
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'true'

- uses: actions/cache@v3
- name: set-up OCaml
uses: ocaml/setup-ocaml@v3
with:
path: test-extra/code
key: test-extra-code
ocaml-compiler: "5.4"

- name: Fetch main build of ocamlformat
uses: dawidd6/action-download-artifact@v6
with:
workflow: build-linux.yml
workflow_conclusion: ""
check_artifacts: true
branch: main
name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
path: ocamlformat-a
- name: Opam dependencies
run: opam install --deps-only -t .

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

- name: Test ${{ matrix.profile }} profile
run: |
chmod +x ocamlformat-a/ocamlformat ocamlformat-b/ocamlformat
./tools/test_branch.sh $TEST_BRANCH_ARGS -n -a ocamlformat-a/ocamlformat -b ocamlformat-b/ocamlformat 'profile=${{ matrix.profile }}'
shell: bash
env:
OCP_INDENT_CONFIG: ${{ matrix.ocp_indent_config }}
TEST_BRANCH_ARGS: ${{ matrix.ocp_indent && '-o -s' || '' }}
- name: Run dune-release
uses: davesnx/dune-release-action@v0.2.13
with:
packages: "ocamlformat-mlx,ocamlformat-mlx-lib"
github-token: ${{ secrets.GH_TOKEN }}
to-opam-repository: true
to-github-releases: true

# test-branch:
# if: ${{ github.ref != 'refs/heads/main' }}
# needs: build-linux
# runs-on: ubuntu-latest
# strategy:
# matrix:
# profile:
# - conventional
# - ocamlformat
# - janestreet
# # To enable comparing with ocp-indent:
# # include:
# # - ocp_indent: true
# # ocp_indent_config: JaneStreet
# # profile: janestreet
#
# steps:
# - name: Install ocp-indent
# if: ${{ matrix.ocp_indent }}
# run: |
# sudo apt install -y ocp-indent
# sudo touch /etc/ocamlfind.conf
#
# # Clone the project
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - uses: actions/cache@v3
# with:
# path: test-extra/code
# key: test-extra-code
#
# - name: Fetch main build of ocamlformat
# uses: dawidd6/action-download-artifact@v6
# with:
# workflow: build-linux.yml
# workflow_conclusion: ""
# check_artifacts: true
# branch: main
# name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
# path: ocamlformat-a
# allow_forks: true
#
# - name: Fetch new build of ocamlformat
# uses: actions/download-artifact@v4.1.7
# with:
# name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
# path: ocamlformat-b
#
# - name: Test ${{ matrix.profile }} profile
# run: |
# chmod +x ocamlformat-a/ocamlformat ocamlformat-b/ocamlformat
#./tools/test_branch.sh $TEST_BRANCH_ARGS -n -a ocamlformat-a/ocamlformat -b ocamlformat-b/ocamlformat 'profile=${{ matrix.profile }}'
# shell: bash
# env:
# OCP_INDENT_CONFIG: ${{ matrix.ocp_indent_config }}
# TEST_BRANCH_ARGS: ${{ matrix.ocp_indent && '-o -s' || '' }}
14 changes: 7 additions & 7 deletions .github/workflows/build-mingw64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ jobs:

- name: Install dependencies
run: |
opam pin add -yn ocamlformat-lib.dev .
opam pin add -yn ocamlformat.dev .
opam install -y --deps-only ocamlformat
opam pin add -yn ocamlformat-mlx-lib.dev .
opam pin add -yn ocamlformat-mlx.dev .
opam install -y --deps-only ocamlformat-mlx

- name: Build
run: |
opam exec -- dune subst
opam exec -- dune build -p ocamlformat-lib,ocamlformat @install
opam exec -- dune install --prefix=install ocamlformat
Copy-Item ${{ github.workspace }}\\install\\bin\\ocamlformat.exe -Destination .\${{ env.artifact_name }}
opam exec -- dune build -p ocamlformat-mlx-lib,ocamlformat-mlx @install
opam exec -- dune install --prefix=install ocamlformat-mlx
Copy-Item ${{ github.workspace }}\\install\\bin\\ocamlformat-mlx.exe -Destination .\${{ env.artifact_name }}

- name: Version check
run: |
echo "Version check:"
install/bin/ocamlformat.exe --version
install/bin/ocamlformat-mlx.exe --version

- name: Upload Artifact
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-others.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
- name: Opam dependencies
run: opam install --deps-only -t .

- name: Format
run: opam exec -- dune fmt
# - name: Format
# run: opam exec -- dune fmt

- name: Runtest
run: opam exec -- dune runtest
3 changes: 3 additions & 0 deletions .github/workflows/changelog-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: tarides/changelog-check-action@v1
# We don't push changelog entries
# steps:
# - uses: tarides/changelog-check-action@v1
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ default: exe

.PHONY: exe
exe:
@dune build bin/ocamlformat/main.exe bin/ocamlformat-rpc/main.exe
@dune build bin/ocamlformat/main.exe

.PHONY: clean
clean:
Expand Down
1 change: 1 addition & 0 deletions bin/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(data_only_dirs ocamlformat-rpc)
14 changes: 7 additions & 7 deletions bin/ocamlformat/dune
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@

(executable
(name main)
(public_name ocamlformat)
(package ocamlformat)
(public_name ocamlformat-mlx)
(package ocamlformat-mlx)
(modules main)
(flags
(:standard -open Ocamlformat_stdlib))
(instrumentation
(backend bisect_ppx))
(libraries ocamlformat-lib bin_conf))
(libraries ocamlformat-mlx-lib bin_conf))

(rule
(with-stdout-to
ocamlformat.1
(run ./main.exe --help=groff)))

(install
(section man)
(files ocamlformat.1)
(package ocamlformat))
; (install
; (section man)
; (files ocamlformat.1)
; (package ocamlformat))
2 changes: 1 addition & 1 deletion dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(flags
(:standard -noassert))))

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

(rule
(with-stdout-to
Expand Down
Loading
Loading