File: build-linux.yml

package info (click to toggle)
ocamlformat 0.28.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,436 kB
  • sloc: ml: 63,321; pascal: 4,769; lisp: 229; sh: 217; makefile: 121
file content (116 lines) | stat: -rw-r--r-- 3,289 bytes parent folder | download
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
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
  pull_request:
  workflow_dispatch:

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-lib,ocamlformat

      - 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

  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

      - 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' || '' }}