From 156ee4f3088c9ac082a7f8715483ea8b981f9610 Mon Sep 17 00:00:00 2001 From: Andreas Gnau Date: Sun, 4 Nov 2018 18:45:15 +0100 Subject: [PATCH] CI: Build on CircleCI with XC16 1.35 and MPLABX 5 --- .circleci/config.yml | 163 ++++++++++++++++++++++++++++++++++++++++++ .circleci/mplabx.envs | 2 + .circleci/xc16.envs | 2 + 3 files changed, 167 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 .circleci/mplabx.envs create mode 100644 .circleci/xc16.envs diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..f6cc98e4 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,163 @@ +version: 2 + +shared: &shared + docker: + - image: debian:stretch + environment: &shared_environment + CLICOLOR_FORCE: 1 + mplabx_dir: /opt/mplabx + + steps: + - run: + name: Install dependencies + command: | + dpkg --add-architecture i386 + apt-get update + apt-get install -y --no-install-recommends \ + wget \ + git \ + ca-certificates \ + libc6:i386 \ + make \ + procps \ + + - checkout + + - restore_cache: + name: Restore XC16 installation from cache + keys: + - xc16-{{ checksum ".circleci/xc16.envs" }} + - run: + name: Install XC16 + command: | + source ./.circleci/xc16.envs + url="https://ww1.microchip.com/downloads/en/DeviceDoc/xc16-v${xc16_version}-full-install-linux-installer.run" + xc16_inst='/tmp/xc16' + xc16_install_marker="/opt/microchip/xc16/hash-$xc16_inst_sha256" + if [ -f "$xc16_install_marker" ]; then + echo 'XC16 in cache' + exit 0 + fi + + wget -O "$xc16_inst" "$url" + chmod +x "$xc16_inst" + sha256sum -c <(echo "${xc16_inst_sha256} *${xc16_inst}") + "$xc16_inst" --version + "$xc16_inst" \ + --mode unattended \ + --unattendedmodeui none \ + --netservername localhost \ + --LicenseType FreeMode \ + + rm -fv "$xc16_inst" + touch "$xc16_install_marker" + - save_cache: + name: Save XC16 installation to cache + key: xc16-{{ checksum ".circleci/xc16.envs" }} + paths: + - /opt/microchip + + - restore_cache: + name: Restore MBLAB X installation from cache + keys: + - mplabx-{{ checksum ".circleci/mplabx.envs" }} + - run: + name: Install MPLAB X + command: | + source ./.circleci/mplabx.envs + mplabx_url="https://ww1.microchip.com/downloads/en/DeviceDoc/MPLABX-v${mplabx_version}-linux-installer.tar" + mplabx_tar='mplabx.tar' + mplabx_inst="./MPLABX-v${mplabx_version}-linux-installer.sh" + mplabx_install_marker="$mplabx_dir/hash-$mplabx_tar_sha256" + if [ -f "$mplabx_install_marker" ]; then + echo 'MPLABX in cache' + exit 0 + fi + + wget -O "$mplabx_tar" "$mplabx_url" + sha256sum -c <(echo "${mplabx_tar_sha256} *${mplabx_tar}") + tar xf "$mplabx_tar" + USER=root "$mplabx_inst" --nolibrarycheck -- --version + USER=root "$mplabx_inst" --nolibrarycheck --nox11 -- \ + --unattendedmodeui none \ + --mode unattended \ + --ipe 0 \ + --installdir "$mplabx_dir" \ + + rm -fv "$mplabx_tar" "$mplabx_inst" + touch "$mplabx_install_marker" + - save_cache: + name: Save MPLAB X installation to cache + key: mplabx-{{ checksum ".circleci/mplabx.envs" }} + paths: + - /opt/mplabx + + - run: + name: Configure + command: | + $mplabx_dir/mplab_platform/bin/prjMakefilesGenerator.sh -v "$project_dir" + + + - run: + name: Build + command: | + make -C "$project_dir" CONF="$build_config" build + + - run: + name: Prepare artifacts + command: | + # part of this is a workaround for CircleCI not supporting string interpolation or symlinks in store_artifacts + artifacts_dir="${project_dir}/dist/${build_config}/production" + git_describe="$(git describe --tags --always --long)" + mkdir ./artifacts/ + for file in $artifacts_dir/*; do + filename=$(basename -- "$file") + extension="${filename##*.}" + filename="${filename%.*}" + cp -av "$file" "./artifacts/${CIRCLE_JOB}-${filename}-${git_describe}-${CIRCLE_BUILD_NUM}.${extension}" + done + + - store_artifacts: + path: ./artifacts/ + destination: artifacts + + + +jobs: + firmware-bp-v4: + <<: *shared + environment: + <<: *shared_environment + build_config: BusPirate_v4 + project_dir: ./Firmware/busPirate.X + + firmware-bp-v3: + <<: *shared + environment: + <<: *shared_environment + build_config: BusPirate_v3 + project_dir: ./Firmware/busPirate.X + + boot-bp-v4: + <<: *shared + environment: + <<: *shared_environment + build_config: default + project_dir: ./Bootloaders/BPv4-bootloader/firmware-v1/bpv4-bootloader.X + + boot-bp-v3: + <<: *shared + environment: + <<: *shared_environment + build_config: default + project_dir: ./Bootloaders/BPv3-bootloader/firmware-v4.5/ds30loader.X + +workflows: + version: 2 + build: + jobs: + - firmware-bp-v4 + - firmware-bp-v3 + - boot-bp-v4 + - boot-bp-v3 + diff --git a/.circleci/mplabx.envs b/.circleci/mplabx.envs new file mode 100644 index 00000000..addbb38f --- /dev/null +++ b/.circleci/mplabx.envs @@ -0,0 +1,2 @@ +mplabx_version='5.00' +mplabx_tar_sha256='645ecd31dd9edbe7545300f6e3ee10f9329a078d19c1ebac4d3c34d32dd38ce7' diff --git a/.circleci/xc16.envs b/.circleci/xc16.envs new file mode 100644 index 00000000..797e2333 --- /dev/null +++ b/.circleci/xc16.envs @@ -0,0 +1,2 @@ +xc16_version='1.35' +xc16_inst_sha256='c681d2c132edcd8659487e08b531add76cd154329da5457f77527a60b6c24aed'