-
Notifications
You must be signed in to change notification settings - Fork 20
103 lines (103 loc) · 3.68 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
102
103
---
name: build
on:
push:
branches:
- master
pull_request:
branches:
- "*"
workflow_dispatch: {}
jobs:
ci:
name: Run checks and tests over ${{matrix.otp_vsn}}
runs-on: ubuntu-22.04
strategy:
matrix:
otp_vsn: ['24', '25', '26']
rebar3_vsn: ['3.22']
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
id: setup-beam
with:
otp-version: ${{matrix.otp_vsn}}
rebar3-version: ${{matrix.rebar3_vsn}}
- name: Restore _build
uses: actions/cache@v3
with:
path: _build
key: "_build-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam.outputs.otp-version}}\
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: Restore rebar3's cache
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: "rebar3-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam.outputs.otp-version}}\
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- run: rebar3 format --verify
- run: |
rm -rf example/_checkouts # Prevent long running analysis
rebar3 test
example:
name: Makes sure our example run over ${{matrix.otp_vsn}}
runs-on: ubuntu-22.04
strategy:
matrix:
otp_vsn: ['24', '25', '26']
rebar3_vsn: ['3.22']
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
id: setup-beam-example
with:
otp-version: ${{matrix.otp_vsn}}
rebar3-version: ${{matrix.rebar3_vsn}}
- name: Restore _build
uses: actions/cache@v3
with:
path: example/_build
key: "_build-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam-example.outputs.otp-version}}\
-rebar3-${{steps.setup-beam-example.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: Restore rebar3's cache
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: "rebar3-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam-example.outputs.otp-version}}\
-rebar3-${{steps.setup-beam-example.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: test our example
run: |
cd example
rebar3 release
_build/default/rel/example/bin/example daemon
R=$(curl -s -w "%{http_code}" -XPUT "localhost:8080/poor-kv/some-key/some-value" -H "content-type: text/plain")
[[ $R == "some-value201" ]] || exit 1 # This becomes some-value200 after the first PUT
R=$(curl -s -w "%{http_code}" "localhost:8080/poor-kv/some-key" -H "content-type: text/plain")
[[ $R == "some-value200" ]] || exit 1
R=$(curl -s -w "%{http_code}" "localhost:8080/poor-kv/non-existing-key" -H "content-type: text/plain")
[[ $R == "404" ]] || exit 1
R=$(curl -s -w "%{http_code}" -XDELETE "localhost:8080/poor-kv/some-key" -H "content-type: text/plain")
[[ $R == "204" ]] || exit 1
R=$(curl -s -w "%{http_code}" -XDELETE "localhost:8080/poor-kv/some-key" -H "content-type: text/plain")
[[ $R == "404" ]] || exit 1
_build/default/rel/example/bin/example stop
- name: Format check
run: |
cd example
rebar3 format --verify
- name: check our example
run: |
cd example
rebar3 test