From 01e75c14947b9f8767f19ee9389f07499135b3a3 Mon Sep 17 00:00:00 2001 From: Atsushi Watanabe Date: Fri, 25 Dec 2020 16:55:58 +0900 Subject: [PATCH] Migrate to GitHub Actions (#96) --- .github/workflows/ci.yml | 84 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 42 -------------------- 2 files changed, 84 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8c82942 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +name: ci + +on: + pull_request: + branches: + - master + push: + branches: + - master + release: + types: [published] + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + env: + TOOLCHAIN_URI: "https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2?product=GNU%20ARM%20Embedded%20Toolchain,64-bit,,Linux,6-2017-q2-update" + TOOLCHAIN_ARCHIVE: gcc-arm-none-eabi.tar.bz2 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Get tag + if: github.event_name == 'release' + run: echo "TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV} + - name: Set environment variables + run: | + echo "SHORT_HASH=$(git rev-parse --short HEAD)" >> ${GITHUB_ENV} + echo "RELEASE_FILENAME_R4=tf-2md3-r4-${TAG:-latest}.bin" >> ${GITHUB_ENV} + echo "RELEASE_FILENAME_R6=tf-2md3-r6-${TAG:-latest}.bin" >> ${GITHUB_ENV} + echo "TOOLCHAIN_URI_HASH=$(echo ${TOOLCHAIN_URI} | sha512sum -)" >> ${GITHUB_ENV} + + - name: Cache toolchain + uses: actions/cache@v2 + with: + path: ~/toolchain + key: toolchain-${{ env.TOOLCHAIN_URI_HASH }} + - name: Setup toolchain + run: | + if [ ! -f ~/toolchain/${TOOLCHAIN_ARCHIVE} ]; then + mkdir -p ~/toolchain + wget --trust-server-names \ + -O ~/toolchain/${TOOLCHAIN_ARCHIVE} ${TOOLCHAIN_URI} + fi + sudo tar xjf ~/toolchain/${TOOLCHAIN_ARCHIVE} \ + --strip-components 1 -C /usr + + - name: Build rev4 + run: | + cd tfrog-motordriver/ + make \ + BOARD=tfrog-rev4 \ + FIRMINFO="-DYP_FIRMWARE_NAME=\\\"tf-2md3-r4-${TAG:-latest}-${SHORT_HASH}\\\"" + mv bin/tfrog-motordriver-tfrog-rev4-at91sam7se512-flash.bin \ + bin/${RELEASE_FILENAME_R4} + - name: Build rev6 + run: | + cd tfrog-motordriver/ + make \ + BOARD=tfrog-rev5 \ + FIRMINFO="-DYP_FIRMWARE_NAME=\\\"tf-2md3-r6-${TAG:-latest}-${SHORT_HASH}\\\"" + mv bin/tfrog-motordriver-tfrog-rev5-at91sam7se256-flash.bin \ + bin/${RELEASE_FILENAME_R6} + + - name: Deploy rev4 + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: tfrog-motordriver/bin/${{ env.RELEASE_FILENAME_R4 }} + asset_name: ${{ env.RELEASE_FILENAME_R4 }} + asset_content_type: application/octet-stream + - name: Deploy rev6 + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: tfrog-motordriver/bin/${{ env.RELEASE_FILENAME_R6 }} + asset_name: ${{ env.RELEASE_FILENAME_R6 }} + asset_content_type: application/octet-stream diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1105fad..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -dist: trusty -sudo: required -language: c -compiler: gcc - -cache: - directories: - - ${HOME}/cache - -env: - global: - - TOOLCHAIN_URI="https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2?product=GNU%20ARM%20Embedded%20Toolchain,64-bit,,Linux,6-2017-q2-update" - - TOOLCHAIN_ARCHIVE=gcc-arm-none-eabi.tar.bz2 - - RELEASE_FILENAME_R4=tf-2md3-r4-${TRAVIS_TAG}.bin - - RELEASE_FILENAME_R6=tf-2md3-r6-${TRAVIS_TAG}.bin - -before_install: - - sudo apt-get update -qq - - sudo apt-get install wget - - if [ ! -f ${HOME}/cache/${TOOLCHAIN_ARCHIVE} ]; then wget --trust-server-names -O ${HOME}/cache/${TOOLCHAIN_ARCHIVE} ${TOOLCHAIN_URI}; fi - - sudo tar xjf ${HOME}/cache/${TOOLCHAIN_ARCHIVE} --strip-components 1 -C /usr - -install: - - cd tfrog-motordriver/ - - make BOARD=tfrog-rev4 FIRMINFO="-DYP_FIRMWARE_NAME=\\\"tf-2md3-r4-$TRAVIS_TAG-`git rev-parse --short HEAD`\\\"" - - make BOARD=tfrog-rev5 FIRMINFO="-DYP_FIRMWARE_NAME=\\\"tf-2md3-r6-$TRAVIS_TAG-`git rev-parse --short HEAD`\\\"" - - mv bin/tfrog-motordriver-tfrog-rev4-at91sam7se512-flash.bin bin/${RELEASE_FILENAME_R4} - - mv bin/tfrog-motordriver-tfrog-rev5-at91sam7se256-flash.bin bin/${RELEASE_FILENAME_R6} - -script: true - -deploy: - provider: releases - skip_cleanup: true - api_key: - secure: XpzbmHNim/Feyyr+RVPyx+AbS1WOmb4PIL8R4B0KFz+macXm847suGUCU+9zYozObuYkc6mJ5CdHXfKf/6yJSY1ndyfY9mZQknSx7yoLFBjlzAokWKtF61KBxVf+Z8Zpjy5l3YhDDaemFNfUqUYDK6sv+nbIPJayuFDl8PyFmpke7e3rX0IU5fSOkDOpqVguZu2VYqKFCu4/Z/6wUBm+0+HMMx2deV8X47EY957C5eMbrJvJBlQ/RJMybQ1Id1Aj6oCEc5q5DKu7k5T1JTWHTVLlAGLX2EnpP61TCZloGRWLtL1EGk6cKK59AlSZlQ0HfoIHOwunrmqx5II5Wq/kRyhCYKwpw54ajAhSgjHMbc3G7zns1N05QaPDx4NgDiLxRAAGX/lLRXXF6CncqAIJWlbks5DSq5N0TiqT/JGh/P/blaavXujUt0U9xjGSx4Oz4bpw23k8I8weTnSnkmTL2H5yI4RXbjd/ezu6Ktnac1/a+LnwFm6N64xjxlHqo5GlVWoWuNRPSqjwbxFMLIDeeNv9rfZxZPObFcLCief5j1jN+2O9PZMMr1mdpMimKZsy2C7fTJfXbFmngZu+t6z2M3IC0jSiRqF03xoh5EFgWlQBvxrw9kwofDWgA4uycgvJfHdPd8A7BMAk2m3hnRTjN8uqalnHTLx0MqKZRisNTX8= - file: - - ${TRAVIS_BUILD_DIR}/tfrog-motordriver/bin/${RELEASE_FILENAME_R4} - - ${TRAVIS_BUILD_DIR}/tfrog-motordriver/bin/${RELEASE_FILENAME_R6} - on: - tags: true -