-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (113 loc) · 4.04 KB
/
common.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
name: Common CI workflow
on:
push:
pull_request:
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
ocaml-version:
- 5.1.x
## we only test all versions at the [all-variants] flow
node-version:
- lts/hydrogen # v18 Active LTS
if: github.repository == 'kxcinc/bindoj'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 2
- name: Use OCaml ${{ matrix.ocaml-version }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache-dependency-path: 'with_js/yarn.lock'
- name: Cache OPAM switch
id: cache-switch
uses: actions/cache@v3
with:
path: _opam
key: v1-${{ runner.os }}-${{ matrix.ocaml-version }}-opam-switch
- name: check OCaml version and workspace info
run: ./scripts/ci_print_env.sh
- run: sudo ./scripts/ci_setup_ubuntu.sh
- name: Install dependencies
run: opam install . --deps-only --with-test --with-doc
- name: build
run: opam exec -- make gen
- name: check diff
run: |
GITHUB_STATUS_SHA="${{ github.event.pull_request.head.sha }}"
GITHUB_STATUS_SHA="${GITHUB_STATUS_SHA:=$GITHUB_SHA}"
git add *.opam
git add src/
git add tooling/
git add with_js/
git add example/
git diff --cached --exit-code && ( \
curl --request POST \
--url $GITHUB_API_URL/repos/${{ github.repository }}/statuses/$GITHUB_STATUS_SHA \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"state": "success",
"context": "verify-built-artifact"
}' \
--fail \
) || ( \
curl --request POST \
--url $GITHUB_API_URL/repos/${{ github.repository }}/statuses/$GITHUB_STATUS_SHA \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"state": "failure",
"context": "verify-built-artifact"
}' \
--fail \
)
- name: test with coverage
run: opam exec -- make _coverage
- name: doc
run: opam exec -- make _doc
- name: upload odoc generated document
if: ${{ matrix.os == 'ubuntu-latest' && matrix.ocaml-version == '4.13.1' }}
uses: actions/upload-artifact@v3
with:
name: odoc-html-${{ github.sha }}
path: _build/default/_doc/_html/
# doc deployment temporarily disabled
# # https://github.com/amondnet/vercel-action/issues/170 が解決したら最新のタグに更新
# - uses: amondnet/vercel-action@1d26fa06fdab094080b48d33eea2031cee54724d
# if: github.ref != 'refs/heads/main'
# with:
# vercel-token: ${{ secrets.VERCEL_TOKEN }}
# vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
# vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}}
# working-directory: ./
# scope: "kxcinc"
# github-comment: true
# - uses: amondnet/vercel-action@1d26fa06fdab094080b48d33eea2031cee54724d
# if: github.ref == 'refs/heads/main'
# with:
# vercel-token: ${{ secrets.VERCEL_TOKEN }}
# vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
# vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}}
# working-directory: ./
# scope: "kxcinc"
# vercel-args: '--prod'
# github-comment: true
setup-ocaml-checked:
needs: build
runs-on: ubuntu-latest
steps:
- run: echo "all set"