2021-11-05 14:32:32 +00:00
|
|
|
# Install and run unit tests with busted
|
|
|
|
# Docs: http://olivinelabs.com/busted/
|
|
|
|
|
|
|
|
name: Nginx Lua Unit Tests
|
|
|
|
|
|
|
|
on:
|
2022-03-25 13:56:08 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "master"
|
|
|
|
paths:
|
|
|
|
- ".github/workflows/nginx-lua-unit-tests.yml"
|
|
|
|
- "docker/nginx/libs/**.lua"
|
2021-11-05 14:32:32 +00:00
|
|
|
pull_request:
|
|
|
|
paths:
|
2022-03-25 13:56:08 +00:00
|
|
|
- ".github/workflows/nginx-lua-unit-tests.yml"
|
2021-11-05 14:32:32 +00:00
|
|
|
- "docker/nginx/libs/**.lua"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: "3.x"
|
|
|
|
architecture: "x64"
|
|
|
|
|
|
|
|
- name: Install Dependencies
|
|
|
|
run: |
|
|
|
|
pip install hererocks
|
|
|
|
hererocks env --lua=5.1 -rlatest
|
|
|
|
source env/bin/activate
|
|
|
|
luarocks install busted
|
2022-03-25 13:56:08 +00:00
|
|
|
luarocks install luacov
|
2021-12-20 10:27:29 +00:00
|
|
|
luarocks install hasher
|
2022-03-25 17:56:03 +00:00
|
|
|
luarocks install luacheck
|
|
|
|
|
|
|
|
- name: Lint code
|
|
|
|
run: |
|
|
|
|
source env/bin/activate
|
|
|
|
luacheck docker/nginx/libs --std ngx_lua+busted
|
2021-11-05 14:32:32 +00:00
|
|
|
|
|
|
|
- name: Unit Tests
|
|
|
|
run: |
|
|
|
|
source env/bin/activate
|
2022-03-25 13:56:08 +00:00
|
|
|
busted --verbose --coverage --pattern=spec --directory=docker/nginx/libs .
|
|
|
|
cd docker/nginx/libs && luacov
|
|
|
|
|
|
|
|
- uses: codecov/codecov-action@v2
|
|
|
|
with:
|
|
|
|
directory: docker/nginx/libs
|
|
|
|
flags: nginx-lua
|