Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/circleci #719

Merged
merged 32 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
13040db
add simple windows test
haiyangdeperci Mar 10, 2021
0e2a8c2
fix circleci windows conf
haiyangdeperci Mar 10, 2021
54b7a63
add flake
haiyangdeperci Mar 10, 2021
4ddb2f8
add pytest
haiyangdeperci Mar 11, 2021
217358b
upgrade pip & fix coverage module
haiyangdeperci Mar 11, 2021
682ba64
fix google credentials and pip
haiyangdeperci Mar 12, 2021
1dbf634
fix gac and ci env vars
haiyangdeperci Mar 12, 2021
ddcf978
fix path and encoding issues
haiyangdeperci Mar 12, 2021
c7c8936
refactor code
haiyangdeperci Mar 15, 2021
4a65bce
fix google credentials
haiyangdeperci Mar 15, 2021
d131d5c
pass parameters to commands
haiyangdeperci Mar 15, 2021
0fb166f
add test params
haiyangdeperci Mar 15, 2021
7f2fb2e
fix parameters
haiyangdeperci Mar 15, 2021
be5a54a
fix parameters
haiyangdeperci Mar 15, 2021
476b8c3
fix paths for unix
haiyangdeperci Mar 15, 2021
f28dab5
add specific shell requirements for code cov on win
haiyangdeperci Mar 15, 2021
06d14a4
specify aliases
haiyangdeperci Mar 15, 2021
f83395d
fix a typo
haiyangdeperci Mar 15, 2021
25baf43
fix aliases
haiyangdeperci Mar 15, 2021
3f6bc1e
remove unnecessary params
haiyangdeperci Mar 15, 2021
19a0626
change aliases
haiyangdeperci Mar 15, 2021
0ff4533
install python 3.7 as ray does not work on higher versions
haiyangdeperci Mar 15, 2021
dd07313
Add a conda set-up file
haiyangdeperci Mar 26, 2021
1a0fdca
Add conda builds
haiyangdeperci Mar 26, 2021
9d8bfee
fix naming and context
haiyangdeperci Mar 26, 2021
fff1804
change env and build
haiyangdeperci Mar 26, 2021
984dc87
change path
haiyangdeperci Mar 26, 2021
47a2c6b
place path in bash_env
haiyangdeperci Mar 26, 2021
b1114c3
fix build path and version parsing
haiyangdeperci Mar 26, 2021
f29b029
humbug-free version test
haiyangdeperci Mar 26, 2021
a508eb7
put conda in the deploy workflow and add slack
haiyangdeperci Mar 26, 2021
a82d447
Merge branch 'master' into fix/circleci
haiyangdeperci Mar 30, 2021
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
295 changes: 229 additions & 66 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,46 @@ version: 2.1

orbs:
slack: circleci/slack@3.4.2
codecov: codecov/codecov@1.1.1
codecov: codecov/codecov@1.1.3
win: circleci/windows@2.4.0

workflows:
test:
jobs:
- test:
name: "Linux Simple Test"
e: linux
context:
- test
- azure
- test_full:
- test:
name: "Linux Complex Test"
e: linux
optional: true
context:
- test
- azure

test_and_deploy:
- test:
name: "Windows Complex Test"
e: win64
unix-like: false
optional: true
context:
- test
- azure
- test:
name: "Mac Complex Test"
e: mac
mac-like: true
optional: true
context:
- test
- azure
test-and-deploy:
jobs:
- test:
name: test-simple
e: linux
context:
- test
- azure
Expand All @@ -27,7 +50,10 @@ workflows:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
- test_full:
- test:
name: test-complex
e: linux
optional: true
context:
- test
- azure
Expand All @@ -36,91 +62,222 @@ workflows:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
- verify:
type: approval
requires:
- test-simple
- test-complex
- deploy:
context:
- pypi
- snark-docker
requires:
- test
- test_full
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
- verify
- conda:
context:
- conda
requires:
- deploy

