Merge pull request #28 from maxortner01/documentation #54
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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
push: | |
branches: [ "main" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
environment: | |
name: build-docs-env | |
# The type of runner that the job will run on | |
runs-on: macos-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v1 | |
with: | |
submodules: true | |
- name: "Install deps for docs" | |
run: brew install doxygen zlib bash cmake pkgconfig dwarfutils openssl freetype imagemagick | |
- name: Set reusable strings | |
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: "Python env" | |
run: python3 -m venv ${{ steps.strings.outputs.build-output-dir }}/env && | |
source ${{ steps.strings.outputs.build-output-dir }}/env/bin/activate && | |
python3 -m pip install requests Wand | |
# Runs a single command using the runners shell | |
- name: Configure docs | |
run: cmake -B ${{ steps.strings.outputs.build-output-dir }} -DSL_BUILD_LIB=OFF -DSL_BUILD_DOCS=ON -S ${{ github.workspace }} | |
- name: Build docs | |
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} | |
- name: Configure coverage | |
run: cmake -B ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_BUILD_TYPE=Debug -DSL_BUILD_LIB=ON -DSL_UNIT_TESTS=ON -DSL_CODE_COVERAGE=ON -DSL_BUILD_DOCS=OFF -S ${{ github.workspace }} | |
- name: Run coverage | |
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} | |
- name: Run kcov | |
run: sudo ${{ steps.strings.outputs.build-output-dir }}/kcov-prefix/src/kcov-build/src/kcov --include-path=${{ github.workspace }}/include ${{ steps.strings.outputs.build-output-dir }}/cov_hello_test ${{ steps.strings.outputs.build-output-dir }}/hello_test && | |
sudo ${{ steps.strings.outputs.build-output-dir }}/kcov-prefix/src/kcov-build/src/kcov --include-path=${{ github.workspace }}/include ${{ steps.strings.outputs.build-output-dir }}/cov_lua_file ${{ steps.strings.outputs.build-output-dir }}/lua_file && | |
sudo ${{ steps.strings.outputs.build-output-dir }}/kcov-prefix/src/kcov-build/src/kcov --merge ${{ steps.strings.outputs.build-output-dir }}/coverage ${{ steps.strings.outputs.build-output-dir }}/cov_* | |
- name: Run codacy-coverage-reporter | |
uses: codacy/[email protected] | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: ${{ steps.strings.outputs.build-output-dir }}/coverage/kcov-merged/cobertura.xml | |
- name: Create GitHub Pages artifact | |
uses: actions/[email protected] | |
with: | |
path: ${{ steps.strings.outputs.build-output-dir }}/docs/html | |
# Deploy job | |
deploy: | |
# Add a dependency to the build job | |
needs: build | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action | |