Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
wchargin committed Sep 29, 2019
2 parents b8cb2c0 + 10efc9f commit 2dbb33d
Show file tree
Hide file tree
Showing 3,391 changed files with 239,218 additions and 136,281 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
192 changes: 112 additions & 80 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,73 @@
version: 2.1

aliases:
- &opam_env
TERM: dumb
OPAMYES: true

- &docker_opam
- &run_on_tags
filters:
tags:
only: /.*/

executors:
linux-opam:
docker:
- image: ocaml/opam:debian-8_ocaml-4.05.0
- image: ocaml/opam2:debian-8
environment:
<<: *opam_env
working_directory: ~/flow

- &docker_node
linux-node:
docker:
- image: circleci/node:8
working_directory: ~/flow
mac:
macos:
xcode: "9.0"
environment:
<<: *opam_env
working_directory: ~/flow
curl:
docker:
- image: appropriate/curl:latest
working_directory: /flow
flow-website:
docker:
- image: flowtype/flow-website:latest
working_directory: ~/flow
awscli:
docker:
- image: xueshanf/awscli:latest
working_directory: ~/flow

# Saves the currently-installed opam version to a file, which we include
# in cache keys.
- &opam_version
name: Calculate opam version
command: opam --version > .circleci/opamversion

- &opam_deps
name: Install deps from opam
command: |
eval $(opam config env)
opam pin add -n flowtype-ci . | cat
opam depext flowtype-ci | cat
opam install --deps-only flowtype-ci | cat
- &restore_opam_cache
keys:
- opam-cache-{{ arch }}-opam_{{ checksum ".circleci/opamversion" }}-ocaml_4_05_0-{{ checksum "opam" }}
- opam-cache-{{ arch }}-opam_{{ checksum ".circleci/opamversion" }}-ocaml_4_05_0
- opam-cache-{{ arch }}-opam_{{ checksum ".circleci/opamversion" }}
commands:
restore-opam-cache:
steps:
- run:
name: Calculate opam version
command: opam --version > .circleci/opamversion
- restore_cache:
keys:
- opam-cache-{{ arch }}-opam_{{ checksum ".circleci/opamversion" }}-ocaml_4_07_1-{{ checksum "opam" }}

- &save_opam_cache
key: opam-cache-{{ arch }}-opam_{{ checksum ".circleci/opamversion" }}-ocaml_4_05_0-{{ checksum "opam" }}
paths:
- ~/.opam
save-opam-cache:
steps:
- save_cache:
key: opam-cache-{{ arch }}-opam_{{ checksum ".circleci/opamversion" }}-ocaml_4_07_1-{{ checksum "opam" }}
paths:
- ~/.opam

- &run_on_tags
filters:
tags:
only: /.*/
create-opam-switch:
steps:
- run:
name: Install deps from opam
command: |
eval $(opam env)
opam switch create . 4.07.1 --deps-only | cat
version: 2
jobs:
checkout:
<<: *docker_node
executor: linux-node
steps:
- checkout
- run:
Expand All @@ -62,41 +81,50 @@ jobs:
paths: .

