-
-
Notifications
You must be signed in to change notification settings - Fork 79
155 lines (134 loc) · 4.75 KB
/
build.yml
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
154
name: Build
on:
pull_request:
push:
branches:
- main
tags:
- "v*.*.*"
jobs:
build:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
include:
- os: ubuntu-latest
artifact: "linux-x64"
ocaml-compiler: "ocaml-variants.5.2.0+options,ocaml-option-flambda"
triplet: "x64-linux"
- os: windows-latest
artifact: "windows-x64"
ocaml-compiler: "ocaml-variants.5.2.0+options,ocaml-option-flambda"
triplet: "x64-mingw-static"
- os: macos-latest
artifact: "macos-arm64"
ocaml-compiler: "ocaml-variants.5.2.0+options,ocaml-option-flambda"
triplet: "arm64-osx"
- os: macos-13
artifact: "macos-x64"
ocaml-compiler: "ocaml-variants.5.2.0+options,ocaml-option-flambda"
triplet: "x64-osx"
defaults:
run:
shell: bash
steps:
- uses: actions/[email protected]
- if: runner.os == 'Windows'
run: |
rm -rf $(which pkg-config)
choco install pkgconfiglite
- run: gcc --version
- uses: lukka/get-cmake@latest
- name: Setup anew (or from cache) vcpkg (and does not build any package)
uses: lukka/run-vcpkg@v11
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.triplet }}
with:
runVcpkgInstall: true
runVcpkgFormatString: '["install", "--clean-after-build"]'
- name: Set pkg-config path on Unix
if: runner.os != 'Windows'
run: |
ls "${GITHUB_WORKSPACE}/vcpkg_installed/${VCPKG_DEFAULT_TRIPLET}/lib/pkgconfig"
echo "PKG_CONFIG_PATH=${GITHUB_WORKSPACE}/vcpkg_installed/${VCPKG_DEFAULT_TRIPLET}/lib/pkgconfig" >> $GITHUB_ENV
- name: Set pkg-config path on Unix
shell: bash
if: runner.os == 'Windows'
run: |
echo "PKG_CONFIG_PATH=${GITHUB_WORKSPACE}\vcpkg_installed\\${VCPKG_DEFAULT_TRIPLET}\lib\pkgconfig" >> $GITHUB_ENV
- shell: bash
run: |
echo "LIBPNG_CFLAGS=$(pkg-config --cflags libspng_static)" >> $GITHUB_ENV
echo "LIBPNG_LIBS=$(pkg-config --libs libspng_static)" >> $GITHUB_ENV
echo "LIBTIFF_LIBS=$(pkg-config --libs libtiff-4)" >> $GITHUB_ENV
echo "LIBTIFF_CFLAGS=$(pkg-config --cflags libtiff-4)" >> $GITHUB_ENV
echo "LIBJPEG_CFLAGS=$(pkg-config --cflags libturbojpeg)" >> $GITHUB_ENV
echo "LIBJPEG_LIBS=$(pkg-config --libs libturbojpeg)" >> $GITHUB_ENV
- uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-disable-sandboxing: true
dune-cache: false
- run: opam exec -- opam install . --deps-only --with-test
- run: opam exec -- dune build --verbose
- name: Give binary system-specific name
run: cp "_build/default/bin/ODiffBin.exe" "odiff-${{ matrix.artifact }}.exe"
- run: opam exec -- dune exec ODiffBin -- --version
- run: opam exec -- dune runtest
- if: failure()
uses: actions/upload-artifact@v4
with:
name: test_images
path: _build/default/test/test_images
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Install node deps
run: npm ci
- name: e2e test
run: npm test
- if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: odiff-${{ matrix.artifact }}.exe
path: odiff-${{ matrix.artifact }}.exe
retention-days: 14
publish:
name: Publish release
needs: [build]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Download built binaries
uses: actions/download-artifact@v4
with:
pattern: odiff-*.exe
merge-multiple: true
path: npm_package/raw_binaries
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
always-auth: true
registry-url: 'https://registry.npmjs.org'
cache-dependency-path: 'package-lock.json'
- name: Publish npm package
working-directory: npm_package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create github release
uses: softprops/action-gh-release@v1
with:
files: "npm_package/raw_binaries/*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}