forked from ocaml-ppx/ocamlformat
-
Notifications
You must be signed in to change notification settings - Fork 3
153 lines (133 loc) · 4.24 KB
/
build-linux.yml
File metadata and controls
153 lines (133 loc) · 4.24 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Build on Linux
# Build and run tests on ubuntu-latest.
# The built binary is uploaded for later use in test-branch.
on:
push:
branches:
- main
tags:
- '*'
pull_request:
workflow_dispatch:
permissions: read-all
jobs:
build-linux:
strategy:
matrix:
ocaml-compiler:
# Don't include every versions. OCaml-CI already covers that
- 4.14.x
runs-on: ubuntu-latest
steps:
# Clone the project
- uses: actions/checkout@v2
with:
# Don't checkout the implicit merge commit to avoid wrong substitution
ref: ${{ github.event.pull_request.head.sha }}
# Setup
- name: Setup OCaml ${{ matrix.ocaml-version }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- name: Opam dependencies
run: opam install --deps-only -t .
# - name: Format
# run: opam exec -- dune fmt
- name: Build
run: |
opam exec -- dune subst
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: 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-mlx
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
steps:
- name: checkout tree
uses: actions/checkout@v4
with:
submodules: 'true'
- name: set-up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "5.4"
- name: Opam dependencies
run: opam install --deps-only -t .
- run: opam install dune-release -y
- 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' || '' }}