Skip to content

Commit

Permalink
Merge branch 'master' into 1812
Browse files Browse the repository at this point in the history
  • Loading branch information
lexi-lambda authored Dec 20, 2019
2 parents 6ec2b9f + 528f16a commit 475d902
Show file tree
Hide file tree
Showing 192 changed files with 4,968 additions and 3,359 deletions.
5 changes: 2 additions & 3 deletions .circleci/cli-builder.dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM golang:1.10
FROM golang:1.13

ARG upx_version="3.94"

# install go dependencies
RUN go get github.com/golang/dep/cmd/dep \
&& go get github.com/mitchellh/gox \
RUN go get github.com/mitchellh/gox \
&& go get github.com/hasura/go-bindata/go-bindata \
&& go get github.com/tcnksm/ghr

Expand Down
53 changes: 41 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,12 @@ jobs:
<<: *test_server
environment:
PG_VERSION: "12"
POSTGIS_VERSION: "3.0.0"
docker:
- image: hasura/graphql-engine-server-builder:20190826
- image: circleci/postgres:12-alpine-postgis
- image: hasura/postgres-12.0-alpine-postgis3:6cbd863d47c0
<<: *test_pg_env

test_server_pg_11:
<<: *test_server
environment:
Expand Down Expand Up @@ -263,30 +264,53 @@ jobs:
- image: circleci/postgres:9.5-alpine-postgis
<<: *test_pg_env

server_property_tests:
resource_class: large
docker:
- image: hasura/graphql-engine-server-builder:20190826
working_directory: ~/graphql-engine
steps:
- attach_workspace:
at: /build
- *skip_job_on_ciignore
- checkout
- restore_cache:
keys:
- server-app-cache-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- server-deps-cache-{{ checksum "server/graphql-engine.cabal" }}-{{ checksum "server/stack.yaml" }}
- run:
name: Run property tests
environment:
GHCRTS: -N2
command: |
/build/_server_output/graphql-engine-tests property
test_cli_with_last_release:
docker:
- image: hasura/graphql-engine-cli-builder:v0.4
- image: hasura/graphql-engine-cli-builder:20191205
- image: circleci/postgres:10-alpine
environment:
POSTGRES_USER: gql_test
POSTGRES_DB: gql_test
working_directory: /go/src/github.com/hasura/graphql-engine
working_directory: ~/graphql-engine
steps:
- attach_workspace:
at: /build
- *skip_job_on_ciignore
- checkout
- restore_cache:
keys:
- cli-vendor-{{ checksum "cli/Gopkg.toml" }}-{{ checksum "cli/Gopkg.lock" }}
- cli-gopkg-{{ checksum "cli/go.mod" }}-{{ checksum "cli/go.sum" }}
- run:
name: get cli dependencies
working_directory: cli
command: make deps
- save_cache:
key: cli-vendor-{{ checksum "cli/Gopkg.toml" }}-{{ checksum "cli/Gopkg.lock" }}
key: cli-gopkg-{{ checksum "cli/go.mod" }}-{{ checksum "cli/go.sum" }}
paths:
- cli/vendor
- /go/pkg
- *wait_for_postgres
- run:
name: test cli
Expand All @@ -298,28 +322,28 @@ jobs:
# test and build cli
test_and_build_cli:
docker:
- image: hasura/graphql-engine-cli-builder:v0.4
- image: hasura/graphql-engine-cli-builder:20191205
- image: circleci/postgres:10-alpine
environment:
POSTGRES_USER: gql_test
POSTGRES_DB: gql_test
working_directory: /go/src/github.com/hasura/graphql-engine
working_directory: ~/graphql-engine
steps:
- attach_workspace:
at: /build
- *skip_job_on_ciignore
- checkout
- restore_cache:
keys:
- cli-vendor-{{ checksum "cli/Gopkg.toml" }}-{{ checksum "cli/Gopkg.lock" }}
- cli-gopkg-{{ checksum "cli/go.mod" }}-{{ checksum "cli/go.sum" }}
- run:
name: get cli dependencies
working_directory: cli
command: make deps
- save_cache:
key: cli-vendor-{{ checksum "cli/Gopkg.toml" }}-{{ checksum "cli/Gopkg.lock" }}
key: cli-gopkg-{{ checksum "cli/go.mod" }}-{{ checksum "cli/go.sum" }}
paths:
- cli/vendor
- /go/pkg
- *wait_for_postgres
- run:
name: test cli
Expand Down Expand Up @@ -498,6 +522,10 @@ workflows:
<<: *filter_only_vtags
requires:
- build_server
- server_property_tests:
<<: *filter_only_vtags
requires:
- build_server
- test_server_upgrade:
<<: *filter_only_vtags
requires:
Expand All @@ -510,6 +538,7 @@ workflows:
- test_server_pg_10
- test_server_pg_9.6
- test_server_pg_9.5
- server_property_tests
- test_server_upgrade
- test_cli_with_last_release:
<<: *filter_only_vtags
Expand Down
45 changes: 45 additions & 0 deletions .circleci/postgres:12.0-alpine-postgis3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# See https://github.com/appropriate/docker-postgis/issues/157#issuecomment-562812857

