-
Notifications
You must be signed in to change notification settings - Fork 51
189 lines (170 loc) · 7.16 KB
/
latest_os.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Build and test for Ubuntu latest
on: [push, pull_request]
jobs:
build:
name: Build and install dependencies
runs-on: ubuntu-latest
strategy:
matrix:
openresty-version: [1.19.9.1]
luarocks-version: [3.8.0]
steps:
- name: Update and install OS dependencies
run: sudo apt-get update && sudo apt-get install -y libssl-dev ssl-cert
- name: Set environment variables
env:
LUAROCKS_VER: ${{ matrix.luarocks-version }}
OPENRESTY_VER: ${{ matrix.openresty-version }}
run: |
echo "DOWNLOAD_PATH=$HOME/download-root" >> $GITHUB_ENV
export DOWNLOAD_PATH=$HOME/download-root
echo "INSTALL_PATH=$HOME/install-root" >> $GITHUB_ENV
export INSTALL_PATH=$HOME/install-root
echo "LUAROCKS_VER=$LUAROCKS_VER" >> $GITHUB_ENV
echo "OPENRESTY_VER=$OPENRESTY_VER" >> $GITHUB_ENV
export LUAROCKS_PREFIX=$INSTALL_PATH/luarocks-$LUAROCKS_VER
echo "LUAROCKS_PREFIX=$LUAROCKS_PREFIX" >> $GITHUB_ENV
export OPENRESTY_PREFIX=$INSTALL_PATH/openresty-$OPENRESTY_VER
echo "OPENRESTY_PREFIX=$OPENRESTY_PREFIX" >> $GITHUB_ENV
echo "PATH=$DOWNLOAD_PATH:$LUAROCKS_PREFIX/bin:$OPENRESTY_PREFIX/nginx/sbin:$DOWNLOAD_PATH/cpanm:$PATH" >> $GITHUB_ENV
- name: Checkout lua-resty-healthcheck
uses: actions/checkout@v2
- name: Lookup build cache
uses: actions/cache@v2
id: cache-deps
with:
path: |
${{ env.INSTALL_PATH }}
~/perl5
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/latest_os.yml') }}
- name: Create needed paths
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
mkdir -p $DOWNLOAD_PATH
mkdir -p $INSTALL_PATH
- name: Build and install OpenResty ${{ matrix.openresty-version }}
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
if [ ! -d $INSTALL_PATH/openresty-$OPENRESTY_VER ];
then
pushd $DOWNLOAD_PATH
echo "Downloading from http://openresty.org/download/openresty-$OPENRESTY_VER.tar.gz"
wget -O $DOWNLOAD_PATH/openresty-$OPENRESTY_VER.tar.gz http://openresty.org/download/openresty-$OPENRESTY_VER.tar.gz
echo "tar -zxf $DOWNLOAD_PATH/openresty-$OPENRESTY_VER.tar.gz"
tar -zxf $DOWNLOAD_PATH/openresty-$OPENRESTY_VER.tar.gz
echo "result: $?"
pushd openresty-$OPENRESTY_VER
./configure --prefix=$OPENRESTY_PREFIX
make
make install
popd
popd
fi
- name: Build and install LuaRocks ${{ matrix.luarocks-version }}
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
if [ ! -d $INSTALL_PATH/luarocks-$LUAROCKS_VER ];
then
pushd $DOWNLOAD_PATH
echo "Downloading from https://luarocks.github.io/luarocks/releases/luarocks-$LUAROCKS_VER.tar.gz"
wget -O $DOWNLOAD_PATH/luarocks-$LUAROCKS_VER.tar.gz https://luarocks.github.io/luarocks/releases/luarocks-$LUAROCKS_VER.tar.gz
tar -zxf $DOWNLOAD_PATH/luarocks-$LUAROCKS_VER.tar.gz
pushd luarocks-$LUAROCKS_VER
./configure --prefix=$LUAROCKS_PREFIX --with-lua=$OPENRESTY_PREFIX/luajit --with-lua-include=$OPENRESTY_PREFIX/luajit/include/luajit-2.1 --lua-suffix=jit
make build
make install
popd
luarocks install luacheck
popd
fi
- name: Install Test::NGINX
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
if [ ! -f $DOWNLOAD_PATH/cpanm ];
then
wget -O $DOWNLOAD_PATH/cpanm https://cpanmin.us/
chmod +x $DOWNLOAD_PATH/cpanm
cpanm --notest --local-lib=$HOME/perl5 local::lib && eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib)
cpanm --notest Test::Nginx
fi
lint:
name: Static code analysis
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
openresty-version: [1.19.9.1]
luarocks-version: [3.8.0]
steps:
- name: Checkout lua-resty-healthcheck
uses: actions/checkout@v2
- name: Set environment variables
env:
LUAROCKS_VER: ${{ matrix.luarocks-version }}
OPENRESTY_VER: ${{ matrix.openresty-version }}
run: |
echo "DOWNLOAD_PATH=$HOME/download-root" >> $GITHUB_ENV
export DOWNLOAD_PATH=$HOME/download-root
echo "INSTALL_PATH=$HOME/install-root" >> $GITHUB_ENV
export INSTALL_PATH=$HOME/install-root
echo "LUAROCKS_VER=$LUAROCKS_VER" >> $GITHUB_ENV
echo "OPENRESTY_VER=$OPENRESTY_VER" >> $GITHUB_ENV
export LUAROCKS_PREFIX=$INSTALL_PATH/luarocks-$LUAROCKS_VER
echo "LUAROCKS_PREFIX=$LUAROCKS_PREFIX" >> $GITHUB_ENV
export OPENRESTY_PREFIX=$INSTALL_PATH/openresty-$OPENRESTY_VER
echo "OPENRESTY_PREFIX=$OPENRESTY_PREFIX" >> $GITHUB_ENV
echo "PATH=$DOWNLOAD_PATH:$LUAROCKS_PREFIX/bin:$OPENRESTY_PREFIX/nginx/sbin:$DOWNLOAD_PATH/cpanm:$PATH" >> $GITHUB_ENV
- name: Lookup build cache
uses: actions/cache@v2
id: cache-deps
with:
path: |
${{ env.INSTALL_PATH }}
~/perl5
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/latest_os.yml') }}
- name: Lint code
run: |
eval `luarocks path`
luacheck lib
install-and-test:
name: Test lua-resty-healthcheck
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
openresty-version: [1.19.9.1]
luarocks-version: [3.8.0]
steps:
- name: Checkout lua-resty-healthcheck
uses: actions/checkout@v2
- name: Set environment variables
env:
LUAROCKS_VER: ${{ matrix.luarocks-version }}
OPENRESTY_VER: ${{ matrix.openresty-version }}
run: |
echo "DOWNLOAD_PATH=$HOME/download-root" >> $GITHUB_ENV
export DOWNLOAD_PATH=$HOME/download-root
echo "INSTALL_PATH=$HOME/install-root" >> $GITHUB_ENV
export INSTALL_PATH=$HOME/install-root
echo "LUAROCKS_VER=$LUAROCKS_VER" >> $GITHUB_ENV
echo "OPENRESTY_VER=$OPENRESTY_VER" >> $GITHUB_ENV
export LUAROCKS_PREFIX=$INSTALL_PATH/luarocks-$LUAROCKS_VER
echo "LUAROCKS_PREFIX=$LUAROCKS_PREFIX" >> $GITHUB_ENV
export OPENRESTY_PREFIX=$INSTALL_PATH/openresty-$OPENRESTY_VER
echo "OPENRESTY_PREFIX=$OPENRESTY_PREFIX" >> $GITHUB_ENV
echo "PATH=$DOWNLOAD_PATH:$LUAROCKS_PREFIX/bin:$OPENRESTY_PREFIX/nginx/sbin:$DOWNLOAD_PATH/cpanm:$PATH" >> $GITHUB_ENV
- name: Lookup build cache
uses: actions/cache@v2
id: cache-deps
with:
path: |
${{ env.INSTALL_PATH }}
~/perl5
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/latest_os.yml') }}
- name: Install lua-resty-healthcheck
run: luarocks make
- name: Run tests
run: |
eval `luarocks path`
eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib)
TEST_NGINX_RANDOMIZE=1 prove -I. -r t