This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
101 lines (85 loc) · 2.76 KB
/
ci.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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-18.04, windows-latest]
# syntax explanation:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations
include:
- os: macos-latest
build: eval $(opam env) && dune build && npm test
artifact-folder: darwin
- os: ubuntu-18.04
build: eval $(opam env) && dune build && npm test
artifact-folder: linux
- os: windows-latest
build: "& $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- dune build"
artifact-folder: win32
runs-on: ${{matrix.os}}
steps:
# needed for Windows testing
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/[email protected]
- name: Cache OCaml's opam
uses: actions/[email protected]
with:
path: ~/.opam
key: ${{matrix.os}}-rescript-vscode-v2
- name: Use OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.12.x
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 14.4.0
- run: npm ci
- run: opam install dune
- name: Build and test
run: ${{matrix.build}}
# Also avoids artifacts upload permission loss:
# https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss
- name: Compress files
run: |
mkdir ${{matrix.artifact-folder}}
cp _build/default/src/GenType.exe gentype.exe
tar -cvf binary.tar gentype.exe
- uses: actions/upload-artifact@v2
with:
name: ${{matrix.os}}
path: binary.tar
npm_pack:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: download binaries
uses: actions/download-artifact@v2
- name: Pack genType
run: |
# Put the built artifacts in the appropriate package folder
tar xf macos-latest/binary.tar -C dist/vendor-darwin
tar xf ubuntu-18.04/binary.tar -C dist/vendor-linux
tar xf windows-latest/binary.tar -C dist/vendor-win32
# Add the correct package.json / README / etc to dist
node scripts/prepare_release.js
# Pack everything up
cd dist
npm pack
cd ..
mv dist/gentype-*.tgz gentype-npm.tgz
- name: upload gentype-npm.tgz
uses: actions/upload-artifact@v2
with:
name: gentype-npm.tgz
path: gentype-npm.tgz