Skip to content

Commit 4783699

Browse files
authored
Merge pull request #23 from nyaruka/actions
Convert to github actions
2 parents 67c8b38 + 68e521b commit 4783699

File tree

10 files changed

+129
-52
lines changed

10 files changed

+129
-52
lines changed

.DS_Store

6 KB
Binary file not shown.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM docker:stable
2+
3+
COPY entrypoint.sh /entrypoint.sh
4+
RUN chmod +x /entrypoint.sh
5+
ENTRYPOINT ["/entrypoint.sh"]

.github/actions/elasticsearch/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Nyaruka
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Elasticsearch GitHub Action
2+
3+
This [GitHub Action](https://github.com/features/actions) sets up a Elasticsearch server.
4+
5+
# Usage
6+
7+
See [action.yml](action.yml)
8+
9+
Basic:
10+
```yaml
11+
steps:
12+
- uses: nyaruka/elasticsearch@v1
13+
with:
14+
elastic version: '6.8.5' # See https://hub.docker.com/_/elasticsearch for available versions
15+
```
16+
17+
# License
18+
19+
The scripts and documentation in this project are released under the [MIT License](LICENSE)
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 'Setup Elasticsearch'
2+
author: 'Nyaruka'
3+
branding:
4+
icon: 'database'
5+
color: 'blue'
6+
inputs:
7+
# See https://hub.docker.com/_/elasticsearch for supported versions
8+
elastic version:
9+
description: 'Version of Elasticsearch to use'
10+
required: false
11+
default: '7.4.2'
12+
runs:
13+
using: 'docker'
14+
image: 'Dockerfile'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
docker_run="docker run -d -p 9200:9200 -p 9300:9300 -e 'discovery.type=single-node' elasticsearch:$INPUT_ELASTIC_VERSION"
4+
5+
echo "RUNNING: $docker_run"
6+
sh -c "$docker_run"

.github/workflows/ci.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
name: Test
6+
strategy:
7+
matrix:
8+
pg-version: ['10', '11']
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v1
13+
14+
- name: Install ElasticSearch
15+
uses: ./.github/actions/elasticsearch
16+
with:
17+
elastic version: '6.8.5'
18+
19+
- name: Install PostgreSQL
20+
uses: harmon758/postgresql-action@v1
21+
with:
22+
postgresql version: ${{ matrix.pg-version }}
23+
postgresql db: elastic_test
24+
postgresql user: temba
25+
postgresql password: temba
26+
27+
- name: Install Go
28+
uses: actions/setup-go@v1
29+
with:
30+
go-version: 1.13.x
31+
32+
- name: Run tests
33+
run: go test -p=1 -coverprofile=coverage.text -covermode=atomic ./...
34+
35+
- name: Upload coverage
36+
if: success()
37+
uses: codecov/[email protected]
38+
with:
39+
token: ${{ secrets.CODECOV_TOKEN }}
40+
41+
release:
42+
name: Release
43+
needs: [test]
44+
if: startsWith(github.ref, 'refs/tags/')
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v1
49+
50+
- name: Install Go
51+
uses: actions/setup-go@v1
52+
with:
53+
go-version: 1.13.x
54+
55+
- name: Publish release
56+
uses: goreleaser/goreleaser-action@v1
57+
with:
58+
version: latest
59+
args: release --rm-dist
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.travis.yml

-51
This file was deleted.

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ require (
2222
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
2323
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
2424
)
25+
26+
go 1.13

indexer_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func setup(t *testing.T) (*sql.DB, *elastic.Client) {
2424
testDB, err := ioutil.ReadFile("testdb.sql")
2525
assert.NoError(t, err)
2626

27-
db, err := sql.Open("postgres", "postgres://localhost/elastic_test?sslmode=disable")
27+
db, err := sql.Open("postgres", "postgres://temba:temba@localhost:5432/elastic_test?sslmode=disable")
2828
assert.NoError(t, err)
2929

3030
_, err = db.Exec(string(testDB))

0 commit comments

Comments
 (0)