Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
CI build steps (#2)
Browse files Browse the repository at this point in the history
* Updated CI test configuration with errors in build.py

* Use different container for build job. Fix spelling to check build.py

* Circle CI change build job to use 'deploy' instead of 'run'

* Change 'test' -> 'lint' job name.
  • Loading branch information
Clayton Burlison authored Mar 24, 2017
1 parent 649b732 commit 067d95c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 35 deletions.
62 changes: 34 additions & 28 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,37 @@ version: 2
jobs:
build:
working_directory: /tmp/vendored
parallelism: 2
docker:
- image: nathanleclaire/curl:latest
steps:
- deploy:
name: Run lint job
command: |
set -x
# Only run if on the CircleCI cloud instance
if [ "$CIRCLE_BUILD_NUM" ]; then
# Gross method to have Circle trigger the job
# https://circleci.com/docs/2.0/defining-multiple-jobs/#triggering-jobs
curl -u ${CIRCLE_API_TOKEN}: \
-d build_parameters[CIRCLE_JOB]=lint \
-d revision=$CIRCLE_SHA1 \
https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/tree/$CIRCLE_BRANCH
fi
- deploy:
name: Run spell check job
command: |
set -x
# Only run if on the CircleCI cloud instance
if [ "$CIRCLE_BUILD_NUM" ]; then
# Gross method to have Circle trigger the job
# https://circleci.com/docs/2.0/defining-multiple-jobs/#triggering-jobs
curl -u ${CIRCLE_API_TOKEN}: \
-d build_parameters[CIRCLE_JOB]=spell-check \
-d revision=$CIRCLE_SHA1 \
https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/tree/$CIRCLE_BRANCH
fi
lint:
working_directory: /tmp/vendored
docker:
- image: clburlison/pylint:py2-wheezy
steps:
Expand All @@ -17,30 +47,6 @@ jobs:
echo "A python file was modified. Running python linter..."
flake8 --exclude=_src*,_patch*,payload,build .
fi
# This method is ugly and doesn't work well. Waiting for CircleCI to create a better method
# - run:
# name: Run spell check
# command: |
# set -x
# # Only run spell check if on the CircleCI cloud instance
# if [ "$CIRCLE_BUILD_NUM" ]; then
# # Gross method to have Circle trigger the spell-check job
# # https://circleci.com/docs/2.0/defining-multiple-jobs/#triggering-jobs
# curl -u ${CIRCLE_API_TOKEN}: \
# -d build_parameters[CIRCLE_JOB]=spell-check \
# -d revision=$CIRCLE_SHA1 \
# https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/tree/$CIRCLE_BRANCH
# fi
- run:
name: Run spell check
command: |
set -x
#set +e # Add this to override spelling errors failing CI tests.
# Then add an `exit 0` at the end of the run
pylint --disable=all --reports=n --enable=spelling \
--spelling-dict=en_US --ignore-comments=no \
--spelling-private-dict-file=tests/words \
build openssl python tests tlsssl vendir
spell-check:
working_directory: /tmp/vendored
docker:
Expand All @@ -56,8 +62,8 @@ jobs:
pylint --disable=all --reports=n --enable=spelling \
--spelling-dict=en_US --ignore-comments=no \
--spelling-private-dict-file=tests/words \
build openssl python tests tlsssl vendir
add-unknown-words:
build.py build openssl python tests tlsssl vendir
add-words:
working_directory: /tmp/vendored
docker:
- image: clburlison/pylint:py2-wheezy
Expand All @@ -71,4 +77,4 @@ jobs:
--spelling-dict=en_US --ignore-comments=no \
--spelling-store-unknown-words=y \
--spelling-private-dict-file=tests/words \
build openssl python tests tlsssl vendir
build.py build openssl python tests tlsssl vendir
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,27 @@ To run the CI tests locally the following tools must be installed:
curl -o /usr/local/bin/circleci https://circle-downloads.s3.amazonaws.com/releases/build_agent_wrapper/circleci && chmod +x /usr/local/bin/circleci
```

To run the test suite:
To run the lint job:

```bash
circleci build
circleci build --job lint
```

## Updating 'words' dictionary
## Spelling CI
As with all projects some words that are used will not be part of the standard 'en_US' dictionary and are added to a custom file located in `tests/words`.

To check spelling locally:
To run the spell-check job:

```bash
circleci build --job spell-check
```

To add new words to the 'words' file (please run `spell-check` first):
To run the add-words job:

_Note:_ This will add new words to 'tests/words' so please run `spell-check` first

```bash
circleci build --job add-unknown-words
circleci build --job add-words
```

# Credits
Expand Down
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def build_python():


def build_tlsssl():
"""Build the tslssl project."""
"""Build the tlsssl project."""
tslssl_dir = os.path.join(CURRENT_DIR, 'tlsssl')
os.chdir(tslssl_dir)
cmd = ['/usr/bin/python', 'setup.py', '-vv', '-p', '-b']
Expand Down
5 changes: 5 additions & 0 deletions tests/words
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ os
cmd
returncode
vv
usr
py
vendored
openssl
tlsssl

0 comments on commit 067d95c

Please sign in to comment.