Merge pull request #1135 from slaclab/fix-PR1132 #1471
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
# ---------------------------------------------------------------------------- | |
# Title : SURF GitHub Actions CI Script | |
# ---------------------------------------------------------------------------- | |
# This file is part of the 'SLAC firmware standard library'. It is subject to | |
# the license terms in the LICENSE.txt file found in the top-level directory | |
# of this distribution and at: | |
# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. | |
# No part of the 'SLAC firmware standard library', including this file, may be | |
# copied, modified, propagated, or distributed except according to the terms | |
# contained in the LICENSE.txt file. | |
# ---------------------------------------------------------------------------- | |
# The following environment variables are required for this process: | |
# secrets.GH_TOKEN | |
# secrets.CONDA_UPLOAD_TOKEN_TAG | |
name: SURF Integration | |
on: [push] | |
jobs: | |
# ---------------------------------------------------------------------------- | |
test_and_document: | |
name: Test And Generate Documentation | |
runs-on: ubuntu-22.04 | |
steps: | |
# This step checks out a copy of your repository. | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install make python3 python3-pip tclsh | |
sudo apt-get install doxygen doxygen-doc doxygen-latex doxygen-gui graphviz | |
python -m pip install --upgrade pip | |
pip install -r pip_requirements.txt | |
git clone https://github.com/slaclab/ruckus.git | |
pip install -r ruckus/scripts/pip_requirements.txt | |
- name: Python Syntax and Linter Checking | |
run: | | |
python -m compileall -f python/ scripts/ tests/ | |
flake8 --count python/ scripts/ tests/ | |
- name: VHDL Regression Testing | |
run: | | |
./ghdl-build.sh > /dev/null 2>&1 | |
make MODULES=$PWD | |
python -m pytest --cov -v tests/ | |
rm -rf ghdl-build | |
# # Code Coverage | |
# - name: Code Coverage | |
# run: | | |
# codecov | |
# coverage report -m | |
- name: Generate Documentation | |
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/pre-release' | |
run: | | |
doxygen Doxyfile | |
- name: Deploy Documentation | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GH_TOKEN }} | |
publish_dir: doxygen/html | |
# ---------------------------------------------------------------------------- | |
gen_release: | |
name: Generate Release | |
runs-on: ubuntu-20.04 | |
needs: [test_and_document] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Get Image Information | |
id: get_image_info | |
run: | | |
echo ::set-output name=tag::`git describe --tags` | |
- name: Get Ruckus | |
run: | | |
git clone https://github.com/slaclab/ruckus.git | |
python -m pip install --upgrade pip | |
pip install -r ruckus/scripts/pip_requirements.txt | |
- name: Gen Release | |
env: | |
TRAVIS_REPO_SLUG: ${{ github.repository }} | |
TRAVIS_TAG: ${{ steps.get_image_info.outputs.tag }} | |
GH_REPO_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
python ruckus/scripts/releaseGen.py | |
# ---------------------------------------------------------------------------- | |
conda_build: | |
name: Anaconda Build | |
needs: [test_and_document] | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
runs-on: ${{ matrix.os }} | |
steps: | |
# This step checks out a copy of your repository. | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Setup anaconda | |
env: | |
OS_NAME: ${{ matrix.os }} | |
run: | | |
cd ${HOME} | |
wget -O miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh | |
bash miniconda.sh -b -p ${HOME}/miniconda | |
export PATH="${HOME}/miniconda/bin:$PATH" | |
source ${HOME}/miniconda/etc/profile.d/conda.sh | |
conda config --set always_yes yes | |
conda config --set channel_priority strict | |
conda install -n base conda-libmamba-solver | |
conda config --set solver libmamba | |
conda install conda-build anaconda-client conda-verify | |
conda update -q conda conda-build | |
conda update --all | |
- name: Get Image Information | |
id: get_image_info | |
env: | |
CONDA_UPLOAD_TOKEN_TAG: ${{ secrets.CONDA_UPLOAD_TOKEN_TAG }} | |
OS_NAME: ${{ matrix.os }} | |
run: | | |
echo ::set-output name=token::$CONDA_UPLOAD_TOKEN_TAG | |
echo ::set-output name=os::linux-64 | |
- name: Build And Upload | |
run: | | |
export PATH="${HOME}/miniconda/bin:$PATH" | |
source ${HOME}/miniconda/etc/profile.d/conda.sh | |
conda build --debug conda-recipe --output-folder bld-dir -c tidair-tag -c tidair-packages -c conda-forge | |
anaconda -t ${{ steps.get_image_info.outputs.token }} upload --force bld-dir/noarch/*.tar.bz2 | |
# ---------------------------------------------------------------------------- |