jobs:
test:
docker:
executors:
linux:
docker:
- image: circleci/python:3.8
steps:
- checkout
- run:
name: "Prep Google credentials"
command: |
mkdir -p "/home/circleci/.secrets/"
echo "$GOOGLE_APPLICATION_CREDENTIALS" | base64 --decode > "/home/circleci/.secrets/gcs.json"
win64: win/default
mac:
macos:
xcode: "12.4.0"

commands:
aliases:
steps:
- run:
name: "Collecting requirements"
name: "Setting aliases for Windows"
command: |
pip install -r requirements-dev.txt
pip install -r requirements.txt
pip install -e .
Add-Content -Path $profile -Value {Set-Alias -Name python3 -Value python}
Add-Content -Path $profile -Value {Set-Alias -Name pip3 -Value pip}
get-python:
steps:
- run:
name: "Checking code style"
name: "Install Python"
command: |
pip install flake8
flake8 . --count --exit-zero --max-complexity=10 --statistics
brew install python@3.7
brew link --overwrite python@3.7
info:
steps:
- run:
name: "Running tests"
command: |
export GOOGLE_APPLICATION_CREDENTIALS=/home/circleci/.secrets/gcs.json
pytest --cov-report=xml --cov=./
- slack/status:
fail_only: true
webhook: $SLACK_WEBHOOK
name: "Gather machine info"
command: python3 -c "import platform as p; print('{}\nPython {}'.format(p.platform(), p.sys.version))"


test_full:
docker:
- image: circleci/python:3.8
google-creds:
parameters:
unix-like:
type: boolean
default: true
steps:
- unless:
condition: << parameters.unix-like >>
steps:
- run:
name: "Prepare Google credentials - Windows"
command: |
$Env:CI_SECRETS_PATH = $Env:USERPROFILE + "\.secrets"
$Env:CI_GCS_PATH = $Env:CI_SECRETS_PATH + "\gcs.json"
setx /m CI_GCS_PATH "$Env:CI_GCS_PATH"
mkdir $Env:CI_SECRETS_PATH
[Text.Encoding]::ASCII.GetString([Convert]::FromBase64String($Env:GOOGLE_APPLICATION_CREDENTIALS)) | Out-File -FilePath $Env:CI_GCS_PATH -Encoding ASCII
- when:
condition: << parameters.unix-like >>
steps:
- run:
name: "Prepare Google credentials - Unix"
command: |
mkdir -p "$HOME/.secrets/"
echo "$GOOGLE_APPLICATION_CREDENTIALS" | base64 --decode > "$HOME/.secrets/gcs.json"
requirements:
parameters:
optional:
description: "Include optional requirements"
type: boolean
default: false
steps:
- checkout
- run:
name: "Prep Google credentials"
command: |
mkdir -p "/home/circleci/.secrets/"
echo "$GOOGLE_APPLICATION_CREDENTIALS" | base64 --decode > "/home/circleci/.secrets/gcs.json"
- run:
name: "Collecting requirements"
command: |
pip install -r requirements-dev.txt
pip install -r requirements-optional.txt
pip install -r requirements.txt
pip install -e .
pip3 install --upgrade pip --user
pip3 install --upgrade setuptools
pip3 install -r requirements-dev.txt
<<# parameters.optional >>pip3 install -r requirements-optional.txt<</ parameters.optional >>
pip3 install -r requirements.txt
pip3 install -e .
style-check:
steps:
- run:
name: "Checking code style"
command: |
pip install flake8
pip3 install flake8
flake8 . --count --exit-zero --max-complexity=10 --statistics
- run:
name: "Running tests"
command: |
export GOOGLE_APPLICATION_CREDENTIALS=/home/circleci/.secrets/gcs.json
pytest --cov-report=xml --cov=./
run-tests:
parameters:
unix-like:
type: boolean
default: true
steps:
- unless:
condition: << parameters.unix-like >>
steps:
- run:
name: "Running tests - Windows"
command: |
$Env:GOOGLE_APPLICATION_CREDENTIALS = $Env:CI_GCS_PATH
setx /m GOOGLE_APPLICATION_CREDENTIALS "$Env:GOOGLE_APPLICATION_CREDENTIALS"
pip3 install pytest
pip3 install pytest-cov
pytest --cov-report=xml --cov=./
- when:
condition: << parameters.unix-like >>
steps:
- run:
name: "Running tests - Unix"
command: |
export GOOGLE_APPLICATION_CREDENTIALS=$HOME/.secrets/gcs.json
pytest --cov-report=xml --cov=./
codecov-upload:
steps:
- codecov/upload:
file: coverage.xml
report:
parameters:
unix-like:
type: boolean
default: true
steps:
- unless:
condition: << parameters.unix-like >>
steps:
- run:
command: codecov-upload
shell: bash.exe
- when:
condition: << parameters.unix-like >>
steps:
- codecov-upload
- store_test_results:
path: test-reports
path: test-reports # possibly change this path for Win
- store_artifacts:
path: test-reports
slack-status:
steps:
- slack/status:
fail_only: true
webhook: $SLACK_WEBHOOK

