|
| 1 | +# ---------------------------------------------------------------------------- |
| 2 | +# Title : SURF GitHub Actions CI Script |
| 3 | +# ---------------------------------------------------------------------------- |
| 4 | +# This file is part of the 'SLAC firmware standard library'. It is subject to |
| 5 | +# the license terms in the LICENSE.txt file found in the top-level directory |
| 6 | +# of this distribution and at: |
| 7 | +# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. |
| 8 | +# No part of the 'SLAC firmware standard library', including this file, may be |
| 9 | +# copied, modified, propagated, or distributed except according to the terms |
| 10 | +# contained in the LICENSE.txt file. |
| 11 | +# ---------------------------------------------------------------------------- |
| 12 | +# The following environment variables are required for this process: |
| 13 | +# secrets.GH_TOKEN |
| 14 | +# secrets.CONDA_UPLOAD_TOKEN_DEV |
| 15 | +# secrets.CONDA_UPLOAD_TOKEN_TAG |
| 16 | + |
| 17 | +name: SURF Integration |
| 18 | +on: [push] |
| 19 | + |
| 20 | +jobs: |
| 21 | + |
| 22 | + test_and_document: |
| 23 | + name: Test And Generate Documentation |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + |
| 27 | + # This step checks out a copy of your repository. |
| 28 | + - uses: actions/checkout@v2 |
| 29 | + with: |
| 30 | + fetch-depth: 0 |
| 31 | + |
| 32 | + - uses: actions/setup-python@v2 |
| 33 | + with: |
| 34 | + python-version: 3.8 |
| 35 | + |
| 36 | + - name: VHDL Syntax Check |
| 37 | + run: | |
| 38 | + make |
| 39 | + rm -rf ghdl-build |
| 40 | +
|
| 41 | + - name: Python Syntax Check |
| 42 | + run: | |
| 43 | + python3 -m compileall -f python/ |
| 44 | + flake8 --count python/ |
| 45 | +
|
| 46 | + - name: Generate Documentation |
| 47 | + run: | |
| 48 | + doxygen Doxyfile |
| 49 | +
|
| 50 | + - name: Deploy Documentation |
| 51 | + if: startsWith(github.ref, 'refs/heads/') |
| 52 | + uses: peaceiris/actions-gh-pages@v3 |
| 53 | + with: |
| 54 | + github_token: ${{ secrets.GH_TOKEN }} |
| 55 | + publish_dir: doxygen/html |
| 56 | + |
| 57 | + gen_release: |
| 58 | + name: Generate Release |
| 59 | + runs-on: ubuntu-latest |
| 60 | + needs: [test_and_document] |
| 61 | + if: startsWith(github.ref, 'refs/tags/') |
| 62 | + steps: |
| 63 | + |
| 64 | + - uses: actions/checkout@v2 |
| 65 | + with: |
| 66 | + fetch-depth: 0 |
| 67 | + |
| 68 | + - uses: actions/setup-python@v2 |
| 69 | + with: |
| 70 | + python-version: 3.8 |
| 71 | + |
| 72 | + - name: Get Image Information |
| 73 | + id: get_image_info |
| 74 | + run: | |
| 75 | + echo ::set-output name=tag::`git describe --tags` |
| 76 | +
|
| 77 | + - name: Get Ruckus |
| 78 | + run: | |
| 79 | + git clone https://github.com/slaclab/ruckus.git |
| 80 | + python -m pip install --upgrade pip |
| 81 | + pip install -r ruckus/scripts/pip_requirements.txt |
| 82 | +
|
| 83 | + - name: Gen Release |
| 84 | + env: |
| 85 | + TRAVIS_REPO_SLUG: slaclab/surf |
| 86 | + TRAVIS_TAG: ${{ steps.get_image_info.outputs.tag }} |
| 87 | + GH_REPO_TOKEN: ${{ secrets.GH_TOKEN }} |
| 88 | + run: | |
| 89 | + python ruckus/scripts/releaseGen.py |
| 90 | +
|
| 91 | + conda_build: |
| 92 | + name: Anaconda Build |
| 93 | + needs: [full_build_test, small_build_test] |
| 94 | + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/pre-release' |
| 95 | + strategy: |
| 96 | + matrix: |
| 97 | + os: |
| 98 | + - ubuntu-latest |
| 99 | + - macos-10.15 |
| 100 | + runs-on: ${{ matrix.os }} |
| 101 | + steps: |
| 102 | + |
| 103 | + # This step checks out a copy of your repository. |
| 104 | + - uses: actions/checkout@v2 |
| 105 | + with: |
| 106 | + fetch-depth: 0 |
| 107 | + |
| 108 | + - uses: actions/setup-python@v2 |
| 109 | + with: |
| 110 | + python-version: 3.8 |
| 111 | + |
| 112 | + - name: Setup anaconda |
| 113 | + env: |
| 114 | + OS_NAME: ${{ matrix.os }} |
| 115 | + run: | |
| 116 | + cd ${HOME} |
| 117 | + if [ $OS_NAME == "macos-10.15" ] |
| 118 | + then |
| 119 | + wget -O miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh |
| 120 | + else |
| 121 | + wget -O miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh |
| 122 | + fi |
| 123 | + bash miniconda.sh -b -p ${HOME}/miniconda |
| 124 | + export PATH="${HOME}/miniconda/bin:$PATH" |
| 125 | + source ${HOME}/miniconda/etc/profile.d/conda.sh |
| 126 | + conda config --set always_yes yes |
| 127 | + conda install conda-build anaconda-client conda-verify |
| 128 | + if [ $OS_NAME == "macos-10.15" ] |
| 129 | + then |
| 130 | + conda install libiconv libarchive -c conda-forge |
| 131 | + fi |
| 132 | + conda update -q conda conda-build |
| 133 | + conda update --all |
| 134 | +
|
| 135 | + - name: Setup MacOS |
| 136 | + if: matrix.os == 'macos-10.15' |
| 137 | + run: | |
| 138 | + cd ${HOME} |
| 139 | + wget https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.15.sdk.tar.xz |
| 140 | + tar xzf MacOSX10.15.sdk.tar.xz |
| 141 | + sudo mkdir -p /opt/ |
| 142 | + sudo mv MacOSX10.15.sdk /opt/ |
| 143 | + CONDA_BUILD_SYSROOT=/opt/MacOSX10.15.sdk |
| 144 | + CONDA_BUILD=1 |
| 145 | + echo "CONDA_BUILD_SYSROOT=$CONDA_BUILD_SYSROOT" >> $GITHUB_ENV |
| 146 | + echo "CONDA_BUILD=$CONDA_BUILD" >> $GITHUB_ENV |
| 147 | +
|
| 148 | + - name: Get Image Information |
| 149 | + id: get_image_info |
| 150 | + env: |
| 151 | + CONDA_UPLOAD_TOKEN_DEV: ${{ secrets.CONDA_UPLOAD_TOKEN_DEV }} |
| 152 | + CONDA_UPLOAD_TOKEN_TAG: ${{ secrets.CONDA_UPLOAD_TOKEN_TAG }} |
| 153 | + OS_NAME: ${{ matrix.os }} |
| 154 | + run: | |
| 155 | + if [ ${GITHUB_REF} == "refs/heads/pre-release" ] |
| 156 | + then |
| 157 | + echo ::set-output name=token::$CONDA_UPLOAD_TOKEN_DEV |
| 158 | + else |
| 159 | + echo ::set-output name=token::$CONDA_UPLOAD_TOKEN_TAG |
| 160 | + fi |
| 161 | + if [ ${OS_NAME} == "macos-10.15" ] |
| 162 | + then |
| 163 | + echo ::set-output name=os::osx-64 |
| 164 | + else |
| 165 | + echo ::set-output name=os::linux-64 |
| 166 | + fi |
| 167 | +
|
| 168 | + - name: Build And Upload Rogue |
| 169 | + run: | |
| 170 | + export PATH="${HOME}/miniconda/bin:$PATH" |
| 171 | + source ${HOME}/miniconda/etc/profile.d/conda.sh |
| 172 | + echo "CONDA_BUILD_SYSROOT=$CONDA_BUILD_SYSROOT" |
| 173 | + echo "CONDA_BUILD=$CONDA_BUILD" |
| 174 | + conda build --debug conda-recipe --output-folder bld-dir -c tidair-tag -c tidair-packages -c conda-forge |
| 175 | + anaconda -t ${{ steps.get_image_info.outputs.token }} upload bld-dir/${{ steps.get_image_info.outputs.os }}/*.tar.bz2 |
| 176 | +
|
0 commit comments