FROM circleci/postgres:12.0-alpine

ENV POSTGIS_VERSION 3.0.0

RUN set -ex \
\
&& apk add --no-cache --virtual .fetch-deps ca-certificates openssl tar \
\
&& wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \
&& mkdir -p /usr/src/postgis \
&& tar \
--extract \
--file postgis.tar.gz \
--directory /usr/src/postgis \
--strip-components 1 \
&& rm postgis.tar.gz \
\
&& apk add --no-cache --virtual .build-deps \
autoconf automake json-c-dev libtool libxml2-dev make perl llvm clang clang-dev \
\
&& apk add --no-cache --virtual .build-deps-edge \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
g++ gdal-dev geos-dev proj-dev protobuf-c-dev \
&& cd /usr/src/postgis \
&& ./autogen.sh \
&& ./configure \
&& make \
&& make install \
&& apk add --no-cache --virtual .postgis-rundeps \
json-c \
&& apk add --no-cache --virtual .postgis-rundeps-edge \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
geos gdal proj protobuf-c libstdc++ \
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps .build-deps-edge

ADD https://raw.githubusercontent.com/appropriate/docker-postgis/master/initdb-postgis.sh /docker-entrypoint-initdb.d/postgis.sh
ADD https://raw.githubusercontent.com/appropriate/docker-postgis/master/update-postgis.sh /usr/local/bin/update-postgis.sh

RUN chmod +r /docker-entrypoint-initdb.d/postgis.sh && chmod +rx /usr/local/bin/update-postgis.sh
2 changes: 1 addition & 1 deletion .circleci/test-cli-with-last-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ PID=$!
wait_for_port 8080

# test cli
GOCACHE=off HASURA_GRAPHQL_TEST_ENDPOINT="http://localhost:8080" HASURA_GRAPHQL_TEST_ADMIN_SECRET="abcd" make test
HASURA_GRAPHQL_TEST_ENDPOINT="http://localhost:8080" HASURA_GRAPHQL_TEST_ADMIN_SECRET="abcd" make test
kill -s INT $PID
2 changes: 1 addition & 1 deletion .circleci/test-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ PID=$!
wait_for_port 8080

# test cli
GOCACHE=off HASURA_GRAPHQL_TEST_ENDPOINT="http://localhost:8080" HASURA_GRAPHQL_TEST_ADMIN_SECRET="abcd" make test
HASURA_GRAPHQL_TEST_ENDPOINT="http://localhost:8080" HASURA_GRAPHQL_TEST_ADMIN_SECRET="abcd" make test
kill -s INT $PID
57 changes: 55 additions & 2 deletions .circleci/test-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ run_pytest_parallel() {
fi
}

echo -e "\n$(time_elapsed): <########## RUN GRAPHQL-ENGINE HASKELL TESTS ###########################################>\n"
"${GRAPHQL_ENGINE_TESTS:?}"
echo -e "\n$(time_elapsed): <########## RUN GRAPHQL-ENGINE HASKELL TESTS(migrate) ###########################################>\n"
"${GRAPHQL_ENGINE_TESTS:?}" migrate

