Skip to content

Commit 518ab3b

Browse files
committed
build: Added basic CI support
1 parent 85426ae commit 518ab3b

File tree

5 files changed

+80
-2
lines changed

5 files changed

+80
-2
lines changed

.github/workflows/lint.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
8+
9+
jobs:
10+
lua-check:
11+
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT || 10) }}
12+
name: Lua Check
13+
runs-on: ubuntu-24.04
14+
permissions:
15+
contents: read
16+
issues: read
17+
checks: write
18+
pull-requests: write
19+
if: (github.actor != 'dependabot[bot]')
20+
21+
steps:
22+
- name: Checkout source code
23+
uses: actions/checkout@v3
24+
25+
- name: Lua Check
26+
uses: Kong/public-shared-actions/code-check-actions/lua-lint@0ccacffed804d85da3f938a1b78c12831935f992 # v2.8.0
27+
with:
28+
additional_args: '--no-default-config --config .luacheckrc'
29+
action_fail: true
30+
print_results: true

.github/workflows/sast.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: SAST
2+
3+
on:
4+
pull_request: {}
5+
push:
6+
branches:
7+
- master
8+
- main
9+
workflow_dispatch: {}
10+
11+
12+
jobs:
13+
semgrep:
14+
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT || 10) }}
15+
name: Semgrep SAST
16+
runs-on: ubuntu-latest
17+
permissions:
18+
# required for all workflows
19+
security-events: write
20+
# only required for workflows in private repositories
21+
actions: read
22+
contents: read
23+
24+
if: (github.actor != 'dependabot[bot]')
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: Kong/public-shared-actions/security-actions/semgrep@33449c46c6766a3d3c8f167cc383381225862b36

.github/workflows/tests.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
tests:
7+
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT || 10) }}
8+
name: Busted Tests
9+
10+
runs-on: ubuntu-24.04
11+
12+
steps:
13+
- name: Checkout source code
14+
uses: actions/checkout@main
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v3
17+
- name: Run tests
18+
run: make test-unit DOCKER_RUN_FLAGS_TTY=''

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ _docker_is_podman = $(shell $(DOCKER) --version | grep podman 2>/dev/null)
2020
# - set username/UID to executor
2121
DOCKER_USER ?= $$(id -u)
2222
DOCKER_USER_OPT = $(if $(_docker_is_podman),--userns keep-id,--user $(DOCKER_USER))
23-
DOCKER_RUN_FLAGS ?= --rm --interactive --tty $(DOCKER_USER_OPT)
23+
DOCKER_RUN_FLAGS_TTY ?= --tty
24+
DOCKER_RUN_FLAGS ?= --rm --interactive $(DOCKER_RUN_FLAGS_TTY) $(DOCKER_USER_OPT)
2425

2526
DOCKER_NO_CACHE :=
2627

@@ -254,7 +255,7 @@ stop-services: stop-service-redis stop-service-openfga stop-service-postgres
254255

255256
.PHONY: lint
256257
lint: container-ci-kong-tooling
257-
$(CONTAINER_CI_KONG_TOOLING_RUN) sh -c '(cd /kong-plugin; luacheck .)'
258+
$(CONTAINER_CI_KONG_TOOLING_RUN) sh -c '(cd /kong-plugin; luacheck --no-default-config --config .luacheckrc .)'
258259

259260
.PHONY: format-code
260261
format-code: container-ci-kong-tooling

spec/kong-authz-openfga/01-schema_spec.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ do
66
local validate_entity = require("spec.helpers").validate_plugin_config_schema
77
local plugin_schema = require("kong.plugins." .. PLUGIN_NAME .. ".schema")
88

9+
local foo = 'bar'
910
function validate(data)
1011
return validate_entity(data, plugin_schema)
1112
end

0 commit comments

Comments
 (0)