-
Notifications
You must be signed in to change notification settings - Fork 5
144 lines (124 loc) · 4.59 KB
/
test.yml
File metadata and controls
144 lines (124 loc) · 4.59 KB
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
name: Test
on:
push:
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
build:
name: Build OpenResty ${{ matrix.openresty_version }}
runs-on: ubuntu-22.04
strategy:
matrix:
openresty_version:
- "1.19.9.1"
- "1.21.4.1"
env:
OPENRESTY_VERSION: ${{ matrix.openresty_version }}
steps:
- name: Set environment variables
run: |
echo "INSTALL_ROOT=$HOME/install-root" >> $GITHUB_ENV
echo "DOWNLOAD_ROOT=$HOME/download-root" >> $GITHUB_ENV
mkdir -p $HOME/install-root
mkdir -p $HOME/download-root
- name: Lookup build cache
uses: actions/cache@v3
id: cache-openresty
with:
path: ${{ env.INSTALL_ROOT }}
key: ${{ env.OPENRESTY_VERSION }}
- name: Download OpenResty
if: steps.cache-openresty.outputs.cache-hit != 'true'
run: |
wget https://openresty.org/download/openresty-${OPENRESTY_VERSION}.tar.gz -O openresty.tar.gz
mkdir openresty
tar zxf openresty.tar.gz --directory openresty --strip-components=1
- name: Install
if: steps.cache-openresty.outputs.cache-hit != 'true'
run: |
cd openresty
sudo ./configure --prefix=${{ env.INSTALL_ROOT }}/openresty
sudo make -j$(nproc)
sudo make install
test:
name: Test ${{ matrix.busted_args }} (OpenResty ${{ matrix.openresty_version }})
runs-on: ubuntu-22.04
needs: build
strategy:
matrix:
busted_args:
- "spec/*_spec.lua"
openresty_version:
- "1.19.9.1"
- "1.21.4.1"
env:
OPENRESTY_VERSION: ${{ matrix.openresty_version }}
steps:
- name: Set environment variables
run: |
echo "INSTALL_ROOT=$HOME/install-root" >> $GITHUB_ENV
echo "DOWNLOAD_ROOT=$HOME/download-root" >> $GITHUB_ENV
mkdir -p $HOME/install-root
mkdir -p $HOME/download-root
- name: Install dependencies
run: |
sudo apt-get --yes update
# https://github.com/actions/runner-images/issues/2139
sudo apt-get remove nginx-core nginx-full nginx-light nginx-extras
sudo apt-get remove libgd3
sudo apt-get install --yes build-essential zlib1g-dev libpcre3 libpcre3-dev libssl-dev libxslt1-dev libxml2-dev libgeoip-dev libgd-dev libperl-dev
- name: Lookup build cache
uses: actions/cache@v3
id: cache-openresty
with:
path: ${{ env.INSTALL_ROOT }}
key: ${{ env.OPENRESTY_VERSION }}
- name: Install LuaRocks
run: |
sudo ln -s ${{ env.INSTALL_ROOT }}/openresty/bin/resty /bin/resty
sudo ln -s ${{ env.INSTALL_ROOT }}/openresty/luajit/bin/luajit /bin/luajit
pushd ${{ env.DOWNLOAD_ROOT }}
wget https://luarocks.org/releases/luarocks-3.12.2.tar.gz -O luarocks.tar.gz
mkdir luarocks
tar zxf luarocks.tar.gz --directory luarocks --strip-components=1
pushd luarocks
sudo ./configure --with-lua-include=${{ env.INSTALL_ROOT }}/openresty/luajit/include/luajit-2.1 --with-lua-lib=${{ env.INSTALL_ROOT }}/openresty/luajit/lib --with-lua-interpreter=luajit
sudo make -j$(nproc)
sudo make install
popd
popd
- name: Install busted
run: |
sudo luarocks install busted
sudo luarocks install busted-htest
sudo luarocks install luacov
sudo luarocks install luacov-console
- name: Checkout source code
uses: actions/checkout@v2
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: build rust code
run: |
cargo build --features "luajit" --verbose --release
- name: Run Clippy
run: cargo clippy --all-targets --features "luajit"
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
- name: Tests
run: |
eval $(luarocks path)
cp target/release/libreqwest.so reqwest.so
resty spec/runner.lua --verbose -o htest --shuffle-tests ${{ matrix.busted_args }}
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled && failure() }}
timeout-minutes: 20
with:
limit-access-to-actor: false