Skip to content

Commit

Permalink
github actions setup
Browse files Browse the repository at this point in the history
  • Loading branch information
michele committed Sep 16, 2019
1 parent 682ff79 commit 1d3b69d
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Java CI

on:
pull_request:
branches:
- master
- 2.3.x
push:
branches:
- master
- 2.3.x

jobs:
package:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Package
run: mvn --no-transfer-progress -DskipTests=true package

test:

runs-on: ubuntu-latest

strategy:
matrix:
docker-img:
- docker.io/arangodb:3.3.23
- docker.io/arangodb:3.4.8
- docker.io/arangodb:3.5.0
- docker.io/arangodb/enterprise:3.4.8
- docker.io/arangodb/enterprise:3.5.0
topology:
- single
- cluster

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Start Database
run: ./docker/start_db_${{ matrix.topology }}.sh ${{ matrix.docker-img }}
env:
ARANGO_LICENSE_KEY: ${{ secrets.ARANGO_LICENSE_KEY }}
- name: Test
run: mvn --no-transfer-progress test
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Spring Data ArangoDB

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.arangodb/arangodb-spring-data/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.arangodb/arangodb-spring-data)
[![Actions Status](https://github.com/arangodb/spring-data/workflows/Java%20CI/badge.svg)](https://github.com/arangodb/spring-data/actions)

- [Getting Started](docs/Drivers/SpringData/GettingStarted/README.md)
- [Reference](docs/Drivers/SpringData/Reference/README.md)
Expand All @@ -13,4 +14,4 @@
- [ArangoDB](https://www.arangodb.com/)
- [Demo](https://github.com/arangodb/spring-data-demo)
- [Changelog](ChangeLog.md)
- [JavaDoc](http://arangodb.github.io/spring-data/javadoc-3_1)
- [JavaDoc](http://arangodb.github.io/spring-data/javadoc-3_2)
58 changes: 58 additions & 0 deletions docker/start_db_cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

# USAGE:
# export ARANGO_LICENSE_KEY=<arangodb-enterprise-license>
# ./start_db_cluster.sh <dockerImage>

# EXAMPLE:
# ./start_db_cluster.sh docker.io/arangodb:3.5.0

docker pull "$1"

LOCATION=$(pwd)/$(dirname "$0")

docker network create arangodb --subnet 172.28.0.0/16

echo "Averysecretword" > "$LOCATION"/jwtSecret
docker run --rm -v "$LOCATION"/jwtSecret:/jwtSecret "$1" arangodb auth header --auth.jwt-secret /jwtSecret > "$LOCATION"/jwtHeader
AUTHORIZATION_HEADER=$(cat "$LOCATION"/jwtHeader)

docker run -d --rm -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.1.1 --name agent1 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator false --auth.jwt-secret /jwtSecret
docker run -d --rm -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.1.2 --name agent2 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
docker run -d --rm -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.1.3 --name agent3 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret

docker run -d --rm -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.2.1 --name dbserver1 "$1" arangodb --cluster.start-dbserver true --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
docker run -d --rm -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.2.2 --name dbserver2 "$1" arangodb --cluster.start-dbserver true --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
docker run -d --rm -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.2.3 --name dbserver3 "$1" arangodb --cluster.start-dbserver true --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret

docker run -d --rm -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.3.1 --name coordinator1 -p 8529:8529 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator true --starter.join agent1 --auth.jwt-secret /jwtSecret
docker run -d --rm -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.3.2 --name coordinator2 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator true --starter.join agent1 --auth.jwt-secret /jwtSecret

wait_server() {
# shellcheck disable=SC2091
until $(curl --output /dev/null --silent --head --fail -i -H "$AUTHORIZATION_HEADER" "http://$1/_api/version"); do
printf '.'
sleep 1
done
}

# Wait for agents:
for a in 172.28.1.1:8531 \
172.28.1.2:8531 \
172.28.1.3:8531 \
172.28.2.1:8530 \
172.28.2.2:8530 \
172.28.2.3:8530 \
172.28.3.1:8529 \
172.28.3.2:8529 ; do
wait_server $a
done

# wait for port mappings
wait_server 127.0.0.1:8529

docker exec coordinator1 arangosh --server.authentication=false --javascript.execute-string='require("org/arangodb/users").update("root", "test")'

rm "$LOCATION"/jwtHeader "$LOCATION"/jwtSecret

echo "Done, your cluster is ready."
21 changes: 21 additions & 0 deletions docker/start_db_single.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# USAGE:
# export ARANGO_LICENSE_KEY=<arangodb-enterprise-license>
# ./start_db_single.sh <dockerImage>

# EXAMPLE:
# ./start_db_single.sh docker.io/arangodb:3.5.0

docker pull "$1"

docker run -d -e ARANGO_ROOT_PASSWORD=test -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" -p 8529:8529 "$1"

echo "waiting for arangodb ..."

# shellcheck disable=SC2091
until $(curl --output /dev/null --silent --head --fail -i -u root:test 'http://localhost:8529/_api/version'); do
printf '.'
sleep 1
done
echo "READY!"

0 comments on commit 1d3b69d

Please sign in to comment.