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

47 lines
1.3 KiB
YAML
Raw Normal View History

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:
2022-04-01 14:14:55 +00:00
- master
paths:
- docker/nginx/libs/**
2021-11-05 14:32:32 +00:00
pull_request:
paths:
- docker/nginx/libs/**
2021-11-05 14:32:32 +00:00
jobs:
2022-04-01 14:14:55 +00:00
test:
2021-11-05 14:32:32 +00:00
runs-on: ubuntu-latest
2022-04-01 14:14:55 +00:00
container: openresty/openresty:1.19.9.1-focal
2021-11-05 14:32:32 +00:00
steps:
2022-04-01 14:14:55 +00:00
- uses: actions/checkout@v3
2021-11-05 14:32:32 +00:00
- name: Install Dependencies
run: |
2022-04-01 14:14:55 +00:00
luarocks install lua-resty-http
luarocks install hasher
2021-11-05 14:32:32 +00:00
luarocks install busted
2022-03-25 13:56:08 +00:00
luarocks install luacov
luarocks install luacheck
2022-04-01 14:14:55 +00:00
- name: Lint Code With Luacheck
run: luacheck docker/nginx/libs --std ngx_lua+busted
2021-11-05 14:32:32 +00:00
2022-04-01 14:14:55 +00:00
- 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
2022-03-25 13:56:08 +00:00
2022-04-01 14:14:55 +00:00
- uses: codecov/codecov-action@v3
2022-03-25 13:56:08 +00:00
with:
2022-04-01 14:14:55 +00:00
root_dir: ${GITHUB_WORKSPACE}
files: ./luacov.report.out
2022-03-25 13:56:08 +00:00
flags: nginx-lua