mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #10948 - aneeshusa:clean-up-ci-bash-scripts, r=emilio
Clean up CI bash scripts Also reverts #9572. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10948) <!-- Reviewable:end -->
This commit is contained in:
commit
288db30cbe
6 changed files with 47 additions and 26 deletions
29
docs/STYLE_GUIDE.md
Normal file
29
docs/STYLE_GUIDE.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
# Style Guide
|
||||
|
||||
The majority of our style recommendations are automatically enforced via our
|
||||
automated linters. This document has guidelines that are less easy to lint for.
|
||||
|
||||
## Shell scripts
|
||||
|
||||
Shell scripts are OK for small tasks or wrappers, but prefer to use Python for
|
||||
anything with a hint of complexity or in general.
|
||||
|
||||
Shell scripts should be written against bash, starting with this shebang:
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
```
|
||||
|
||||
Note that the version of bash available on OS X by default is quite old, so be
|
||||
careful when using new features.
|
||||
|
||||
Scripts should enable a few options at the top for robustness:
|
||||
```
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
```
|
||||
|
||||
Quote all variables, using the full form: `"${SOME_VARIABLE}"`.
|
||||
|
||||
Use `"$(some-command)"` instead of backticks for command substitution. Note
|
||||
that these should be quoted as well.
|
|
@ -1,11 +1,12 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Make sure listed files do not contain "unwrap"
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
cd $(git rev-parse --show-toplevel) # cd into repo root so make sure paths works in any case
|
||||
cd "$(git rev-parse --show-toplevel)" # cd into repo root so make sure paths works in any case
|
||||
|
||||
# files that should not contain "unwrap"
|
||||
FILES=("components/compositing/compositor.rs"
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
#!/bin/bash
|
||||
diff=$(git diff -- */*/Cargo.lock)
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
diff="$(git diff -- */*/Cargo.lock)"
|
||||
echo "$diff"
|
||||
[[ ! $diff ]]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
@ -11,6 +12,6 @@ set -o pipefail
|
|||
# Adding "--binary=" to skip looking for a compiled servo binary.
|
||||
./mach test-wpt --manifest-update --binary= SKIP_TESTS > /dev/null
|
||||
|
||||
diff=$(git diff -- tests/*/MANIFEST.json)
|
||||
diff="$(git diff -- tests/*/MANIFEST.json)"
|
||||
echo "$diff"
|
||||
[[ ! $diff ]]
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Retries a given command until it passes
|
||||
# Run as `retry.sh N command args...`
|
||||
# where `N` is the maximum number of tries, and `command args...` is the
|
||||
# command to run, with arguments
|
||||
|
||||
n=$1
|
||||
shift; # this removes the first argument from $@
|
||||
for i in `seq $n`; do
|
||||
echo "====== RUN NUMBER: $i ======";
|
||||
if $@ # run command, check if exit code is zero
|
||||
then
|
||||
exit 0 # command passed, all is well
|
||||
fi
|
||||
done
|
||||
exit 1
|
|
@ -1,10 +1,12 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Helper script to upload docs to doc.servo.org.
|
||||
# Requires ghp-import (from pip)
|
||||
# GitHub API token must be passed in environment var TOKEN
|
||||
|
||||
set -e
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
cd "$(dirname $0)/../.."
|
||||
|
||||
|
@ -15,4 +17,4 @@ cp etc/doc.servo.org/* target/doc/
|
|||
python components/style/properties/build.py servo html
|
||||
|
||||
ghp-import -n target/doc
|
||||
git push -qf https://${TOKEN}@github.com/servo/doc.servo.org.git gh-pages
|
||||
git push -qf "https://${TOKEN}@github.com/servo/doc.servo.org.git" gh-pages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue