-
Notifications
You must be signed in to change notification settings - Fork 22
122 lines (120 loc) · 3.77 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: CI
on:
push:
paths-ignore:
- '*.md'
- 'examples/**'
- 'Formula/**'
pull_request:
paths-ignore:
- '*.md'
- 'examples/**'
- 'Formula/**'
jobs:
test:
name: Test on Erlang/OTP ${{ matrix.otp }}
runs-on: ubuntu-20.04
strategy:
matrix:
otp:
- '21.0'
- '21.3'
- '22.0'
- '26.0'
include:
- otp: '21.0'
rebar: '3.15.2'
- otp: '21.3'
rebar: '3.15.2'
- otp: '22.0'
rebar: '3.18.0'
- otp: '26.0'
rebar: '3.22.0'
fail-fast: false
steps:
- name: Install prerequisites
run: |
sudo apt-get -qq update
sudo apt-get -qq install libyaml-dev
- name: Check out repository code
uses: actions/checkout@v3
- name: Cache Rebar data
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.rebar }}-${{ hashFiles('rebar.config') }}
- name: Download Erlang/OTP ${{ matrix.otp }} and Rebar ${{ matrix.rebar }}
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
rebar3-version: ${{ matrix.rebar }}
version-type: strict
- name: Download previous test results
run: |
mkdir -p _build/test
curl -sSL https://github.com/weiss/eturnal/tarball/gh-pages |
tar -C _build/test --strip-components=1 --wildcards -xzf - '*/logs/'
- name: Download dependencies
run: rebar3 get-deps
- name: Compile code
run: rebar3 compile
- name: Build release
run: rebar3 release
- name: Start release
run: _build/default/rel/eturnal/bin/eturnal daemon
- name: Ping release
run: _build/default/rel/eturnal/bin/eturnal ping
- name: Stop release
run: _build/default/rel/eturnal/bin/eturnal stop
- name: Analyze cross references
run: rebar3 xref
- name: Perform static code analysis
run: rebar3 dialyzer
- name: Run black-box tests (CT)
run: rebar3 ct
- name: Run white-box tests (EUnit)
run: rebar3 eunit
- name: Check test coverage
run: rebar3 cover
- name: Check code style
run: rebar3 lint # Requires Erlang/OTP 23 or newer:
if: matrix.otp != 21.0 && matrix.otp != 21.3 && matrix.otp != 22.0
- name: Build production release
run: rebar3 as prod release
- name: Build distribution release
run: rebar3 as distro release
env:
SKIP_DEPS: true
- name: Upload test and coverage results
uses: actions/upload-artifact@v3
if: always()
with:
name: eturnal-tests-otp-${{ matrix.otp }}
#
# Appending the wildcard character ("*") is a trick to make "test" the
# root directory of the uploaded ZIP file:
#
# https://github.com/actions/upload-artifact#upload-using-multiple-paths-and-exclusions
#
path: |
_build/test*/logs
_build/test*/cover
publish:
name: Publish test results
runs-on: ubuntu-latest
needs: test
if: github.ref_name == 'master' && github.repository_owner == 'weiss' && always()
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Retrieve test and coverage results
uses: actions/download-artifact@v3
with:
name: eturnal-tests-otp-26.0
path: public
- name: Deploy test and coverage results to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
cname: ci.eturnal.net
publish_dir: public/test
github_token: ${{ secrets.GITHUB_TOKEN }}