Added CMake Flags to make tests optional #343
Workflow file for this run
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
name: build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
BUILD_TYPE: release | |
jobs: | |
compilation: | |
name: Compilation and Unit Tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
artifact: macos | |
name: MacOSX | |
inklecate_url: https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_mac.zip | |
proof: false | |
unreal: false | |
- os: macos-14 | |
artifact: macos-arm | |
name: MacOSX-ARM | |
inklecate_url: https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_mac.zip | |
proof: false | |
unreal: false | |
- os: windows-latest | |
artifact: win64 | |
name: Windows x64 | |
inklecate_url: https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_windows.zip | |
proof: false | |
unreal: false | |
- os: "ubuntu-20.04" | |
artifact: linux | |
name: Linux x64 | |
inklecate_url: https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_linux.zip | |
proof: true | |
unreal: true | |
steps: | |
# Checkout project | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# Setup python | |
- uses: actions/setup-python@v5 | |
if: ${{ matrix.proof }} | |
with: | |
python-version: '3.x' | |
# Setup CMake | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.22.x' | |
# Create a build directory to store all the CMake generated files | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
# Run CMake configuration to create build files | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DINKCPP_PY=OFF -DINKCPP_C=ON -DINKCPP_TEST=ON -DINKCPP_INKLECATE=OS | |
# Build using CMake and OS toolkit | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: cmake --build . --config $BUILD_TYPE | |
# Run CMake tests (unit tests, etc.) | |
- name: CTests | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: ctest . -C $BUILD_TYPE -V | |
# Copy all build artifacts to the bin directory | |
- name: Install Cl | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: cmake --install . --config $BUILD_TYPE --prefix comp_cl --component cl | |
- name: Upload Cl | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact }}-cl | |
path: build/comp_cl/ | |
- name: Install Lib | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: cmake --install . --config $BUILD_TYPE --prefix comp_lib --component lib | |
- name: Upload Lib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact }}-lib | |
path: build/comp_lib/ | |
- name: Install CLib | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: cmake --install . --config $BUILD_TYPE --prefix comp_clib --component clib | |
- name: Upload Clib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{matrix.artifact}}-clib | |
path: build/comp_clib | |
- name: Install UE | |
if: ${{ matrix.unreal }} | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: cmake --install . --config $BUILD_TYPE --prefix comp_unreal --component unreal | |
- name: Upload UE | |
if: ${{ matrix.unreal }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unreal | |
path: build/comp_unreal/ | |
# Make sure Inkproof has everything it needs to run our executable | |
- name: Setup Ink Proof | |
if: ${{ matrix.proof }} | |
shell: bash | |
working-directory: proofing/ink-proof | |
run: | | |
python3 install_deps.py | |
cp ../inkcpp_runtime_driver drivers/ | |
chmod +x drivers/inkcpp_runtime_driver | |
mkdir deps/inkcpp | |
cp ../../build/comp_cl/* deps/inkcpp/ | |
chmod +x deps/inkcpp/inkcpp_cl | |
# Run it | |
- name: Run Ink Proof | |
if: ${{ matrix.proof }} | |
shell: bash | |
working-directory: proofing/ink-proof | |
run: | | |
python3 proof.py --examples 'I...' inklecate_v1.1.1 inkcpp_runtime > run.out | |
echo -e "| ${{ matrix.name }} | $(cat run.out) |" > ${{ matrix.artifact }}.txt | |
# Creates a "disabled" artifact if ink proofing is disabled | |
- name: Create Disabled InkProof Results File | |
if: ${{ !matrix.proof }} | |
shell: bash | |
run: | | |
mkdir -p proofing/ink-proof | |
echo "| ${{ matrix.name }} | DISABLED |" > proofing/ink-proof/${{ matrix.artifact }}.txt | |
# Upload results artifact | |
- name: Upload Results Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: result-${{ matrix.artifact }} | |
path: proofing/ink-proof/${{ matrix.artifact }}.txt | |
# Upload website artifact | |
- name: Upload Ink-Proof Website Artifact | |
if: ${{ matrix.proof }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact }}-www | |
path: proofing/ink-proof/out | |
build-doc: | |
name: Build Doxygen documentation | |
needs: [compilation, build-python] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set upt Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install Doxygen | |
run: | | |
sudo apt-get install graphviz -y | |
wget https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz | |
gunzip doxygen-*.tar.gz | |
tar xf doxygen-*.tar | |
cd doxygen-1.10.0/ | |
sudo make install | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.22.x' | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: cmake $GITHUB_WORKSPACE -DINKCPP_PY=ON -DINKCPP_DOC_BlueprintUE=ON | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: cmake --build . --target doc | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: doxygen | |
path: Documentation/ | |
build-python: | |
name: Build Python package | |
needs: compilation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: install build | |
run: >- | |
python3 -m | |
pip install | |
build | |
pytest | |
--user | |
- name: Build python release | |
run: python3 -m build | |
- uses: suisei-cn/[email protected] | |
name: Download Inklecate | |
id: download_inklecate | |
with: | |
url: https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_linux.zip | |
target: "inklecate/" | |
- name: Deploy Inkelcate | |
shell: bash | |
run: | | |
cd inklecate | |
unzip *.zip | |
echo "INKLECATE=${{ matrix.inklecate_pre }}$GITHUB_WORKSPACE/inklecate/inklecate${{ matrix.inklecate_post }}" >> $GITHUB_ENV | |
- name: Test python release | |
run: | | |
python3 -m pip install dist/*.whl --user | |
python3 -m pytest | |
- name: Remove wheel | |
run: | | |
rm dist/*.whl | |
- name: Upload Python files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distribution | |
path: dist/ | |
clang-format: | |
name: "Check Formatting" | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch master branch | |
run: | | |
git fetch origin master | |
- name: Check clang-format | |
run: | | |
diff=$(git clang-format-14 --extensions c,cpp,h,hpp --style file -q --diff origin/master) | |
echo $diff | |
if [ "$diff" != "" ]; then | |
echo run git clang-format --extensions c,cpp,h,hpp --style file master | |
echo or upstream/master depending on your setup | |
clang | |
fi | |
reporting: | |
name: "Pull Request Report" | |
# if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'brwarner/inkcpp' }} | |
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' }} | |
runs-on: ubuntu-latest | |
needs: [compilation, clang-format] | |
permissions: | |
pull-requests: write | |
steps: | |
# Download Ink Proof Results | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: result-* | |
path: "results" | |
merge-multiple: true | |
# Create comment text | |
- name: Create Comment Text File | |
shell: bash | |
run: | | |
echo "### Ink Proof Results" >> comment.txt | |
echo "" >> comment.txt | |
echo "These results are obtained by running the [Ink-Proof Testing Suite](https://github.com/chromy/ink-proof) on the compiled binaries in this pull request." >> comment.txt | |
echo "" >> comment.txt | |
echo "| System | Results |" >> comment.txt | |
echo "| --- | --- |" >> comment.txt | |
FILES="results/*.txt" | |
for f in $FILES | |
do | |
echo "Reading results from $f" | |
cat "$f" >> comment.txt | |
done | |
# Post Comment | |
- uses: marocchino/[email protected] | |
with: | |
recreate: true | |
path: comment.txt | |
pages: | |
permissions: | |
contents: write | |
name: "Upload Ink-Proof to Github Pages" | |
needs: [ compilation, build-doc ] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v4 | |
# Download Ink Proof page for Linux | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux-www | |
path: www/proof | |
- uses: actions/download-artifact@v4 | |
with: | |
name: doxygen | |
path: www | |
# Deploy to Github Pages | |
- name: Deploy Page | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: inkproof-page | |
folder: www |