Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperAlexander committed May 27, 2023
0 parents commit 3ebd967
Show file tree
Hide file tree
Showing 11 changed files with 191 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
QUERY_DEFAULTS_LIMIT=25
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true
PERSISTENCE_DATA_PATH=/var/lib/weaviate
DEFAULT_VECTORIZER_MODULE=none
CLUSTER_HOSTNAME=node1
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test Weaviate Server

on: [push, pull_request]

jobs:
weaviate-action:
name: Start Weaviate Server
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.0.1
with:
version: 6.32.2

- name: Setup Weaviate
uses: ./
with:
weaviate-version: 'latest'
weaviate-port: 8080

- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install dependencies
run: pnpm install

- name: Run tests
run: pnpm test ./test/connection
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# dependencies
node_modules
.pnp
.pnp.js
*-lock.*
*.lock

# testing
coverage

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

## 1.0.0

### Minor Changes
- Initial release.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM docker:stable
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Jasper Alexander

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Weaviate GitHub Action

This GitHub Action starts a Weaviate server. You can configure the version an port that are being used. The default version is `latest` and the default port is `8080`.

## Usage

```yml
name: Test Weaviate

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Weaviate
uses: JasperAlexander@weaviate-github-action@1.0.0
with:
- weaviate-version: 'latest'
- weaviate-port: 8080
```
17 changes: 17 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Weaviate GitHub Action'
description: 'Start a Weaviate server'
inputs:
weaviate-version:
description: 'Weaviate version to use (defaults to latest)'
required: false
default: 'latest'
weaviate-port:
description: 'Weaviate port to use (defaults to 8080)'
required: false
default: 8080
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.weaviate-version }}
- ${{ inputs.weaviate-port }}
18 changes: 18 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh -l

WEAVIATE_VERSION=$1
WEAVIATE_PORT=$2

echo "::group::Starting Weaviate"
echo " - version [$WEAVIATE_VERSION]"
echo " - port [$WEAVIATE_PORT]"
echo ""

docker run --name weaviate --publish $WEAVIATE_PORT:$WEAVIATE_PORT --env-file ./.env --detach semitechnologies/weaviate:$WEAVIATE_VERSION

if [ $? -ne 0 ]; then
echo "Error starting Weaviate in Docker container"
exit 2
fi

echo "::endgroup::"
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "@JasperAlexander/weaviate-github-action",
"version": "1.0.0",
"description": "Weaviate GitHub Action",
"author": "Jasper Alexander",
"license": "MIT",
"homepage": "https://github.com/JasperAlexander/weaviate-github-action",
"keywords": [
"github",
"github-action",
"weaviate"
],
"bugs": {
"url": "https://github.com/JasperAlexander/weaviate-github-action/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/JasperAlexander/weaviate-github-action.git"
},
"scripts": {
"test": "c8 --include=dist uvu --ignore fixtures",
"posttest": "c8 report --reporter=html"
},
"devDependencies": {
"c8": "^7.13.0",
"graphql": "^16.6.0",
"uvu": "^0.5.6",
"weaviate-ts-client": "^1.3.2"
},
"engines": {
"node": ">=14.0.0"
}
}
15 changes: 15 additions & 0 deletions test/connection/connection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict'

const { test } = require('uvu')
const { default: weaviate } = require('weaviate-ts-client')

test('connects to Weaviate on port 8080', () => {
const weaviateClient = weaviate.client({
scheme: 'http',
host: 'localhost:8080',
})

weaviateClient.misc.metaGetter().do()
})

test.run()

0 comments on commit 3ebd967

Please sign in to comment.