Skip to content

Commit

Permalink
build: Added basic CI support
Browse files Browse the repository at this point in the history
  • Loading branch information
dol committed Dec 26, 2024
1 parent 85426ae commit d8cb370
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint

on: [push, pull_request]

jobs:
tests:
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT || 10) }}
name: Linting

runs-on: ubuntu-24.04

steps:
- name: Checkout source code
uses: actions/checkout@main
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run tests
run: make lint DOCKER_RUN_FLAGS_TTY=''
28 changes: 28 additions & 0 deletions .github/workflows/sast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: SAST

on:
pull_request: {}
push:
branches:
- master
- main
workflow_dispatch: {}


jobs:
semgrep:
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT || 10) }}
name: Semgrep SAST
runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write
# only required for workflows in private repositories
actions: read
contents: read

if: (github.actor != 'dependabot[bot]')

steps:
- uses: actions/checkout@v3
- uses: Kong/public-shared-actions/security-actions/semgrep@33449c46c6766a3d3c8f167cc383381225862b36
18 changes: 18 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Test

on: [push, pull_request]

jobs:
tests:
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT || 10) }}
name: Busted Tests

runs-on: ubuntu-24.04

steps:
- name: Checkout source code
uses: actions/checkout@main
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run tests
run: make test-unit DOCKER_RUN_FLAGS_TTY=''
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ _docker_is_podman = $(shell $(DOCKER) --version | grep podman 2>/dev/null)
# - set username/UID to executor
DOCKER_USER ?= $$(id -u)
DOCKER_USER_OPT = $(if $(_docker_is_podman),--userns keep-id,--user $(DOCKER_USER))
DOCKER_RUN_FLAGS ?= --rm --interactive --tty $(DOCKER_USER_OPT)
DOCKER_RUN_FLAGS_TTY ?= --tty
DOCKER_RUN_FLAGS ?= --rm --interactive $(DOCKER_RUN_FLAGS_TTY) $(DOCKER_USER_OPT)

DOCKER_NO_CACHE :=

Expand Down Expand Up @@ -254,7 +255,7 @@ stop-services: stop-service-redis stop-service-openfga stop-service-postgres

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

.PHONY: format-code
format-code: container-ci-kong-tooling
Expand Down

0 comments on commit d8cb370

Please sign in to comment.