Skip to content

feat(config): retrieve nested fields from env vars (#77) #224

feat(config): retrieve nested fields from env vars (#77)

feat(config): retrieve nested fields from env vars (#77) #224

Workflow file for this run

name: Lint & Test
env:
ROCKSPEC_FILE: "doorbell-dev-1.rockspec"
LUAROCKS_VERSION: "3.11.0"
on:
push:
branches:
- main
pull_request:
branches:
- '*'
paths:
- '*.rockspec'
- '.busted'
- '.github/**'
- '.luacheckrc'
- 'bin/**'
- 'lib/**'
- 'spec/**'
- '**.lua'
- 'assets/**'
defaults:
run:
shell: bash
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Lua
uses: leafo/gh-actions-lua@v10
with:
luaVersion: "luajit-openresty"
- name: Install LuaRocks
uses: leafo/gh-actions-luarocks@v4
with:
luarocksVersion: ${{ env.LUAROCKS_VERSION }}
- name: Install luacheck
run: luarocks install luacheck
- name: Lint rockspec file
run: luarocks lint ${{ env.ROCKSPEC_FILE }}
- name: Lint Lua files
run: luacheck lib spec
test:
runs-on: ubuntu-latest
name: Test - OpenResty ${{ matrix.openresty }}
strategy:
matrix:
include:
- openresty: 1.25.3.1
openssl: 1.1.1w
openresty-opts: >-
--with-compat
--with-http_realip_module
--with-http_ssl_module
--with-pcre-jit
--with-stream
--with-threads
steps:
- uses: actions/checkout@v3
- name: Install OS Deps
run: |
sudo apt-get install -y libmaxminddb0
dpkg -L libmaxminddb0
sudo ldconfig
sudo ln -fs /usr/lib/x86_64-linux-gnu/libmaxminddb.so.0 \
/usr/lib/x86_64-linux-gnu/libmaxminddb.so
sudo ln -fs /usr/lib/x86_64-linux-gnu/libmaxminddb.so.0 \
/usr/lib/libmaxminddb.so
sudo ln -fs /usr/lib/x86_64-linux-gnu/libmaxminddb.so.0 \
/usr/lib64/libmaxminddb.so
sudo ln -fs /usr/lib/x86_64-linux-gnu/libmaxminddb.so.0 \
/lib/libmaxminddb.so
ldconfig -p | grep -i maxmind
- name: Set OpenResty prefix
run: |
echo OPENRESTY_PREFIX=${GITHUB_WORKSPACE}/openresty/${{ matrix.openresty }} >> $GITHUB_ENV
- name: Store OpenResty build opts
run: |
echo '${{ matrix.openresty-opts }}' > .resty-opts
- name: Cache OpenResty
uses: actions/cache@v3
id: cache-openresty
with:
path: |
${{ env.OPENRESTY_PREFIX }}
work/
key: v1::${{ runner.os }}-openresty-${{ matrix.openresty }}-opts-${{ hashFiles('.resty-opts') }}-openssl-${{ matrix.openssl }}
- name: Setup OpenResty
id: setup-openresty
if: ${{ steps.cache-openresty.outputs.cache-hit != 'true' }}
uses: thibaultcha/setup-openresty@main
with:
version: ${{ matrix.openresty }}
test-nginx: false
openssl-version: ${{ matrix.openssl }}
opt: ${{ matrix.openresty-opts }}
- name: Cleanup OpenResty build artifacts
if: ${{ steps.cache-openresty.outputs.cache-hit != 'true' }}
run: |
rm -rf \
./work/OpenResty \
./work/OpenSSL/test \
./work/OpenSSL/doc \
./work/OpenSSL/test \
./work/OpenSSL/demos \
./work/OpenSSL/fuzz \
./work/downloads \
|| true
- name: Install LuaRocks
uses: leafo/gh-actions-luarocks@v4
with:
withLuaPath: ${{ env.OPENRESTY_PREFIX }}/luajit
luarocksVersion: ${{ env.LUAROCKS_VERSION }}
- name: Cache LuaRocks Dependencies
uses: actions/cache@v3
id: cache-luarocks-deps
with:
path: .luarocks/
key: v1::${{ runner.os }}-luarocks-${{ env.LUAROCKS_VERSION }}-openresty-${{ matrix.openresty }}-${{ hashFiles('*.rockspec') }}
- name: Install Main Luarocks Dependencies
run: luarocks install --deps-only ${{ env.ROCKSPEC_FILE }}
- name: Install Test Luarocks Dependencies
run: luarocks test --prepare ${{ env.ROCKSPEC_FILE }}
- name: Set PATH
run: |
echo "${PWD}/bin" >> $GITHUB_PATH
echo "${OPENRESTY_PREFIX}/bin" >> $GITHUB_PATH
echo "${OPENRESTY_PREFIX}/luajit/bin" >> $GITHUB_PATH
echo "${OPENRESTY_PREFIX}/nginx/sbin" >> $GITHUB_PATH
- name: OpenResty info
run: nginx -V
- name: Check libmaxminddb
run: luajit -e 'require("ffi").load("libmaxminddb")'
- name: Download GeoIP Test Data
run: ./scripts/download-geoip-test-databases.sh
- name: Unit Tests
run: busted --run unit
- name: Integration Tests
run: busted --run integration