-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
3,883 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
return { | ||
default = { | ||
verbose = true, | ||
coverage = true, | ||
output = "gtest", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
charset = utf-8 | ||
|
||
[*.lua] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[kong/templates/nginx*] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.template] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: "Apply EE License and Copyright" | ||
on: [create] | ||
|
||
env: | ||
SENDER: ${{ github.event.sender.login }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
MESSAGE: "chore(license): EE License and Copyright" | ||
|
||
jobs: | ||
license_checker: | ||
if: contains( | ||
fromJson('[ | ||
"kong", | ||
"konghq-cx" | ||
]'), | ||
github.event.repository.owner.login | ||
) && | ||
github.event.ref_type == 'branch' && | ||
github.event.repository.full_name != 'kong/kong-plugin' && | ||
github.event.repository.private == true | ||
runs-on: ubuntu-latest | ||
name: Apply EE License and Copyright | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: License and Copyright Checker | ||
run: | | ||
PR_BRANCH="chore/$GITHUB_REF_NAME-license-updated" | ||
git config --global user.name "${{ env.SENDER }}" | ||
git config --global user.email "${{ env.SENDER }}@users.noreply.github.com" | ||
git fetch origin | ||
git checkout -b "$PR_BRANCH" | ||
.license-scripts/license-checker.sh | ||
git commit -am "${{ env.MESSAGE }}" | ||
git push origin "$PR_BRANCH" | ||
gh pr create --title "${{ env.MESSAGE }}" --body "" --base "$GITHUB_REF_NAME" | ||
cleanup: | ||
if: ${{ always() && github.event.repository.full_name != 'kong/kong-plugin'}} | ||
runs-on: ubuntu-latest | ||
needs: license_checker | ||
name: Cleanup | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Cleanup | ||
run: | | ||
git config --global user.name "${{ env.SENDER }}" | ||
git config --global user.email "${{ env.SENDER }}@users.noreply.github.com" | ||
git switch "$GITHUB_REF_NAME" | ||
rm -r .github/workflows/license-checker.yml .license-scripts | ||
git commit -am "${{ env.MESSAGE }} Action Cleanup" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Lint | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} ${{ github.ref }} | ||
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
luacheck: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: LuaCheck linter | ||
uses: lunarmodules/luacheck@master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: "Test" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
kongVersion: | ||
- "2.3.x" | ||
- "2.8.x" | ||
- "3.0.x" | ||
- "dev" | ||
- "3.0.0.x" | ||
- "dev-ee" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Clone kong-pongo | ||
run: git clone https://github.com/nawaz1991/kong-pongo.git | ||
|
||
- name: Setup env | ||
run: | | ||
PATH=$PATH:~/.local/bin | ||
mkdir -p ~/.local/bin | ||
ln -s $(realpath kong-pongo/pongo.sh) ~/.local/bin/pongo | ||
- run: pongo run -- --coverage | ||
|
||
# Optional upload of coverage data, | ||
# just ugly, something to fix... | ||
- uses: leafo/gh-actions-lua@v10 | ||
if: success() | ||
- uses: leafo/gh-actions-luarocks@v4 | ||
if: success() | ||
- name: Report test coverage | ||
if: success() | ||
continue-on-error: true | ||
run: | | ||
luarocks install luacov-coveralls | ||
# hack: luacov config file has a path for inside the pongo container | ||
# rewrite those to the local location in GHA | ||
if [ -f .luacov ]; then | ||
cp .luacov .luacov_backup | ||
cat .luacov_backup | sed 's/\/kong-plugin\/luacov./luacov./' > .luacov | ||
fi | ||
rm *.report.out | ||
luacov-coveralls | ||
#luacov-coveralls --output coveralls.out | ||
# undo the hack | ||
if [ -f .luacov_backup ]; then | ||
mv .luacov_backup .luacov | ||
fi | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# servroot is typically the nginx/Kong workingdirectory when testing | ||
servroot | ||
|
||
# packed distribution format for LuaRocks | ||
*.rock | ||
# exclude Pongo shell history | ||
.pongo/.ash_history | ||
.pongo/.bash_history | ||
# exclude LuaCov statistics file | ||
luacov.stats.out | ||
# exclude LuaCov report | ||
luacov.report.out | ||
# exclude Pongo containerid file | ||
.containerid | ||
.idea | ||
/kong-test-helper-docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Copyright (c) 2023 Muhammad Nawaz | ||
-- Licensed under the MIT License. See LICENSE file for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Muhammad Nawaz | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# * check that all lua files have the COPYRIGHT's sha in the header | ||
# * if not, add the content of ./COPYRIGHT-HEADER to each file | ||
# | ||
# * replace the LICENSE file from the root directory (if it exists) | ||
# with the content of ./EE-LICENSE (otherwise create it). | ||
# | ||
|
||
LOCAL_PATH=$(dirname $(realpath $0)) | ||
|
||
function add_copyright { | ||
echo "Adding copyright headers" | ||
|
||
local ret=0 | ||
local count=0 | ||
local header="$LOCAL_PATH/COPYRIGHT-HEADER" | ||
local sha=$(shasum $header | cut -f1 -d' ') | ||
local eol="-- [ END OF LICENSE $sha ]" | ||
for f in $(find "." -type f -name "*.lua"); do | ||
grep -Fq "$sha" $f || { | ||
ret=1 | ||
cat "$header" <(echo "$eol") <(echo) $f >${f}.new | ||
mv $f.new $f | ||
((count++)) | ||
} | ||
done | ||
|
||
[[ $ret -ne 0 ]] && | ||
echo "Added headers to $count files." | ||
} | ||
|
||
function replace_license { | ||
echo "Replacing license" | ||
|
||
cat "$LOCAL_PATH/EE-LICENSE" > "$LOCAL_PATH/../LICENSE" || return 1 | ||
} | ||
|
||
main() { | ||
|
||
add_copyright | ||
replace_license | ||
RET=$? | ||
|
||
return $RET | ||
|
||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
-- Configuration file for LuaCheck | ||
-- see: https://luacheck.readthedocs.io/en/stable/ | ||
-- | ||
-- To run do: `luacheck .` from the repo | ||
|
||
std = "ngx_lua" | ||
unused_args = false | ||
redefined = false | ||
max_line_length = false | ||
|
||
|
||
globals = { | ||
"_KONG", | ||
"kong", | ||
"ngx.IS_CLI", | ||
} | ||
|
||
|
||
not_globals = { | ||
"string.len", | ||
"table.getn", | ||
} | ||
|
||
|
||
ignore = { | ||
"6.", -- ignore whitespace warnings | ||
} | ||
|
||
|
||
include_files = { | ||
"**/*.lua", | ||
"*.rockspec", | ||
".busted", | ||
".luacheckrc", | ||
} | ||
|
||
exclude_files = { | ||
--"spec/fixtures/invalid-module.lua", | ||
--"spec-old-api/fixtures/invalid-module.lua", | ||
} | ||
|
||
|
||
files["spec/**/*.lua"] = { | ||
std = "ngx_lua+busted", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
include = { | ||
"%/kong%-plugin%/kong%/.+$", | ||
} | ||
|
||
statsfile = "/kong-plugin/luacov.stats.out" | ||
reportfile = "/kong-plugin/luacov.report.out" | ||
runreport = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--postgres | ||
--no-cassandra | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# rename to ".travis.yml" to enable this file for Travis CI | ||
|
||
dist: focal | ||
|
||
jobs: | ||
include: | ||
# to add Kong Enterprise releases, check the Pongo docs | ||
- name: Kong CE 2.3.x | ||
env: KONG_VERSION=2.3.x | ||
- name: Kong CE 2.4.x | ||
env: KONG_VERSION=2.4.x | ||
- name: Kong CE master | ||
env: KONG_VERSION=nightly POSTGRES=latest CASSANDRA=latest | ||
- name: Enterprise 2.3.3.x | ||
env: KONG_VERSION=2.3.3.x | ||
- name: Enterprise 2.4.1.x | ||
env: KONG_VERSION=2.4.1.x | ||
- name: Nightly EE-master | ||
env: KONG_VERSION=nightly-ee POSTGRES=latest CASSANDRA=latest | ||
|
||
install: | ||
- git clone --single-branch https://github.com/Kong/kong-pongo ../kong-pongo | ||
- "../kong-pongo/pongo.sh up" | ||
- "../kong-pongo/pongo.sh build" | ||
|
||
script: | ||
- "../kong-pongo/pongo.sh lint" | ||
- "../kong-pongo/pongo.sh run" | ||
|
||
notifications: | ||
slack: | ||
if: branch = master AND type != pull_request | ||
on_success: change | ||
on_failure: always | ||
rooms: | ||
secure: HdpUy77gMJEapyYOnKBqYeWFALG771KnLzUzbM5Et8br7RNrUTvA4fZ+paoLnIWU+0Sb+8A8/tRxBvPpxnVJFYZReQT4oBhX+wVTYbVr4i+UKfIDrU4DJ2nj3lHTa5t/dX7WZttBwFB8fuVugceWVF95DZCC9ll38d646+27wYydamu2hgCBs+PI4+J6msmFMC0T2vMr3A+B9reyiWQ+KG+E5U7mcmgMZ/xh10pBinPA7nXe0N4z50hR/ooHukFzMHDCyfVIKox9z9WQzS3SUI+Wxj6dts+dDVmVfTlM4XUM9e2MMDkBZgvQIedrjaR5pgdTl2xTWrMuMeeKbuimGa7FGD5rirgBg5gkP9LG1aSzJLP0lp4ldogTX+9VVaDE5N+ACKcR/10U3CskJYuOXx4cp0ub+TDIfe34NxgBe9PmTmJbTtRBgZ0sNVfZqfCmDYeCMTTyA+zug+XkPI+lQ56QqgFg4Hxohr+EsCQcQzA2YI9QUw0fIZPKyWQ91neE/ytF4xvNM8YI0yuLLgRYbbcvu6Tn4q0rwJkIdjh9eExD9ddsgTmENVN0KEYMj/Rk3WUJi6k7MDcSmxaBLC9REObgddyGM4hgXtbLGBAnJaDBHTaDBetTmrae2PAiZs478P4l5X1TzlZZMYVLlpVukpDJPzH6NBXZgiYjkyFipVc= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.