Skip to content
Open
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
47 changes: 37 additions & 10 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,44 @@
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

# Kick off build just on master branch.
trigger:
- master

pool:
vmImage: 'ubuntu-latest'
variables:
CONDA_ENV_NAME: test_env

steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'

- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'
jobs:
# Linux build.
- job: Linux
displayName: 'Run workshops build on Linux'
pool:
vmImage: 'ubuntu-16.04'
steps:
# 1) Add conda to path.
- bash: echo "##vso[task.prependpath]$CONDA/bin"
# 2) Create conda environment based on checked in yaml file.
# 3) Activate created environment.
# 4) Build using make.
- script: |
conda env create --quiet --file workshops/environment.yml --name $(CONDA_ENV_NAME)
source activate $(CONDA_ENV_NAME)
make --directory workshops
# Windows build.
- job: Windows
displayName: 'Run workshops build on Windows'
pool:
vmImage: 'vs2017-win2016'
steps:
# 1) Add conda to path.
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
# 2) Create conda environment based on checked in yaml file.
# 3) Activate created environment.
# 4) Figure out msbuild location using vswhere unitility (install it using chocolatey).
# 5) Build using msbuild.
- script: |
conda env create --quiet --file workshops/environment.yml --name $(CONDA_ENV_NAME)
call activate $(CONDA_ENV_NAME)
choco install vswhere
for /f "tokens=*" %%i in ('vswhere -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe -nologo') do set msbuildpath="%%i"
call %msbuildpath% workshops\workshops.sln /p:Platform="Any CPU";Configuration=Debug
2 changes: 1 addition & 1 deletion workshops/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKSHOPS := nn_backprop conv_nets
all:
# Loop over all workshops and build them.
$(foreach WORKSHOP, $(WORKSHOPS), \
@echo --------- BUILDING WORKSHOP $(WORKSHOP) -------------- ; \
echo --------- BUILDING WORKSHOP $(WORKSHOP) -------------- ; \
make --directory=$(WORKSHOP) WORKSHOP=$(WORKSHOP) all; \
if [ $$? -eq 0 ]; then \
echo --------- BUILDING WORKSHOP $(WORKSHOP) SUCCESS ------; \
Expand Down
2 changes: 1 addition & 1 deletion workshops/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup Label="UserMacros">
<BuildDir>$(SolutionDir)\build</BuildDir>
<BuildScriptsDir>$(SolutionDir)\build_scripts</BuildScriptsDir>
<PythonPath>C:\ProgramData\Anaconda3\</PythonPath>
<PythonPath></PythonPath>
</PropertyGroup>
<Import Project="$(SolutionDir)\common.user.props" Condition="Exists('$(SolutionDir)\common.user.props')"/>
</Project>
23 changes: 19 additions & 4 deletions workshops/common.targets
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build">
<Target Name="CheckPython">
<!-- Check if we have Python in path. -->
<Exec Command="python.exe --version" ConsoleToMsBuild="true" StandardOutputImportance="low" IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="ExecExitCode" />
</Exec>
<!-- Check that Python is somehow provided (either in path or using PythonPath property). -->
<Error
Text="Python.exe not found. Please set PythonPath property to parent dir of python.exe (including trailing \)."
Condition="!Exists('$(PythonPath)python.exe')"/>
Text="Python.exe not found. Please set PythonPath property to parent dir of python.exe (including trailing \) or install and add Python to path."
Condition="'$(ExecExitCode)'=='9009' And '$(PythonPath)'==''"/>
<!-- Save full path to python.exe to use in the rest of processing. -->
<PropertyGroup Condition="'$(ExecExitCode)'!='9009'">
<FullPythonExePath>python.exe</FullPythonExePath>
</PropertyGroup>
<PropertyGroup Condition="'$(ExecExitCode)'=='9009'">
<FullPythonExePath>$(PythonPath)python.exe</FullPythonExePath>
</PropertyGroup>
</Target>

<Target Name="Build" DependsOnTargets="CheckPython">
<ItemGroup>
<PyNotebookFile Include="@(Compile)" Condition="'%(Compile.Pynb)'=='true'"/>
</ItemGroup>
Expand All @@ -16,7 +31,7 @@
Text="No files found with Pynb attribute. Please read the readme for workshop creation to find info on how to fix this." />
<MakeDir Directories="$(BuildDir)" />
<MakeDir Directories="$(BuildDir)\$(ProjectName)" />
<Exec Command='"$(PythonPath)python.exe" "$(BuildScriptsDir)\jupyterize.py" -in "$(ProjectDir)\@(PyNotebookFile)" -out "$(BuildDir)\$(ProjectName)\@(PyNotebookFile).ipynb"' />
<Exec Command='"$(FullPythonExePath)" "$(BuildScriptsDir)\jupyterize.py" -in "$(ProjectDir)\@(PyNotebookFile)" -out "$(BuildDir)\$(ProjectName)\@(PyNotebookFile).ipynb"' />
<Copy SourceFiles="@(PythonFile)" DestinationFiles="@(PythonFile->'$(BuildDir)\$(ProjectName)\%(Identity)')" />
</Target>
</Project>