Skip to content

Commit 5ba6d9a

Browse files
committed
build: Added basic CI support
1 parent 85426ae commit 5ba6d9a

File tree

4 files changed

+83
-2
lines changed

4 files changed

+83
-2
lines changed

.github/workflows/lint.yml

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

.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

0 commit comments

Comments
 (0)