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

Use orb and add daily workflow #5

Merged
merged 2 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
211 changes: 18 additions & 193 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,201 +1,26 @@
version: 2.1

orbs:
win: circleci/[email protected]

jobs:
#
# linux
#

test-py38: &full-test-template
docker:
- image: circleci/python:3.8-buster

working_directory: ~/repo/

steps:
- checkout

- restore_cache:
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
- run: python -m virtualenv env
- run: &install-dependences-template
name: install requirements
command: |
env/bin/pip install -r ./requirements.txt
env/bin/pip install coverage
- save_cache:
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
paths:
- env

- run: env/bin/coverage run -m unittest discover

test-py37:
<<: *full-test-template
docker:
- image: circleci/python:3.7-stretch

test-py36:
<<: *full-test-template
docker:
- image: circleci/python:3.6-jessie

test-py35:
<<: *full-test-template
docker:
- image: circleci/python:3.5-jessie

#
# macOS
#

test-osx-py38: &osx-tests-template
macos:
xcode: "11.2.1"
environment:
PYTHON: 3.8.0
HOMEBREW_NO_AUTO_UPDATE: 1

working_directory: ~/repo

steps:
- checkout

- run: brew install pyenv

# Install desired python version
- restore_cache:
keys:
- pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-11.2.1
- run: pyenv install $PYTHON -s
- save_cache:
key: pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-11.2.1
paths:
- ~/.pyenv

# Set local python version
- run:
name: create virtualenv
command: |
eval "$(pyenv init -)"
pyenv local $PYTHON
python -m pip install virtualenv
python -m virtualenv env
# Restore cache
- restore_cache:
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
- run: *install-dependences-template
- save_cache:
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
paths:
- env

- run: env/bin/coverage run -m unittest discover


test-osx-py37:
<<: *osx-tests-template
environment:
PYTHON: 3.7.0
HOMEBREW_NO_AUTO_UPDATE: 1

test-osx-py36:
<<: *osx-tests-template
environment:
PYTHON: 3.6.5
HOMEBREW_NO_AUTO_UPDATE: 1

test-osx-py35:
<<: *osx-tests-template
environment:
PYTHON: 3.5.5
HOMEBREW_NO_AUTO_UPDATE: 1

#
# Windows x64
#

test-win-py38: &win-tests-template
executor:
name: win/default

environment:
PYTHON: 3.8.0

working_directory: ~/repo

steps:
- checkout

# Install python
- restore_cache:
key: nuget-{{ .Environment.CIRCLE_JOB }}
- run:
name: install python
command: nuget install python -Version $env:PYTHON -ExcludeVersion -OutputDirectory .
- save_cache:
key: nuget-{{ .Environment.CIRCLE_JOB }}
paths:
- .\python

# Set up virtual environment
- run:
name: create virtualenv
command: |
.\python\tools\python.exe --version
.\python\tools\python.exe -m pip install virtualenv
.\python\tools\python.exe -m virtualenv env
# Install requirements
- restore_cache:
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
- run: &win-install-dependencies-template
name: install dependencies
command: |
env\Scripts\activate.ps1
python --version
pip install -r requirements.txt
pip install coverage
- save_cache:
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
paths:
- env

# Run tests
- run: &win-run-unittests-template
name: run unittests
command: |
env\Scripts\activate.ps1
coverage run -m unittest discover
test-win-py37:
<<: *win-tests-template
environment:
PYTHON: 3.7.5

test-win-py36:
<<: *win-tests-template
environment:
PYTHON: 3.6.8

test-win-py35:
<<: *win-tests-template
environment:
PYTHON: 3.5.4
dwave: dwave/orb-examples@2

workflows:
version: 2.1
tests:
jobs:
- test-py38
- test-py37
- test-py36
- test-py35
- test-osx-py38
- test-osx-py37
- test-osx-py36
- test-osx-py35
- test-win-py38
- test-win-py37
- test-win-py36
- test-win-py35
- dwave/test-linux
- dwave/test-osx
- dwave/test-win

daily:
triggers:
- schedule:
cron: "0 12 * * *"
filters:
branches:
only:
- master
- main
jobs:
- dwave/test-linux
- dwave/test-osx
- dwave/test-win
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![Linux/Mac/Windows build status](
https://circleci.com/gh/dwave-examples/ev-charger-placement.svg?style=svg)](
https://circleci.com/gh/dwave-examples/ev-charger-placement)

# Placement of Charging Stations

Determining optimal locations to build new electric vehicle charging stations
Expand Down