Skip to content

Commit 1da62b9

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

File tree

3 files changed

+136
-0
lines changed

3 files changed

+136
-0
lines changed

.github/workflows/lint.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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-latest
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+
# Optional step to run on only changed files
31+
- name: Get changed files
32+
id: changed-files
33+
uses: tj-actions/changed-files@54849deb963ca9f24185fb5de2965e002d066e6b # v37
34+
with:
35+
files: |
36+
**.lua
37+
38+
- name: Lua Check
39+
if: steps.changed-files.outputs.any_changed == 'true'
40+
uses: Kong/public-shared-actions/code-check-actions/lua-lint@a98be0184f832cb24a9dd233f99074e8ba17b488 # v2.3.3
41+
with:
42+
additional_args: '--no-default-config --config .luacheckrc'
43+
files: ${{ steps.changed-files.outputs.all_changed_files }}
44+
action_fail: 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: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
LIBEXPAT_DOWNLOAD_URL: https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.gz
7+
8+
jobs:
9+
10+
tests:
11+
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT || 10) }}
12+
name: Busted Tests
13+
14+
strategy:
15+
matrix:
16+
openresty_version:
17+
- 1.17.8.2
18+
- 1.19.9.1
19+
20+
runs-on: ubuntu-latest
21+
container:
22+
image: openresty/openresty:${{ matrix.openresty_version }}-alpine-fat
23+
# --init runs tinit as PID 1 and prevents the 'WARNING: killing the child process' spam from the test suite
24+
options: --init
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Install deps
29+
run: |
30+
apk add --no-cache curl perl bash wget git perl-dev libarchive-tools nodejs jq
31+
ln -s /usr/bin/bsdtar /usr/bin/tar
32+
33+
- name: Build libexpat
34+
if: matrix.openresty_version == '1.17.8.2'
35+
run: |
36+
mkdir -p /tmp/expat
37+
curl -Ls $LIBEXPAT_DOWNLOAD_URL | tar -xz --strip-components=1 -f - -C /tmp/expat
38+
cd /tmp/expat && ./configure && make && make install
39+
40+
- name: Install libexpat from package manager
41+
if: matrix.openresty_version == '1.19.9.1'
42+
run: |
43+
apk add --no-cache expat-dev
44+
45+
- name: Cache
46+
uses: actions/cache@v2
47+
with:
48+
path: |
49+
~/.cache
50+
key: ${{ runner.os }}-${{ matrix.openresty_version }}-cache
51+
52+
- name: Install Busted
53+
run: |
54+
/usr/local/openresty/luajit/bin/luarocks install busted
55+
/usr/local/openresty/luajit/bin/luarocks install luatz
56+
/usr/local/openresty/luajit/bin/luarocks install luasocket
57+
58+
- uses: actions/checkout@v2
59+
60+
- name: Run tests
61+
run: |
62+
make dev
63+
/usr/local/openresty/luajit/bin/luarocks make
64+
busted

0 commit comments

Comments
 (0)