lint: Reformat YAML files with Prettier.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-01 12:19:49 -07:00 committed by Tim Abbott
parent 40f76bb030
commit 2794bc1ef4
5 changed files with 3320 additions and 3451 deletions

View File

@ -9,9 +9,9 @@ aliases:
run: run:
name: create cache directories name: create cache directories
command: | command: |
dirs=(/srv/zulip-{npm,venv,emoji}-cache) dirs=(/srv/zulip-{npm,venv,emoji}-cache)
sudo mkdir -p "${dirs[@]}" sudo mkdir -p "${dirs[@]}"
sudo chown -R circleci "${dirs[@]}" sudo chown -R circleci "${dirs[@]}"
- &restore_cache_package_json - &restore_cache_package_json
restore_cache: restore_cache:
@ -32,24 +32,24 @@ aliases:
run: run:
name: install dependencies name: install dependencies
command: | command: |
sudo apt-get update sudo apt-get update
# Install moreutils so we can use `ts` and `mispipe` in the following. # Install moreutils so we can use `ts` and `mispipe` in the following.
sudo apt-get install -y moreutils sudo apt-get install -y moreutils
# CircleCI sets the following in Git config at clone time: # CircleCI sets the following in Git config at clone time:
# url.ssh://git@github.com.insteadOf https://github.com # url.ssh://git@github.com.insteadOf https://github.com
# This breaks the Git clones in the NVM `install.sh` we run # This breaks the Git clones in the NVM `install.sh` we run
# in `install-node`. # in `install-node`.
# TODO: figure out why that breaks, and whether we want it. # TODO: figure out why that breaks, and whether we want it.
# (Is it an optimization?) # (Is it an optimization?)
rm -f /home/circleci/.gitconfig rm -f /home/circleci/.gitconfig
# This is the main setup job for the test suite # This is the main setup job for the test suite
mispipe "tools/ci/setup-backend --skip-dev-db-build" ts mispipe "tools/ci/setup-backend --skip-dev-db-build" ts
# Cleaning caches is mostly unnecessary in Circle, because # Cleaning caches is mostly unnecessary in Circle, because
# most builds don't get to write to the cache. # most builds don't get to write to the cache.
# mispipe "scripts/lib/clean-unused-caches --verbose --threshold 0 2>&1" ts # mispipe "scripts/lib/clean-unused-caches --verbose --threshold 0 2>&1" ts
- &save_cache_package_json - &save_cache_package_json
save_cache: save_cache:
@ -73,96 +73,96 @@ aliases:
run: run:
name: do Bionic hack name: do Bionic hack
command: | command: |
# Temporary hack till `sudo service redis-server start` gets fixes in Bionic. See # Temporary hack till `sudo service redis-server start` gets fixes in Bionic. See
# https://chat.zulip.org/#narrow/stream/3-backend/topic/Ubuntu.20bionic.20CircleCI # https://chat.zulip.org/#narrow/stream/3-backend/topic/Ubuntu.20bionic.20CircleCI
sudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf sudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf
- &run_backend_tests - &run_backend_tests
run: run:
name: run backend tests name: run backend tests
command: | command: |
. /srv/zulip-py3-venv/bin/activate . /srv/zulip-py3-venv/bin/activate
mispipe "./tools/ci/backend 2>&1" ts mispipe "./tools/ci/backend 2>&1" ts
- &run_frontend_tests - &run_frontend_tests
run: run:
name: run frontend tests name: run frontend tests
command: | command: |
. /srv/zulip-py3-venv/bin/activate . /srv/zulip-py3-venv/bin/activate
mispipe "./tools/ci/frontend 2>&1" ts mispipe "./tools/ci/frontend 2>&1" ts
- &upload_coverage_report - &upload_coverage_report
run: run:
name: upload coverage report name: upload coverage report
command: | command: |
# codecov requires `.coverage` file to be stored in pwd for # codecov requires `.coverage` file to be stored in pwd for
# uploading coverage results. # uploading coverage results.
mv /home/circleci/zulip/var/.coverage /home/circleci/zulip/.coverage mv /home/circleci/zulip/var/.coverage /home/circleci/zulip/.coverage
. /srv/zulip-py3-venv/bin/activate . /srv/zulip-py3-venv/bin/activate
# TODO: Check that the next release of codecov doesn't # TODO: Check that the next release of codecov doesn't
# throw find error. # throw find error.
# codecov==2.0.16 introduced a bug which uses "find" # codecov==2.0.16 introduced a bug which uses "find"
# for locating files which is buggy on some platforms. # for locating files which is buggy on some platforms.
# It was fixed via https://github.com/codecov/codecov-python/pull/217 # It was fixed via https://github.com/codecov/codecov-python/pull/217
# and should get automatically fixed here once it's released. # and should get automatically fixed here once it's released.
# We cannot pin the version here because we need the latest version for uploading files. # We cannot pin the version here because we need the latest version for uploading files.
# see https://community.codecov.io/t/http-400-while-uploading-to-s3-with-python-codecov-from-travis/1428/7 # see https://community.codecov.io/t/http-400-while-uploading-to-s3-with-python-codecov-from-travis/1428/7
pip install codecov && codecov \ pip install codecov && codecov \
|| echo "Error in uploading coverage reports to codecov.io." || echo "Error in uploading coverage reports to codecov.io."
- &build_production - &build_production
run: run:
name: build production name: build production
command: | command: |
sudo apt-get update sudo apt-get update
# Install moreutils so we can use `ts` and `mispipe` in the following. # Install moreutils so we can use `ts` and `mispipe` in the following.
sudo apt-get install -y moreutils sudo apt-get install -y moreutils
mispipe "./tools/ci/production-build 2>&1" ts mispipe "./tools/ci/production-build 2>&1" ts
- &production_extract_tarball - &production_extract_tarball
run: run:
name: production extract tarball name: production extract tarball
command: | command: |
sudo apt-get update sudo apt-get update
# Install moreutils so we can use `ts` and `mispipe` in the following. # Install moreutils so we can use `ts` and `mispipe` in the following.
sudo apt-get install -y moreutils sudo apt-get install -y moreutils
mispipe "/tmp/production-extract-tarball 2>&1" ts mispipe "/tmp/production-extract-tarball 2>&1" ts
- &install_production - &install_production
run: run:
name: install production name: install production
command: | command: |
sudo service rabbitmq-server restart sudo service rabbitmq-server restart
sudo mispipe "/tmp/production-install 2>&1" ts sudo mispipe "/tmp/production-install 2>&1" ts
- &verify_production - &verify_production
run: run:
name: verify install name: verify install
command: | command: |
sudo mispipe "/tmp/production-verify 2>&1" ts sudo mispipe "/tmp/production-verify 2>&1" ts
- &upgrade_postgresql - &upgrade_postgresql
run: run:
name: upgrade postgresql name: upgrade postgresql
command: | command: |
sudo mispipe "/tmp/production-upgrade-pg 2>&1" ts sudo mispipe "/tmp/production-upgrade-pg 2>&1" ts
- &check_xenial_provision_error - &check_xenial_provision_error
run: run:
name: check tools/provision error message on xenial name: check tools/provision error message on xenial
command: | command: |
! tools/provision > >(tee provision.out) ! tools/provision > >(tee provision.out)
grep -Fqx 'CRITICAL:root:Unsupported platform: ubuntu 16.04' provision.out grep -Fqx 'CRITICAL:root:Unsupported platform: ubuntu 16.04' provision.out
- &check_xenial_upgrade_error - &check_xenial_upgrade_error
run: run:
name: check scripts/lib/upgrade-zulip-stage-2 error message on xenial name: check scripts/lib/upgrade-zulip-stage-2 error message on xenial
command: | command: |
! sudo scripts/lib/upgrade-zulip-stage-2 2> >(tee upgrade.err >&2) ! sudo scripts/lib/upgrade-zulip-stage-2 2> >(tee upgrade.err >&2)
grep -Fq 'upgrade-zulip-stage-2: Unsupported platform: ubuntu 16.04' upgrade.err grep -Fq 'upgrade-zulip-stage-2: Unsupported platform: ubuntu 16.04' upgrade.err
- &notify_failure_status - &notify_failure_status
run: run:
@ -171,11 +171,11 @@ aliases:
branches: branches:
only: master only: master
command: | command: |
if [[ "$CIRCLE_REPOSITORY_URL" == "git@github.com:zulip/zulip.git" && "$ZULIP_BOT_KEY" != "" ]]; then if [[ "$CIRCLE_REPOSITORY_URL" == "git@github.com:zulip/zulip.git" && "$ZULIP_BOT_KEY" != "" ]]; then
curl -H "Content-Type: application/json" \ curl -H "Content-Type: application/json" \
-X POST -i 'https://chat.zulip.org/api/v1/external/circleci?api_key='"$ZULIP_BOT_KEY"'&stream=automated%20testing&topic=master%20failing' \ -X POST -i 'https://chat.zulip.org/api/v1/external/circleci?api_key='"$ZULIP_BOT_KEY"'&stream=automated%20testing&topic=master%20failing' \
-d '{"payload": { "branch": "'"$CIRCLE_BRANCH"'", "reponame": "'"$CIRCLE_PROJECT_REPONAME"'", "status": "failed", "build_url": "'"$CIRCLE_BUILD_URL"'", "username": "'"$CIRCLE_USERNAME"'"}}' -d '{"payload": { "branch": "'"$CIRCLE_BRANCH"'", "reponame": "'"$CIRCLE_PROJECT_REPONAME"'", "status": "failed", "build_url": "'"$CIRCLE_BUILD_URL"'", "username": "'"$CIRCLE_USERNAME"'"}}'
fi fi
jobs: jobs:
"bionic-backend-frontend": "bionic-backend-frontend":
@ -203,8 +203,8 @@ jobs:
- run: - run:
name: test locked requirements name: test locked requirements
command: | command: |
. /srv/zulip-py3-venv/bin/activate . /srv/zulip-py3-venv/bin/activate
mispipe "./tools/test-locked-requirements 2>&1" ts mispipe "./tools/test-locked-requirements 2>&1" ts
- *run_frontend_tests - *run_frontend_tests
# We only need to upload coverage reports on whichever platform # We only need to upload coverage reports on whichever platform
@ -227,31 +227,30 @@ jobs:
path: ./var/xunit-test-results/casper/ path: ./var/xunit-test-results/casper/
- *notify_failure_status - *notify_failure_status
"focal-backend": "focal-backend":
docker: docker:
# This is built from tools/ci/images/focal/Dockerfile. # This is built from tools/ci/images/focal/Dockerfile.
# Focal ships with Python 3.8.2. # Focal ships with Python 3.8.2.
- image: arpit551/circleci:focal-python-test - image: arpit551/circleci:focal-python-test
working_directory: ~/zulip working_directory: ~/zulip
steps: steps:
- checkout - checkout
- *create_cache_directories - *create_cache_directories
- *restore_cache_package_json - *restore_cache_package_json
- *restore_cache_requirements - *restore_cache_requirements
- *restore_emoji_cache - *restore_emoji_cache
- *install_dependencies - *install_dependencies
- *save_cache_package_json - *save_cache_package_json
- *save_cache_requirements - *save_cache_requirements
- *save_emoji_cache - *save_emoji_cache
- *run_backend_tests - *run_backend_tests
- run: - run:
name: Check development database build name: Check development database build
command: mispipe "tools/ci/setup-backend" ts command: mispipe "tools/ci/setup-backend" ts
- *notify_failure_status - *notify_failure_status
"xenial-legacy": "xenial-legacy":
docker: docker:
@ -351,9 +350,9 @@ jobs:
- run: - run:
name: do memcached hack name: do memcached hack
command: | command: |
# Temporary hack till memcached upstream is updated in Focal. # Temporary hack till memcached upstream is updated in Focal.
# https://bugs.launchpad.net/ubuntu/+source/memcached/+bug/1878721 # https://bugs.launchpad.net/ubuntu/+source/memcached/+bug/1878721
echo "export SASL_CONF_PATH=/etc/sasl2" | sudo tee - a /etc/default/memcached echo "export SASL_CONF_PATH=/etc/sasl2" | sudo tee - a /etc/default/memcached
- *production_extract_tarball - *production_extract_tarball
- *restore_cache_package_json - *restore_cache_package_json

