This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/.github/workflows/nginx-lua-unit-tests.yml

43 lines
1.2 KiB
YAML

# Install and run unit tests with busted
# Docs: http://olivinelabs.com/busted/
name: Nginx Lua Unit Tests
on:
push:
branches:
- master
pull_request:
jobs:
test:
runs-on: ubuntu-latest
container: openresty/openresty:1.19.9.1-focal
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
luarocks install lua-resty-http
luarocks install hasher
luarocks install busted
luarocks install luacov
luarocks install luacheck
- name: Lint Code With Luacheck
run: luacheck docker/nginx/libs --std ngx_lua+busted
- name: Run Tests With Busted
# ran from root repo directory; produces luacov.stats.out file
run: docker/nginx/testing/rbusted --lpath='docker/nginx/libs/?.lua;docker/nginx/libs/?/?.lua' --verbose --coverage --pattern=spec docker/nginx/libs
- name: Generate Code Coverage Report With Luacov
# requires config file in cwd; produces luacov.report.out file
run: cp docker/nginx/testing/.luacov . && luacov && rm .luacov
- uses: codecov/codecov-action@v3
with:
root_dir: ${GITHUB_WORKSPACE}
files: ./luacov.report.out
flags: nginx-lua