build_linux:
<<: *docker_opam
executor: linux-opam
steps:
- attach_workspace:
at: ~/flow
- run:
# TODO: move this to a custom docker image
# installs `zip` and `m4` but also has to fix some apt issues:
# https://discuss.circleci.com/t/failed-to-fetch-jessie-updates/29246
name: Install deps
command: sudo apt-get update && sudo apt-get install zip
- run: *opam_version
- restore_cache: *restore_opam_cache
command: |
sudo rm /etc/apt/sources.list
echo "deb http://archive.debian.org/debian/ jessie main contrib non-free" | sudo tee -a /etc/apt/sources.list
echo "deb http://archive.debian.org/debian/ jessie-backports main contrib non-free" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://archive.debian.org/debian/ jessie main contrib non-free" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://archive.debian.org/debian/ jessie-backports main contrib non-free" | sudo tee -a /etc/apt/sources.list
echo "Acquire::Check-Valid-Until false;" | sudo tee -a /etc/apt/apt.conf.d/10-nocheckvalid
echo 'Package: *\nPin: origin "archive.debian.org"\nPin-Priority: 500' | sudo tee -a /etc/apt/preferences.d/10-archive-pin
sudo apt-get update && sudo apt-get --yes install zip m4
- restore-opam-cache
- run:
name: Update opam repo
command: |
opam remote list -s | grep upstream >/dev/null || \
opam remote add upstream https://opam.ocaml.org | cat
opam update | cat
- run: *opam_deps
- create-opam-switch
- run:
name: Install extra deps from opam
command: opam install js_of_ocaml.3.1.0 | cat
- save_cache: *save_opam_cache
command: opam install js_of_ocaml.3.4.0 | cat
- save-opam-cache
- run:
name: Build flow
command: |
opam config exec -- make bin/flow dist/flow.zip
opam exec -- make bin/flow dist/flow.zip
mkdir -p bin/linux && cp bin/flow bin/linux/flow
- run:
name: Build libflowparser
command: opam config exec -- make -C src/parser dist/libflowparser.zip
command: opam exec -- make -C src/parser dist/libflowparser.zip
- run:
name: Build flow.js
command: opam config exec -- make js
command: opam exec -- make js
- run:
name: Build flow_parser.js
command: opam config exec -- make -C src/parser js
command: opam exec -- make -C src/parser js
- run:
name: Create artifacts
command: |
Expand Down Expand Up @@ -125,43 +153,42 @@ jobs:
destination: flow_parser.js

build_macos:
macos:
xcode: "9.0"
environment:
<<: *opam_env
working_directory: ~/flow
executor: mac
steps:
- attach_workspace:
at: ~/flow
# https://github.com/Homebrew/brew/issues/5513
- run:
name: Fix homebrew python
command: brew update
# https://github.com/Homebrew/homebrew-core/issues/26358
- run:
name: Fix homebrew python
command: brew upgrade python
- run:
name: Install opam
command: command -v opam || brew install opam aspcud
- run: *opam_version
- restore_cache: *restore_opam_cache
- restore-opam-cache
- run:
name: Install ocaml
command: opam init --comp 4.05.0 -yn | cat
command: opam init --comp 4.07.1 -yn | cat
- save_cache:
key: opam-cache-{{ arch }}-opam_{{ checksum ".circleci/opamversion" }}-ocaml_4_05_0
key: opam-cache-{{ arch }}-opam_{{ checksum ".circleci/opamversion" }}-ocaml_4_07_1
paths:
- ~/.opam
- run:
name: Update opam repo
command: opam update | cat
- run: *opam_deps
- save_cache: *save_opam_cache
- create-opam-switch
- save-opam-cache
- run:
name: Build flow
command: |
opam config exec -- make bin/flow dist/flow.zip
opam exec -- make bin/flow dist/flow.zip
mkdir -p bin/macos && cp bin/flow bin/macos/flow
- run:
name: Build libflowparser
command: opam config exec -- make -C src/parser dist/libflowparser.zip
command: opam exec -- make -C src/parser dist/libflowparser.zip
- run:
name: Create artifacts
command: |
Expand All @@ -181,7 +208,9 @@ jobs:
destination: libflowparser-osx.zip

runtests_linux:
<<: *docker_node
executor: linux-node
environment:
FLOW_RUNTESTS_PARALLELISM: 8
steps:
- attach_workspace:
at: ~/flow
Expand All @@ -190,9 +219,7 @@ jobs:
command: ./runtests.sh bin/linux/flow | cat

runtests_macos:
macos:
xcode: "9.0"
working_directory: ~/flow
executor: mac
steps:
- attach_workspace:
at: ~/flow
Expand All @@ -201,7 +228,7 @@ jobs:
command: ./runtests.sh bin/macos/flow | cat

tool_test_linux:
<<: *docker_node
executor: linux-node
steps:
- attach_workspace:
at: ~/flow
Expand All @@ -213,9 +240,7 @@ jobs:
command: ./tool test -p 4 --bin bin/linux/flow | cat # Limit parallelism

