-
Notifications
You must be signed in to change notification settings - Fork 23
148 lines (138 loc) · 4.78 KB
/
macos.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
name: CI | macOS
on:
push:
paths-ignore:
- '*.md'
- 'doc/**'
- 'windows/**'
pull_request:
paths-ignore:
- '*.md'
- 'doc/**'
- 'windows/**'
jobs:
ci:
name: CI | macOS with homebrew
runs-on: macos-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with: # For tools/get-version:
fetch-depth: 0
- name: Install dependencies
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
brew update
brew install \
erlang \
openssl \
libyaml \
rebar3
- name: Cache Rebar data
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: ${{ runner.os }}-${{ hashFiles('rebar.config') }}
- name: Download dependencies
run: rebar3 get-deps
- name: Compile code
env:
LDFLAGS: -L/usr/local/opt/openssl/lib -L/usr/local/lib
CFLAGS: -I/usr/local/opt/openssl/include/ -I/usr/local/include
CPPFLAGS: -I/usr/local/opt/openssl/include/ -I/usr/local/include
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 || rebar3 ct
shell: bash
- name: Run white-box tests (EUnit)
run: rebar3 eunit
- name: Check test coverage
run: rebar3 cover
formula:
name: On ${{ matrix.os }} | install & test ${{ matrix.vsn }} Formula
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [macos, ubuntu]
vsn: [head, stable]
fail-fast: false
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Cache Homebrew Bundler RubyGems
id: cache
uses: actions/cache@v3
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ runner.os }}-rubygems-
- name: Install Homebrew Bundler RubyGems
if: steps.cache.outputs.cache-hit != 'true'
run: brew install-bundler-gems
- name: Install eturnal with homebrew formula
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
if [ ${{ matrix.vsn }} = 'head' ]; then export vsn='--head'; fi
# Download eturnal.rb instead of `brew tap` to avoid failures when
# running on branches or pull requests -> requires actions/checkout
curl -O https://raw.githubusercontent.com/${{ github.repository }}/$(git rev-parse HEAD)/Formula/eturnal.rb
brew install --build-from-source ${vsn:-} --verbose ./eturnal.rb
- name: Homebrew autoremove unused packages
if: matrix.os != 'ubuntu'
run: |
brew uninstall erlang rebar3
brew autoremove
- name: Run eturnal Formula test
run: brew test --verbose eturnal
- name: Start eturnal service
run: brew services start eturnal
- name: Check if eturnal is up & running ...
run: |
max_iterations=60
iterations=0
while true
do
iterations="$(expr $iterations + 1)"
echo ">> Attempt $iterations from $max_iterations"
sleep 1
if [ "$(eturnalctl ping)" = 'pong' ]; then
echo '>> eturnal is running! ...'
break
fi
if [ "$iterations" -ge "$max_iterations" ]; then
echo '>> Loop Timeout!'
exit 1
fi
done
- name: Print eturnal info
run: eturnalctl info
- name: Create test credentials
run: $(brew --prefix)/opt/eturnal/bin/eturnalctl credentials
- name: Stop eturnal service
run: brew services stop eturnal
- name: Lint formula
## we know, it fails due to non-executables in the /bin directory, but
## we want to see if anything else needs further investigation
continue-on-error: true
run: brew audit --strict eturnal