conda-install:
steps:
- run:
name: "Install Miniconda"
command: |
curl -O https://repo.anaconda.com/miniconda/Miniconda3-py38_4.9.2-Linux-x86_64.sh
echo "1314b90489f154602fd794accfc90446111514a5a72fe1f71ab83e07de9504a7 Miniconda3-py38_4.9.2-Linux-x86_64.sh" | sha256sum -c
bash Miniconda3-py38_4.9.2-Linux-x86_64.sh -b
echo 'export PATH=$HOME/miniconda3/bin:$PATH' >> $BASH_ENV
conda-setup:
steps:
- run:
name: "Install required conda packages and set config"
command: |
conda install conda-build anaconda-client patch -y
conda config --add channels conda-forge
conda config --set anaconda_upload yes
conda-build:
steps:
- run:
name: "Build Hub for conda"
command: |
pip install -e .
export HUB_VERSION=$(awk -F'=' '/^__version__/ { print $2}' $HOME/project/hub/version.py | tr -d ' "')
conda build .
jobs:
test:
parameters:
e:
type: executor
optional:
description: "Include optional requirements and reports"
type: boolean
default: false
unix-like:
type: boolean
default: true
mac-like:
type: boolean
default: false
executor: << parameters.e >>
steps:
- checkout
- unless:
condition: << parameters.unix-like >>
steps:
- aliases
- when:
condition: << parameters.mac-like >>
steps:
- get-python
- info
- google-creds:
unix-like: << parameters.unix-like >>
- requirements:
optional: << parameters.optional >>
- style-check
- run-tests:
unix-like: << parameters.unix-like >>
- when:
condition: << parameters.optional >>
steps:
- report:
unix-like: << parameters.unix-like >>
- slack-status
deploy:
docker:
- image: circleci/python:3.8
executor: linux
environment:
IMAGE_NAME: snarkai/hub
steps:
Expand All @@ -135,12 +292,12 @@ jobs:
- run:
name: "Create a source distribution & wheel"
command: |
python setup.py sdist
python setup.py bdist_wheel
python3 setup.py sdist
python3 setup.py bdist_wheel
- run:
name: "Install twine via pip"
command: |
pip install twine
pip3 install twine
- run:
name: "Upload dist to PyPi"
command: |
Expand All @@ -157,6 +314,12 @@ jobs:
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$IMAGE_TAG
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:$IMAGE_TAG
- slack/status:
fail_only: true
webhook: $SLACK_WEBHOOK
- slack-status
conda:
executor: linux
steps:
- checkout
- conda-install
- conda-setup
- conda-build
- slack-status
Loading