Merge pull request #1010 from slaclab/reusable-CI-yaml #1452
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 : ROGUE GitHub Actions Script | |
# ---------------------------------------------------------------------------- | |
# This file is part of the rogue software package. 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 rogue software package, 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 | |
# secrets.DOCKERHUB_TOKEN | |
name: Rogue Integration | |
on: [push] | |
jobs: | |
full_build_test: | |
name: Full Build Test | |
runs-on: ubuntu-20.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.8 | |
cache: 'pip' | |
cache-dependency-path: 'pip_requirements.txt' | |
# Install dependencies | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install doxygen doxygen-doc libzmq3-dev libboost-all-dev | |
pip install -r pip_requirements.txt | |
# Python Linter | |
- name: Python Linter | |
run: | | |
python -m compileall -f ./python/ | |
flake8 --count ./python/ | |
python -m compileall -f ./tests | |
flake8 --count ./tests/ | |
# C++ Linter | |
- name: C++ Linter | |
run: | | |
find . -name '*.h' -o -name '*.cpp' | xargs cpplint | |
# Rogue | |
- name: Build Rogue | |
run: | | |
python -c "import numpy; print(numpy.get_include())" | |
mkdir build; cd build | |
cmake .. -DROGUE_INSTALL=local | |
make -j4 install | |
# Run Tests | |
- name: Rogue Tests | |
run: | | |
source setup_rogue.sh | |
python -m pytest --cov | |
# Compile API Test | |
- name: Compile API Test | |
run: | | |
source setup_rogue.sh | |
cd tests/api_test | |
mkdir build; cd build | |
cmake .. | |
make | |
# Run API Test | |
- name: Run API Test | |
run: | | |
source setup_rogue.sh | |
tests/api_test/bin/api_test | |
# Code Coverage | |
- name: Code Coverage | |
run: | | |
source setup_rogue.sh | |
codecov | |
coverage report -m | |
# Generate Documentation | |
- name: Generate Documentation | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
source setup_rogue.sh | |
cd docs | |
make html | |
- name: Deploy Documentation | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GH_TOKEN }} | |
publish_dir: docs/build/html | |
# ---------------------------------------------------------------------------- | |
small_build_test: | |
name: Small Build Test | |
runs-on: ubuntu-20.04 | |
steps: | |
# This step checks out a copy of your repository. | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install libzmq3-dev | |
# Rogue | |
- name: Build Rogue | |
run: | | |
mkdir build; cd build | |
cmake .. -DROGUE_INSTALL=local -DNO_PYTHON=1 -DSTATIC_LIB=1 | |
make -j4 install | |
# ---------------------------------------------------------------------------- | |
gen_release: | |
needs: [full_build_test, small_build_test] | |
uses: slaclab/ruckus/.github/workflows/gen_release.yml@main | |
with: | |
version: '1.0.0' | |
secrets: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
# ---------------------------------------------------------------------------- | |
conda_build_lib: | |
needs: [full_build_test, small_build_test] | |
uses: slaclab/ruckus/.github/workflows/conda_build_lib.yml@main | |
with: | |
version: '1.0.0' | |
secrets: | |
CONDA_UPLOAD_TOKEN_TAG: ${{ secrets.CONDA_UPLOAD_TOKEN_TAG }} | |
# ---------------------------------------------------------------------------- | |
docker_build_lib: | |
needs: [full_build_test, small_build_test] | |
uses: slaclab/ruckus/.github/workflows/docker_build_lib.yml@main | |
with: | |
version: '1.0.0' | |
secrets: | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
# ---------------------------------------------------------------------------- |