View File

@ -7,24 +7,24 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
# We must fetch at least the immediate parents so that if this is # We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head. # a pull request then we can checkout the head.
fetch-depth: 2 fetch-depth: 2
# If this run was triggered by a pull request event, then checkout # If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit. # the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2 - run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v1 uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java
- name: Perform CodeQL Analysis # Override language selection by uncommenting this and choosing your languages
uses: github/codeql-action/analyze@v1 # with:
# languages: go, javascript, csharp, python, cpp, java
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -1,7 +1,7 @@
# See https://github.com/returntocorp/semgrep/blob/experimental/docs/config/advanced.md # See https://github.com/returntocorp/semgrep/blob/experimental/docs/config/advanced.md
rules: rules:
####################### PYTHON RULES ####################### ####################### PYTHON RULES #######################
- id: deprecated-render-usage - id: deprecated-render-usage
pattern: django.shortcuts.render_to_response(...) pattern: django.shortcuts.render_to_response(...)
message: "Use render() (from django.shortcuts) instead of render_to_response()" message: "Use render() (from django.shortcuts) instead of render_to_response()"

View File

@ -1,140 +1,115 @@
test1: test1:
responses: responses:
'200': "200":
content: content:
application/json: application/json:
schema: schema:
additionalProperties: false additionalProperties: false
properties: properties:
top_array: top_array:
type: array type: array
items: items:
oneOf: oneOf:
- type: object - type: object
properties: properties:
obj: obj:
oneOf: oneOf:
- type: array - type: array
items: items:
type: string type: string
- type: object - type: object
properties: properties:
str3: str3:
type: string type: string
- type: array - type: array
items: items:
type: object type: object
properties: properties:
str1: str1:
type: string type: string
str2: str2:
type: string type: string
example: example:
{ {
"top_array": [ "top_array":
{ [
"obj": { { "obj": { "str3": "test" } },
"str3": "test" [{ "str1": "success", "str2": "success" }],
} ],
}, }
[
{
"str1": "success",
"str2": "success"
}
]
]
}
test2: test2:
responses: responses:
'200': "200":
content: content:
application/json: application/json:
schema: schema:
additionalProperties: false additionalProperties: false
properties: properties:
top_array: top_array:
type: array type: array
items: items:
oneOf: oneOf:
- type: object - type: object
properties: properties:
obj: obj:
oneOf: oneOf:
- type: array - type: array
items: items:
type: string type: string
- type: object - type: object
additionalProperties: false additionalProperties: false
properties: properties:
str3: str3:
type: string type: string
- type: array - type: array
items: items:
type: object type: object
properties: properties:
str1: str1:
type: string type: string
str2: str2:
type: string type: string
example: example:
{ {
"top_array": [ "top_array":
{ [
"obj": { { "obj": { "str3": "test", "str4": "extraneous" } },
"str3": "test", [{ "str1": "success", "str2": "success" }],
"str4": "extraneous" ],
} }
},
[
{
"str1": "success",
"str2": "success"
}
]
]
}
test3: test3:
responses: responses:
'200': "200":
content: content:
application/json: application/json:
schema: schema:
additionalProperties: false additionalProperties: false
properties: properties:
top_array: top_array:
type: array type: array
items: items:
oneOf: oneOf:
- type: object - type: object
properties: properties:
obj: obj:
oneOf: oneOf:
- type: array - type: array
items: items:
type: string type: string
- type: object - type: object
- type: array - type: array
items: items:
type: object type: object
properties: properties:
str1: str1:
type: string type: string
str2: str2:
type: string type: string
example: example:
{ {
"top_array": [ "top_array":
{ [
"obj": { { "obj": { "str3": "test" } },
"str3": "test" [{ "str1": "success", "str2": "success" }],
} ],
}, }
[
{
"str1": "success",
"str2": "success"
}
]
]
}

File diff suppressed because it is too large Load Diff