这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
108a084
wip: server assets from local server
shahidhk May 9, 2019
111fa55
wip: static console assets
shahidhk May 10, 2019
00fd644
wip: fix version
shahidhk May 13, 2019
3b77ddb
Merge branch 'master' into console-assets
shahidhk May 13, 2019
9950940
wip
shahidhk May 13, 2019
59de585
Merge branch 'master' into console-assets
shahidhk May 14, 2019
90f365c
wip: add console assets handler
shahidhk May 14, 2019
1e0b51c
console changes for local assets
shahidhk May 14, 2019
e3b86a1
add working static assets server
shahidhk May 14, 2019
88c7939
add config to force load assets from server itself
shahidhk May 14, 2019
66049bd
add local-console flag support
shahidhk May 14, 2019
0c5436e
add event dispatch and listener
shahidhk May 14, 2019
701023f
add event dispatch and listener
shahidhk May 14, 2019
6efb151
Merge branch 'console-assets' of github.com:shahidhk/graphql-engine i…
shahidhk May 14, 2019
f6c8a57
wip: update circleci conf
shahidhk May 15, 2019
4032780
build console assets into server image
shahidhk May 15, 2019
f9c2a0f
rever lts version change
shahidhk May 15, 2019
8ac6e21
fix broken links
shahidhk May 15, 2019
a17f344
change the way how assets are pushed to ci
shahidhk May 15, 2019
550869a
remove salve
shahidhk May 15, 2019
5e4ae8a
remote local-console flag
shahidhk May 15, 2019
c3e14e4
update contributing guide
shahidhk May 15, 2019
7563131
change console html server to use mkspockaction handler
shahidhk May 15, 2019
bb744e7
serve static assets only if the flag is set
shahidhk May 15, 2019
22b3c3f
remove unused variable
shahidhk May 15, 2019
9ec8306
Delete main.js
shahidhk May 15, 2019
61b5696
cli: update console html and version assets generation for cli
shahidhk May 16, 2019
f1c13bb
ci: update workflow name
shahidhk May 16, 2019
34d7e8d
Merge branch 'master' into console-assets
shahidhk May 16, 2019
fa55803
update docs
shahidhk May 16, 2019
302adba
update docs
rikinsk May 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 72 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ jobs:
apt-get -y update
apt-get -y install postgresql-client-11
- run:
name: Build the server
name: Build the binary
working_directory: ./server
command: |
# for PRs non-optimized build, else optimized build
Expand All @@ -188,6 +188,16 @@ jobs:
echo "Non-release branch, non-optimized build with coverage"
BUILD_FLAGS="--fast --coverage" make ci-binary
fi
- run:
name: Build the docker image
working_directory: ./server
command: |
# copy console assets to the rootfs - packaging/build/rootfs
export ROOTFS=packaging/build/rootfs
mkdir -p "$ROOTFS/srv"
cp -r /build/_console_output/assets "$ROOTFS/srv/console-assets"

# build and save the image
make ci-image
make ci-save-image
- save_cache:
Expand Down Expand Up @@ -331,18 +341,11 @@ jobs:
paths:
- _cli_output

# test and build console
test_and_build_console:
# build console assets
build_console:
docker:
- image: hasura/graphql-engine-console-builder:v0.3
environment:
CYPRESS_KEY: 983be0db-0f19-40cc-bfc4-194fcacd85e1
- image: circleci/postgres:10-alpine-postgis
environment:
POSTGRES_USER: gql_test
POSTGRES_DB: gql_test
- image: hasura/graphql-engine-console-builder:20190515
working_directory: ~/graphql-engine
parallelism: 4
steps:
- attach_workspace:
at: /build
Expand All @@ -362,16 +365,26 @@ jobs:
- console/node_modules
- ~/.npm
- ~/.cache
- *wait_for_postgres
- run:
name: test console
command: .circleci/test-console.sh
- run:
name: build console
working_directory: console
command: |
make build
make ci-copy-assets
- run:
name: setup assets directory
command: |
export ASSETS_PATH=/build/_console_output/assets
mkdir -p "$ASSETS_PATH"
gsutil -m cp -r gs://graphql-engine-cdn.hasura.io/console/assets/common "$ASSETS_PATH"
# gsutil decompresses files automatically, need to compress font-awesome again
# (see https://github.com/GoogleCloudPlatform/gsutil/issues/515)
mv "$ASSETS_PATH/common/css/font-awesome.min.css.gz" "$ASSETS_PATH/common/css/font-awesome.min.css"
gzip "$ASSETS_PATH/common/css/font-awesome.min.css"
# copy versioned assets and compress them
mkdir -p "$ASSETS_PATH/versioned"
cp "$ASSETS_PATH"/../{main.js,main.css,vendor.js} "$ASSETS_PATH/versioned/"
gzip -r "$ASSETS_PATH/versioned/"
- store_artifacts:
path: /build/_console_output
destination: console
Expand All @@ -380,6 +393,42 @@ jobs:
paths:
- _console_output