tool_test_macos:
macos:
xcode: "9.0"
working_directory: ~/flow
executor: mac
steps:
- attach_workspace:
at: ~/flow
Expand All @@ -227,7 +252,7 @@ jobs:
command: ./tool test --bin bin/macos/flow | cat

npm_pack:
<<: *docker_node
executor: linux-node
steps:
- attach_workspace:
at: ~/flow
Expand All @@ -244,20 +269,36 @@ jobs:
cp dist/libflowparser-linux64.zip packages/flow-parser-bin/dist/release/libflowparser-linux64.zip
cp dist/libflowparser-osx.zip packages/flow-parser-bin/dist/release/libflowparser-osx.zip
make dist/npm-flow-parser-bin.tgz
- run:
name: Pack flow-remove-types and flow-node
command: |
rm -rf packages/flow-node
cp -r packages/flow-remove-types/ packages/flow-node/
sed -i '0,/flow-remove-types/s//flow-node/' packages/flow-node/package.json
make dist/npm-flow-remove-types.tgz
make dist/npm-flow-node.tgz
- persist_to_workspace:
root: .
paths:
- dist/npm-flow-parser.tgz
- dist/npm-flow-parser-bin.tgz
- dist/npm-flow-node.tgz
- dist/npm-flow-remove-types.tgz
- store_artifacts:
path: dist/npm-flow-parser.tgz
destination: npm-flow-parser.tgz
- store_artifacts:
path: dist/npm-flow-parser-bin.tgz
destination: npm-flow-parser-bin.tgz
- store_artifacts:
path: dist/npm-flow-node.tgz
destination: npm-flow-node.tgz
- store_artifacts:
path: dist/npm-flow-remove-types.tgz
destination: npm-flow-remove-types.tgz

npm_deploy:
<<: *docker_node
executor: linux-node
steps:
- attach_workspace:
at: ~/flow
Expand All @@ -266,9 +307,7 @@ jobs:
command: .circleci/deploy_npm.sh

github_linux:
docker:
- image: appropriate/curl:latest
working_directory: /flow
executor: curl
steps:
- attach_workspace:
at: /flow
Expand All @@ -280,9 +319,7 @@ jobs:
command: .circleci/github_upload.sh dist/libflowparser-linux64.zip "libflowparser-linux64-$CIRCLE_TAG.zip"

github_macos:
docker:
- image: appropriate/curl:latest
working_directory: /flow
executor: curl
steps:
- attach_workspace:
at: /flow
Expand All @@ -294,9 +331,7 @@ jobs:
command: .circleci/github_upload.sh dist/libflowparser-osx.zip "libflowparser-osx-$CIRCLE_TAG.zip"

website_deploy:
docker:
- image: flowtype/flow-website:latest
working_directory: ~/flow
executor: flow-website
steps:
- attach_workspace:
at: ~/flow
Expand Down Expand Up @@ -333,9 +368,7 @@ jobs:
command: bundle exec s3_website push --config-dir=website/ --site=dist/flow.org

try_flow_deploy:
docker:
- image: xueshanf/awscli:latest
working_directory: ~/flow
executor: awscli
steps:
- attach_workspace:
at: ~/flow
Expand All @@ -351,7 +384,6 @@ jobs:
command: aws s3 cp ~/try_flow s3://${S3_BUCKET}/static/${CIRCLE_TAG}/ --recursive

workflows:
version: 2
build_and_test:
jobs:
- checkout:
Expand Down
6 changes: 6 additions & 0 deletions .circleci/deploy_npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ npm publish ./dist/npm-flow-parser-bin.tgz;
echo "Publishing flow-parser";
npm publish ./dist/npm-flow-parser.tgz;

echo "Publishing flow-remove-types";
npm publish ./dist/npm-flow-remove-types.tgz;

echo "Publishing flow-node";
npm publish ./dist/npm-flow-node.tgz;

if [ -f ~/.npmrc.bak ]; then mv ~/.npmrc.bak ~/.npmrc; fi
Loading

0 comments on commit 2dbb33d

Please sign in to comment.