.gitlab-ci.yml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. stages:
  2. - build
  3. - test
  4. variables:
  5. IDF_REPO: https://gitlab-ci-token:${CI_JOB_TOKEN}@${IDF_MIRROR_HOST}/espressif/esp-idf.git
  6. STM32_CUBE_F4_REPO: https://github.com/STMicroelectronics/STM32CubeF4
  7. SERIAL_FLASHER_REPO: ${GITLAB_SSH_SERVER}/espressif/esp-serial-flasher.git
  8. QEMU_PATH: /opt/qemu/bin/qemu-system-xtensa
  9. .clone_and_setup_idf: &clone_and_setup_idf |
  10. git clone "${IDF_REPO}"
  11. cd esp-idf
  12. tools/idf_tools.py --non-interactive install all && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
  13. git submodule update --init
  14. export IDF_PATH=$(pwd)
  15. .clone_and_setup_stm32: &clone_and_setup_stm32 |
  16. cd $CI_PROJECT_DIR
  17. git submodule update --init
  18. git clone "${STM32_CUBE_F4_REPO}"
  19. mkdir $CI_PROJECT_DIR/examples/stm32_example/build
  20. wget -O gcc-arm-none-eabi.tar.bz2 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2?revision=05382cca-1721-44e1-ae19-1e7c3dc96118&la=en&hash=D7C9D18FCA2DD9F894FD9F3C3DC9228498FA281A'
  21. tar -xjf gcc-arm-none-eabi.tar.bz2
  22. mv gcc-arm-none-eabi-* gcc-arm-none-eabi
  23. before_script:
  24. # Use CI Tools
  25. - curl -sSL ${CIT_LOADER_URL} | sh
  26. - source citools/import_functions
  27. - PATH=$CI_PROJECT_DIR/esp-idf/tools:$PATH
  28. build_with_idf:
  29. stage: build
  30. image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
  31. tags:
  32. - build
  33. - internet
  34. script:
  35. - *clone_and_setup_idf
  36. - cd $CI_PROJECT_DIR/examples/esp32_example
  37. # Build for all supported targets
  38. - idf.py build -DTARGET_SOC=ESP32 -DMD5_ENABLED=1
  39. - idf.py build -DTARGET_SOC=ESP8266 -DMD5_ENABLED=0
  40. - idf.py build -DTARGET_SOC=ESP32_S2 -DMD5_ENABLED=1
  41. - *clone_and_setup_stm32
  42. - cd $CI_PROJECT_DIR/examples/stm32_example/build
  43. - cmake -DTOOLCHAIN_PREFIX=$CI_PROJECT_DIR/gcc-arm-none-eabi -DSTM32Cube_DIR=$CI_PROJECT_DIR/STM32CubeF4 .. && cmake --build .
  44. run_tests:
  45. stage: test
  46. image: ${CI_DOCKER_REGISTRY}/qemu:esp-develop-20191124
  47. tags:
  48. - build
  49. - internet
  50. script:
  51. - cd $CI_PROJECT_DIR/test
  52. - dd if=/dev/zero bs=1024 count=4096 of="empty_file.bin"
  53. # Run QEMU in backround (deamonized)
  54. - ${QEMU_PATH}
  55. -daemonize
  56. -machine esp32
  57. -drive file=empty_file.bin,if=mtd,format=raw
  58. -global driver=esp32.gpio,property=strap_mode,value=0x0f
  59. -serial tcp::5555,server,nowait
  60. - cd $CI_PROJECT_DIR/test && mkdir build && cd build
  61. # Compile and run qemu tests
  62. - cmake .. -DQEMU_TEST=True && make && ./serial_flasher_test
  63. # Compile and run host tests
  64. - cmake .. -DQEMU_TEST=False && make && ./serial_flasher_test