# test console
test_console:
docker:
- image: hasura/graphql-engine-console-builder:v0.3
environment:
CYPRESS_KEY: 983be0db-0f19-40cc-bfc4-194fcacd85e1
- image: circleci/postgres:10-alpine-postgis
environment:
POSTGRES_USER: gql_test
POSTGRES_DB: gql_test
working_directory: ~/graphql-engine
parallelism: 4
steps:
- attach_workspace:
at: /build
- *skip_job_on_ciignore
- checkout
- restore_cache:
key:
console-npm-cache-{{ checksum "console/package.json" }}-{{ checksum "console/package-lock.json" }}
- run:
name: install dependencies
working_directory: console
command: make ci-deps
- save_cache:
key:
console-npm-cache-{{ checksum "console/package.json" }}-{{ checksum "console/package-lock.json" }}
paths:
- console/node_modules
- ~/.npm
- ~/.cache
- *wait_for_postgres
- run:
name: test console
command: .circleci/test-console.sh

# test server upgrade from last version to current build
test_server_upgrade:
docker:
Expand Down Expand Up @@ -419,13 +468,17 @@ jobs:

workflows:
version: 2
build_and_test:
workflow_v20190516:
jobs:
- check_build_worthiness: *filter_only_vtags
- build_server:
- build_console:
<<: *filter_only_vtags
requires:
- check_build_worthiness
- build_server:
<<: *filter_only_vtags
requires:
- build_console
- pytest_server_pg_11.1:
<<: *filter_only_vtags
requires:
Expand Down Expand Up @@ -462,13 +515,13 @@ workflows:
<<: *filter_only_vtags
requires:
- build_server
- test_and_build_console:
- test_console:
<<: *filter_only_vtags
requires:
- test_and_build_cli
- test_cli_with_last_release
- deploy:
<<: *filter_only_vtags_dev_release_branches
requires:
- test_and_build_console
- test_console
- all_server_tests_pass
15 changes: 14 additions & 1 deletion .circleci/console-builder.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM node:8

ARG gcloud_version="207.0.0"

# update npm
RUN npm install -g npm@5

Expand All @@ -13,4 +16,14 @@ RUN apt-get update && apt-get install -y \
libxss1 \
libasound2 \
xvfb \
&& rm -rf /var/lib/apt/lists/*
&& curl -Lo /tmp/gcloud-${gcloud_version}.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${gcloud_version}-linux-x86_64.tar.gz \
&& tar -xzf /tmp/gcloud-${gcloud_version}.tar.gz -C /usr/local \
&& /usr/local/google-cloud-sdk/install.sh \
&& apt-get -y auto-remove \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /usr/share/doc/ \
&& rm -rf /usr/share/man/ \
&& rm -rf /usr/share/locale/

ENV PATH "/usr/local/google-cloud-sdk/bin:$PATH"
14 changes: 9 additions & 5 deletions .circleci/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ deploy_console() {
echo "deploying console"

cd "$ROOT/console"
export VERSION=$(../scripts/get-version-circleci.sh)
export VERSION=$(../scripts/get-console-assets-version.sh)
export DIST_PATH="/build/_console_output"
make gzip-assets
make gcloud-cp-stable
make gcloud-set-metadata
local GS_BUCKET_ROOT="gs://graphql-engine-cdn.hasura.io/console/assets/$VERSION"
# assets are at /build/_console_output/assets/versioned, already gzipped
gsutil cp "$DIST_PATH/assets/versioned/main.js.gz" "$GS_BUCKET_ROOT/main.js.gz"
gsutil cp "$DIST_PATH/assets/versioned/main.css.gz" "$GS_BUCKET_ROOT/main.css.gz"
gsutil cp "$DIST_PATH/assets/versioned/vendor.js.gz" "$GS_BUCKET_ROOT/vendor.js.gz"
gsutil setmeta -h "Content-Encoding: gzip" "$GS_BUCKET_ROOT/*"

unset VERSION
unset DIST_PATH
}
Expand Down Expand Up @@ -106,7 +110,7 @@ setup_gcloud() {
# push the server binary to google cloud storage
push_server_binary() {
gsutil cp /build/_server_output/graphql-engine \
gs://graphql-engine-cdn.hasura.io/server/latest/linux-amd64
gs://graphql-engine-cdn.hasura.io/server/latest/linux-amd64
}

# skip deploy for pull requests
Expand Down
Loading