-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from AdaCore/appveyor
Appveyor continous builder setup
- Loading branch information
Showing
10 changed files
with
298 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Appveyor continuous builder configuration | ||
|
||
# Version format, we don't have version number for ADL yet | ||
version: 0.0.{build} | ||
|
||
# Setup python for build and test-suite scripts | ||
environment: | ||
PYTHON: C:\\Python27 | ||
|
||
# Cache directories will be preseved from one build to the other | ||
cache: | ||
- C:\ADL_tools\ | ||
|
||
install: | ||
|
||
# Get the submodules | ||
- cmd: git submodule init | ||
- cmd: git submodule update --recursive | ||
|
||
|
||
# Define environment variables | ||
- ps: $env:TOOLS_DIR = "C:\ADL_tools\" | ||
- ps: $env:GNAT_ARM_ELF_INSTALLER = $env:TOOLS_DIR + "gnat-gpl-2016-arm-elf-windows-bin.exe" | ||
|
||
# Show current dir and its content | ||
- cmd: cd | ||
- cmd: dir | ||
|
||
# Create the tool dir if it doesn't exists | ||
- ps: md -f $env:TOOLS_DIR | ||
|
||
# Show content of tool dir | ||
- ps: dir $env:TOOLS_DIR | ||
|
||
# Download compiler installer if not already in the tool dir | ||
- ps: If (Test-Path $env:GNAT_ARM_ELF_INSTALLER){echo compiler already in cache}Else{(new-object net.webclient).DownloadFile('http://mirrors.cdn.adacore.com/art/5742ee65a3f5d77ed752e1ad', $env:GNAT_ARM_ELF_INSTALLER)} | ||
|
||
# Show content of tool dir again so we can see if the download was ok | ||
- ps: dir $env:TOOLS_DIR | ||
|
||
# Install the compiler | ||
- cmd: cmd /c start /wait %GNAT_ARM_ELF_INSTALLER% /S /D=%TOOLS_DIR% | ||
|
||
# Show content of tool dir again so we can see if install was ok | ||
- ps: dir $env:TOOLS_DIR | ||
|
||
# Add compiler to the PATH | ||
- ps: $env:Path += ";" + $env:TOOLS_DIR +"bin" | ||
|
||
# Check that we can run the compiler (also display the version) | ||
- ps: arm-eabi-gnatls -v | ||
|
||
# Install optional dependencies | ||
- cmd: python scripts/install_optional_deps.py | ||
|
||
# We don't need a build step | ||
build: off | ||
|
||
# Run the test script(s) | ||
test_script: | ||
- cmd: python scripts/build_all_examples.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
#! /usr/bin/env python2 | ||
|
||
import argparse | ||
import os | ||
import os.path | ||
import subprocess | ||
import sys | ||
|
||
|
||
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
|
||
def run_program(*argv): | ||
print "$ %s" % " ".join(argv) | ||
p = subprocess.Popen( | ||
argv, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE | ||
) | ||
stdout, stderr = p.communicate() | ||
|
||
try: | ||
stdout = stdout.decode('ascii') | ||
except UnicodeError: | ||
return 'stdout is not ASCII' | ||
|
||
try: | ||
stderr = stderr.decode('ascii') | ||
except UnicodeError: | ||
return 'stderr is not ASCII' | ||
|
||
return (p.returncode, stdout, stderr) | ||
|
||
|
||
def gprbuild(project_file, debug=False, rts_profile=None): | ||
extra_args = [] | ||
|
||
if rts_profile: | ||
extra_args = extra_args + ["-XRTS=" + rts_profile] | ||
|
||
extra_args = extra_args + ["-XPLATFORM_BUILD=" + ("Debug" if debug else "Production")] | ||
|
||
print "Building '%s'" % project_file | ||
|
||
# Build the project | ||
returncode, stdout, stderr = run_program( | ||
'gprbuild', '-j0', '-p', '-q', '-P', project_file, *extra_args | ||
) | ||
|
||
print stdout | ||
|
||
if returncode: | ||
print 'Build error (gprbuild returned {}):\n{}'.format( | ||
returncode, stderr | ||
) | ||
|
||
# Clean to avoid error in the next build with a different run-time or | ||
# compile switches. | ||
run_program ('gprclean', "-P", project_file, *extra_args) | ||
|
||
return returncode | ||
|
||
|
||
# Run-time profiles | ||
RAVENSCAR_FULL = ["ravenscar-full"] | ||
RAVENSCAR_SFP = ["ravenscar-sfp"] | ||
BOTH_RAVENSCAR = RAVENSCAR_FULL + RAVENSCAR_SFP | ||
|
||
# There's no ZFP value in the RTS variable so far so we'll use an empty string | ||
# for now. | ||
ZFP = [""] | ||
|
||
STM_DRIVERS="/arch/ARM/STM32/driver_demos/" | ||
|
||
# List of project to compile | ||
# | ||
# Project file List of run-time profiles | ||
projects = [("/examples/accelerometer/accelerometer.gpr", BOTH_RAVENSCAR), | ||
("/examples/draw/draw_stm32f429disco.gpr", BOTH_RAVENSCAR), | ||
("/examples/draw/draw_stm32f469disco.gpr", BOTH_RAVENSCAR), | ||
("/examples/draw/draw_stm32f746disco.gpr", BOTH_RAVENSCAR), | ||
("/examples/draw/draw_stm32f769disco.gpr", BOTH_RAVENSCAR), | ||
("/examples/stm32_dma2d/dma2d_stm32f469disco.gpr", BOTH_RAVENSCAR), | ||
("/examples/stm32_dma2d/dma2d_stm32f429disco.gpr", BOTH_RAVENSCAR), | ||
("/examples/stm32_dma2d/dma2d_stm32f746disco.gpr", BOTH_RAVENSCAR), | ||
("/examples/stm32_dma2d/dma2d_stm32f769disco.gpr", BOTH_RAVENSCAR), | ||
("/examples/OpenMV2/openmv2_example.gpr", BOTH_RAVENSCAR), | ||
("/examples/OpenMV2/openmv2_example.gpr", BOTH_RAVENSCAR), | ||
("/examples/OpenMV2/openmv2_example.gpr", BOTH_RAVENSCAR), | ||
("/examples/MicroBit/microbit_example.gpr", ZFP), | ||
(STM_DRIVERS + "/demo_adc_dma/demo_adc_dma.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_adc_interrupts/demo_adc_interrupts.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_adc_polling/demo_adc_polling.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_adc_timer_dma/demo_adc_timer_dma.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_adc_timer_triggered/demo_adc_timer_triggered.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_crc/demo_crc.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_dac_basic/demo_dac_basic.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_dac_dma/demo_dac_dma.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_dma_mem_to_mem/demo_dma_mem_to_mem.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_dma_mem_to_peripheral/demo_usart_dma_continuous.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_independent_watchdog/demo_iwdg.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_L3GD20_dataready_int/demo_l3gd20_dataready_int.gpr", RAVENSCAR_FULL), | ||
(STM_DRIVERS + "/demo_L3GD20_fifo_int/demo_l3gd20_fifo_int.gpr", RAVENSCAR_FULL), | ||
(STM_DRIVERS + "/demo_L3GD20_polling/demo_l3gd20.gpr", RAVENSCAR_FULL), | ||
(STM_DRIVERS + "/demo_LIS3DSH_pwm/demo_lis3dsh_pwm.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_LIS3DSH_tilt/demo_lis3dsh_tilt.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_rng/demo_rng.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_timer_interrupts_basic/demo_basic_timer_interrupts.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_timer_interrupts_multichannel/demo_timer_interrupts_multichannel.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_timer_pwm/demo_timer_pwm.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_timer_quad_encoder/demo_timer_quad_encoder.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_usart_interrupts/demo_usart_interrupts.gpr", BOTH_RAVENSCAR), | ||
(STM_DRIVERS + "/demo_usart_polling/demo_usart_polling.gpr", BOTH_RAVENSCAR), | ||
] | ||
|
||
parser = argparse.ArgumentParser('Compile all the Ada_Drivers_Library examples') | ||
|
||
parser.add_argument( | ||
'pattern', nargs='*', | ||
help='List of patterns to filter the set of examples to build' | ||
) | ||
|
||
def main(args): | ||
# Check if we can actually detect a build failure | ||
ret = gprbuild ("This_Project_Doesnt_Exist", debug=False) | ||
if not ret: | ||
print "Build failure is not detected" | ||
sys.exit(1) | ||
|
||
ret = 0 | ||
for prj, rts_list in projects: | ||
|
||
# Check filter pattern, if any | ||
if args.pattern and not any(pat in prj for pat in args.pattern): | ||
continue | ||
|
||
for rts in rts_list: | ||
ret = ret or gprbuild (ROOT_DIR + prj, debug=True, rts_profile=rts) | ||
ret = ret or gprbuild (ROOT_DIR + prj, debug=False, rts_profile=rts) | ||
|
||
if ret: | ||
sys.exit(1) | ||
|
||
if __name__ == '__main__': | ||
main(parser.parse_args()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#! /usr/bin/env python2 | ||
|
||
import argparse | ||
import os | ||
import os.path | ||
import subprocess | ||
import sys | ||
|
||
|
||
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
|
||
def run_program(*argv): | ||
print "$ %s" % " ".join(argv) | ||
p = subprocess.Popen( | ||
argv, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE | ||
) | ||
stdout, stderr = p.communicate() | ||
|
||
try: | ||
stdout = stdout.decode('ascii') | ||
except UnicodeError: | ||
return 'stdout is not ASCII' | ||
|
||
try: | ||
stderr = stderr.decode('ascii') | ||
except UnicodeError: | ||
return 'stderr is not ASCII' | ||
|
||
return (p.returncode, stdout, stderr) | ||
|
||
|
||
def git_clone(repo_url, dst, recursive=False): | ||
extra_args = [] | ||
|
||
if recursive: | ||
extra_args = extra_args + ["--recursive"] | ||
|
||
# Build test drivers | ||
returncode, stdout, stderr = run_program( | ||
'git', 'clone', repo_url, ROOT_DIR + dst, *extra_args | ||
) | ||
print stdout | ||
|
||
if returncode: | ||
print 'git clone error (returned {}):\n{}'.format( | ||
returncode, stderr | ||
) | ||
|
||
return returncode | ||
|
||
# Git repositories | ||
# Git repository Destination directory Recursive clone? | ||
git_repos = [("https://github.com/nocko/zfp-nrf51", "/examples/MicroBit/zfp-nrf51", False), | ||
("https://github.com/Fabien-Chouteau/zfp-hifive1.git", "/examples/HiFive1/zfp-hifive1", False) | ||
] | ||
|
||
parser = argparse.ArgumentParser('Download and install optional dependencies') | ||
|
||
parser.add_argument( | ||
'pattern', nargs='*', | ||
help='List of pattern to filter the set of dependencies to install' | ||
) | ||
|
||
def main(args): | ||
at_least_one_error = False | ||
|
||
ret = 0 | ||
for repo, dest, recursive in git_repos: | ||
if args.pattern and not any(pat in repo for pat in args.pattern): | ||
continue | ||
|
||
ret = git_clone (repo, dest, recursive) | ||
|
||
if ret: | ||
at_least_one_error = True | ||
|
||
if at_least_one_error: | ||
sys.exit(1) | ||
|
||
if __name__ == '__main__': | ||
main(parser.parse_args()) |