echo -e "\n$(time_elapsed): <########## TEST GRAPHQL-ENGINE WITHOUT ADMIN SECRET ###########################################>\n"
TEST_TYPE="no-auth"
Expand Down Expand Up @@ -545,6 +545,59 @@ kill_hge_servers

# end allowlist queries test

# jwk test
unset HASURA_GRAPHQL_AUTH_HOOK
unset HASURA_GRAPHQL_AUTH_HOOK_MODE
unset HASURA_GRAPHQL_JWT_SECRET

echo -e "\n$(time_elapsed): <########## TEST GRAPHQL-ENGINE WITH JWK URL ########> \n"
TEST_TYPE="jwk-url"

# start the JWK server
python3 jwk_server.py > "$OUTPUT_FOLDER/jwk_server.log" 2>&1 & JWKS_PID=$!
wait_for_port 5001

cache_control_jwk_url='{"type": "RS256", "jwk_url": "http://localhost:5001/jwk-cache-control"}'
expires_jwk_url='{"type": "RS256", "jwk_url": "http://localhost:5001/jwk-expires"}'

# start HGE with cache control JWK URL
export HASURA_GRAPHQL_JWT_SECRET=$cache_control_jwk_url
run_hge_with_args serve
wait_for_port 8080

pytest -n 1 -vv --hge-urls "$HGE_URL" --pg-urls "$HASURA_GRAPHQL_DATABASE_URL" --hge-key="$HASURA_GRAPHQL_ADMIN_SECRET" --test-jwk-url test_jwk.py -k 'test_cache_control_header'

kill_hge_servers
unset HASURA_GRAPHQL_JWT_SECRET

run_hge_with_args serve --jwt-secret "$cache_control_jwk_url"
wait_for_port 8080

pytest -n 1 -vv --hge-urls "$HGE_URL" --pg-urls "$HASURA_GRAPHQL_DATABASE_URL" --hge-key="$HASURA_GRAPHQL_ADMIN_SECRET" --test-jwk-url test_jwk.py -k 'test_cache_control_header'

kill_hge_servers

# start HGE with expires JWK URL
export HASURA_GRAPHQL_JWT_SECRET=$expires_jwk_url
run_hge_with_args serve
wait_for_port 8080

pytest -n 1 -vv --hge-urls "$HGE_URL" --pg-urls "$HASURA_GRAPHQL_DATABASE_URL" --hge-key="$HASURA_GRAPHQL_ADMIN_SECRET" --test-jwk-url test_jwk.py -k 'test_expires_header'

kill_hge_servers
unset HASURA_GRAPHQL_JWT_SECRET

run_hge_with_args serve --jwt-secret "$expires_jwk_url"
wait_for_port 8080

pytest -n 1 -vv --hge-urls "$HGE_URL" --pg-urls "$HASURA_GRAPHQL_DATABASE_URL" --hge-key="$HASURA_GRAPHQL_ADMIN_SECRET" --test-jwk-url test_jwk.py -k 'test_expires_header'

kill_hge_servers

kill $JWKS_PID

# end jwk url test

# horizontal scale test
unset HASURA_GRAPHQL_AUTH_HOOK
unset HASURA_GRAPHQL_AUTH_HOOK_MODE
Expand Down
4 changes: 1 addition & 3 deletions cli/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ from [shahidhk](https://github.com/shahidhk)'s [calendar](https://calendly.com/s

## Pre-requisites

- [Go >= 1.10](https://golang.org/doc/install)
- [Go >= 1.11](https://golang.org/doc/install)
- [GNU Make](https://www.gnu.org/software/make/) (optional)

You can follow your existing Golang workflow to fork, work on a branch and
submit PR. If you're new to forking and working on Golang repositories, please
follow the instructions below to make sure the import paths are correct:

- Fork the repo on GitHub
- `mkdir -p $GOPATH/src/github.com/hasura`
- `cd $GOPATH/src/github.com/hasura`
- `git clone https://github.com/<your-username>/graphql-engine`
- `cd graphql-engine/cli`
- `git remote add upstream https://github.com/hasura/graphql-engine`
Expand Down
Loading

0 comments on commit 475d902

Please sign in to comment.