|
9 | 9 | required: true |
10 | 10 | default: 'main' |
11 | 11 |
|
12 | | -env: |
13 | | - CYGWINSETUP: setup-x86_64.exe |
14 | | - PACKAGES: git,m4,patchutils,make,curl,unzip,mingw64-x86_64-binutils,mingw64-x86_64-gcc-core,mingw64-x86_64-headers,mingw64-x86_64-runtime |
15 | | - SITE: https://mirrors.kernel.org/sourceware/cygwin |
16 | | - |
17 | 12 | jobs: |
18 | 13 | build: |
19 | 14 | runs-on: windows-latest |
20 | | - env: |
21 | | - SHELLOPTS: igncr |
22 | 15 | steps: |
23 | | - - name: Set Build Ref for Release Builds |
| 16 | + - name: Set ref for release builds |
24 | 17 | if: github.event_name == 'release' |
25 | 18 | run: | |
26 | 19 | "build_ref=${{ github.ref }}" >> $env:GITHUB_ENV |
27 | | - - name: Set Build Ref for Manual Builds |
| 20 | +
|
| 21 | + - name: Set ref for manual builds |
28 | 22 | if: github.event_name == 'workflow_dispatch' |
29 | 23 | run: | |
30 | 24 | "build_ref=${{ github.event.inputs.ref }}" >> $env:GITHUB_ENV |
| 25 | +
|
| 26 | + - name: Set artifact name |
| 27 | + shell: bash |
| 28 | + run: | |
| 29 | + echo "artifact_name=ocamlformat-${build_ref##*/}.exe" >> $GITHUB_ENV |
| 30 | +
|
31 | 31 | - name: Disable Git EOL Conversion |
32 | 32 | run: | |
33 | 33 | git config --global core.autocrlf false |
| 34 | +
|
34 | 35 | - name: Checkout Repository |
35 | 36 | uses: actions/checkout@v3 |
36 | 37 | with: |
37 | 38 | ref: ${{ env.build_ref }} |
38 | | - - name: Download Cygwin Installer |
39 | | - run: | |
40 | | - curl.exe -o C:\${{ env.CYGWINSETUP }} https://www.cygwin.com/${{ env.CYGWINSETUP }} |
41 | | - shell: cmd |
42 | | - - name: Setup Cygwin |
| 39 | + |
| 40 | + - uses: ocaml/setup-ocaml@v2 |
| 41 | + with: |
| 42 | + ocaml-compiler: 4.14.x |
| 43 | + opam-repositories: | |
| 44 | + default: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset |
| 45 | + opam: https://github.com/ocaml/opam-repository.git |
| 46 | +
|
| 47 | + - name: Install dependencies |
43 | 48 | run: | |
44 | | - C:\${{ env.CYGWINSETUP }} -A -q -D -L -g -o -s ${{ env.SITE }} -l C:\cygwin64-cache -R C:\cygwin64 -C Base -P ${{ env.PACKAGES }} |
45 | | - shell: cmd |
46 | | - - name: Run Build Script |
| 49 | + opam pin add -yn ocamlformat-lib.dev . |
| 50 | + opam pin add -yn ocamlformat.dev . |
| 51 | + opam install -y --deps-only ocamlformat |
| 52 | +
|
| 53 | + - name: Build |
47 | 54 | run: | |
48 | | - cd '${{ github.workspace }}' |
49 | | - git config --global --add safe.directory "$(pwd)" |
50 | | - bash tools/build-mingw64.sh |
51 | | - echo "artifact_name=ocamlformat-$(basename ${{ env.build_ref }}).exe" >> $GITHUB_ENV |
52 | | - shell: C:\cygwin64\bin\bash.exe --login --norc '{0}' |
53 | | - - name: Rename Artifact |
| 55 | + opam exec -- dune subst |
| 56 | + opam exec -- dune build -p ocamlformat-lib,ocamlformat @install |
| 57 | + opam exec -- dune install --prefix=./install ocamlformat |
| 58 | +
|
| 59 | + - name: Version check |
54 | 60 | run: | |
55 | | - Copy-Item ${{ github.workspace }}\_build\install\default\bin\ocamlformat.exe -Destination .\${{ env.artifact_name }} |
| 61 | + echo "Version check:" |
| 62 | + install/bin/ocamlformat --version |
| 63 | +
|
56 | 64 | - name: Upload Artifact |
57 | 65 | uses: actions/upload-artifact@v3 |
58 | 66 | with: |
59 | 67 | name: ${{ env.artifact_name }} |
60 | | - path: ${{ env.artifact_name }} |
| 68 | + path: install/bin/ocamlformat |
61 | 69 | if-no-files-found: error |
| 70 | + |
62 | 71 | - name: Upload Release Asset |
63 | 72 | if: github.event_name == 'release' |
64 | 73 | run: > |
|
0 commit comments