55 push :
66 paths :
77 - ' api-builder-plugin-fn-elasticsearch/**'
8+ branches :
9+ - ' master'
810 pull_request :
911 paths :
1012 - ' api-builder-plugin-fn-elasticsearch/**'
@@ -17,30 +19,105 @@ defaults:
1719 working-directory : api-builder-plugin-fn-elasticsearch
1820
1921jobs :
20- build :
22+ unit-tests :
23+ name : Unit tests
2124 runs-on : ubuntu-latest
2225 strategy :
2326 matrix :
24- node-version : [10 .x, 12 .x, 14 .x]
27+ node-version : [12 .x, 14 .x, 16 .x]
2528 steps :
2629 - uses : actions/checkout@v1
2730 - name : Use Node.js ${{ matrix.node-version }}
2831 uses : actions/setup-node@v1
2932 with :
3033 node-version : ${{ matrix.node-version }}
31- - name : npm install, build, and test
34+ - name : Run unit tests
3235 env :
3336 CI : true
3437 run : |
3538 npm ci
3639 npm run build --if-present
37- npm test
40+ npm run unit-test
41+
42+ integration-tests-es-v8 :
43+ name : Integration-tests ES V8
44+ runs-on : ubuntu-latest
45+ needs : unit-tests
46+
47+ services :
48+ elasticsearch8 :
49+ image : docker.elastic.co/elasticsearch/elasticsearch:8.0.0
50+ ports :
51+ - 9200:9200
52+ - 9300:9300
53+ env :
54+ xpack.security.enabled : false
55+ action.auto_create_index : ' -apigw-*,+*'
56+ options : >-
57+ -e "discovery.type=single-node"
58+ -e "xpack.security.enabled=false"
59+ --health-cmd "curl -f http://localhost:9200"
60+ --health-interval 30s
61+ --health-timeout 2s
62+ --health-retries 5
63+ --health-start-period 30s
64+
65+ steps :
66+ - uses : actions/checkout@v1
67+ - name : Use Node.js 14
68+ uses : actions/setup-node@v1
69+ with :
70+ node-version : ' 14'
71+ - name : Run integration tests
72+ env :
73+ CI : true
74+ ELASTICSEARCH_HOSTS : ' http://localhost:9200'
75+ run : |
76+ npm ci
77+ npm run build --if-present
78+ npm run integration-test
79+
80+ integration-tests-es-v7 :
81+ name : Integration-tests ES V7
82+ runs-on : ubuntu-latest
83+ needs : unit-tests
84+
85+ services :
86+ elasticsearch7 :
87+ image : docker.elastic.co/elasticsearch/elasticsearch:7.17.0
88+ ports :
89+ - 9200:9200
90+ - 9300:9300
91+ env :
92+ xpack.security.enabled : false
93+ action.auto_create_index : ' -apigw-*,+*'
94+ options : >-
95+ -e "discovery.type=single-node"
96+ --health-cmd "curl -f http://localhost:9200"
97+ --health-interval 30s
98+ --health-timeout 2s
99+ --health-retries 5
100+ --health-start-period 30s
101+ steps :
102+ - uses : actions/checkout@v1
103+ - name : Use Node.js 14
104+ uses : actions/setup-node@v1
105+ with :
106+ node-version : ' 14'
107+ - name : Run integration tests
108+ env :
109+ CI : true
110+ ELASTICSEARCH_HOSTS : ' http://localhost:9200'
111+ run : |
112+ npm ci
113+ npm run build --if-present
114+ npm run integration-test
38115
39116 publish-gpr :
40117 if : contains(github.event.release.tag_name, 'plugin-fn-elasticsearch')
41118 env :
42119 CI : true
43- needs : build
120+ needs : [integration-tests-es-v7, integration-tests-es-v8]
44121 runs-on : ubuntu-latest
45122 steps :
46123 - uses : actions/checkout@v1
59136 publish-npm :
60137 env :
61138 CI : true
62- needs : [build , publish-gpr]
139+ needs : [integration-tests-es-v7 , publish-gpr]
63140 runs-on : ubuntu-latest
64141 steps :
65142 - uses : actions/checkout@v1
73150 run : |
74151 npm ci
75152 echo "//registry.npmjs.org/:_authToken=${{ secrets.npm_token }}" > ~/.npmrc
76- npm publish --access public
153+ npm publish --access public
0 commit comments