forked from DhavalKapil/elasticsearch-lua
-
Notifications
You must be signed in to change notification settings - Fork 6
75 lines (72 loc) · 2.79 KB
/
test-all.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
name: 'Test everything'
on:
push:
pull_request:
schedule:
# Once per month check it's still working
- cron: '0 22 1 * *'
jobs:
test_all:
name: test_all
env:
LUAROCKS: 3.11.1
ES_USERNAME: elastic
ES_PASSWORD: "Changeme12456!"
ES_TEST_PROTOCOL: http
ES_TEST_PORT: 9200
CACERT_PATH:
ELASTIC_CREDS:
PROTOCOL: HTTP
strategy:
fail-fast: false
matrix:
# We test on four versions of Lua
lua: [lua5.1, lua5.2, lua5.3, lua5.4, luajit2.0]
# We're testing on three versions of Elastic: 7, 8 and the
# Amazon Fork - OpenSearch 2.0
elastic: [el7, el8, os2]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 6
submodules: recursive
- name: Set dynamic env vars
run: echo "CAFILE=$GITHUB_WORKSPACE/docker/certs/ca/ca.crt" >> $GITHUB_ENV
- name: Set Certfile Path for el8
if: ${{ matrix.elastic == 'el8' }}
run: echo "CACERT_PATH=--cacert $GITHUB_WORKSPACE/docker/certs/ca/ca.crt" >> $GITHUB_ENV
- name: install dependencies
run: sudo apt-get -y update && sudo apt-get install wget openssl -y
- name: run elasticsearch
run: cd docker && docker compose -f create-certs.yml up && cp docker-compose.yml.${{ matrix.elastic }} docker-compose.yml && docker compose up -d && cd ..
- name: output docker compose logs if the previous step failed
if: failure()
run: cd docker && docker compose logs && cd ..
- name: setup test environment
env:
LUA: ${{ matrix.lua }}
run: source tests/gh_actions/setenv_lua.sh
- name: Add lua things to path
run: echo "$HOME/.lua:$HOME/.local/bin:$GITHUB_WORKSPACE/install/luarocks/bin" >> $GITHUB_PATH
- name: install luarocks
run: luarocks install lunitx && luarocks install luacov && luarocks install luacov-coveralls && luarocks install luasec 0.7-1
- name: make the elasticsearch-lua rockspec
run: luarocks make rockspecs/elasticsearch-lua-1.0.12-1.rockspec
- name: run the tests for el8
if: ${{ matrix.elastic == 'el8' }}
env:
ES_TEST_PROTOCOL: https
ES_TEST_PORT: 19200
ELASTIC_CREDS: -u ${{env.ES_USERNAME}}:${{env.ES_PASSWORD}}
PROTOCOL: https
run: cd tests && luarocks path >lpath.sh && source lpath.sh && lua run-tests.lua
- name: run the tests for opensearch2
if: ${{ matrix.elastic == 'os2' }}
env:
ES_TEST_PORT: 29200
run: cd tests && luarocks path >lpath.sh && source lpath.sh && lua run-tests.lua
- name: run the tests for el7
if: ${{ matrix.elastic == 'el7' }}
run: cd tests && luarocks path >lpath.sh && source lpath.sh && lua run-tests.lua