Merge pull request #2 from Me-Phew/dev #15
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: CI | |
on: [push, workflow_dispatch] | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
PROJECT_NAME: 'MergeSort' | |
steps: | |
- name: Get latest code | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Install packages | |
run: sudo apt update && sudo apt install -y graphviz | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install Node dependencies | |
run: npm install | |
- name: Install CMake and ninja | |
uses: lukka/get-cmake@latest | |
- name: Install MinGW | |
uses: egor-tensin/setup-mingw@v2 | |
- name: Compile project for Linux using CMake | |
run: cmake --preset linux-release && cmake --build --preset linux-release-build | |
- name: Run tests | |
run: cd ./build/linux-release && ctest -C Debug -T test --output-on-failure | |
- name: Compile project for Windows using CMake | |
run: cmake -DPACKAGE_TESTS=OFF --preset windows-release && cmake --build --preset windows-release-build | |
- name: Bump version and push tag | |
if: github.ref == 'refs/heads/main' | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare build artifacts | |
run: | | |
cp ./build/linux-release/${{ env.PROJECT_NAME }} ./${{ env.PROJECT_NAME }}-${{ steps.tag_version.outputs.new_tag }}-linux-x64 | |
cp ./build/windows-release/${{ env.PROJECT_NAME }}.exe ./${{ env.PROJECT_NAME }}-${{ steps.tag_version.outputs.new_tag }}-win-x64.exe | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Remove Unicode characters from the readme | |
run: | | |
python remove_unicode.py README.md | |
- name: Set version number in Doxyfile | |
run: echo "PROJECT_NUMBER = \"${{ steps.tag_version.outputs.new_tag }}\"" >> Doxyfile | |
- name: Generate Doxygen Documentation | |
uses: mattnotmitt/doxygen-action@edge | |
- name: Deploy Doxygen documentation website | |
if: github.ref == 'refs/heads/main' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/doxygen/html | |
- name: Compile Doxygen LaTeX documentation | |
uses: xu-cheng/latex-action@3.2.0 | |
with: | |
extra_system_packages: "inkscape" | |
latexmk_shell_escape: true | |
working_directory: ./docs/doxygen/latex | |
root_file: refman.tex | |
- name: Prepare Doxygen PDF file | |
run: cp ./docs/doxygen/latex/refman.pdf ./Dokumentacja-Doxygen-${{ env.PROJECT_NAME }}-${{ steps.tag_version.outputs.new_tag }}.pdf | |
- name: Compile LaTeX documentation | |
uses: xu-cheng/latex-action@3.2.0 | |
with: | |
extra_system_packages: "inkscape" | |
latexmk_shell_escape: true | |
working_directory: ./docs/dokumentacja | |
root_file: dokument.tex | |
- name: Prepare LaTeX PDF file | |
run: cp ./docs/dokumentacja/dokument.pdf ./Dokumentacja-${{ env.PROJECT_NAME }}-${{ steps.tag_version.outputs.new_tag }}.pdf | |
- name: Create a GitHub release | |
if: github.ref == 'refs/heads/main' | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
artifacts: ${{ env.PROJECT_NAME }}-${{ steps.tag_version.outputs.new_tag }}-linux-x64,${{ env.PROJECT_NAME }}-${{ steps.tag_version.outputs.new_tag }}-win-x64.exe,Dokumentacja-${{ env.PROJECT_NAME }}-${{ steps.tag_version.outputs.new_tag }}.pdf,./Dokumentacja-Doxygen-${{ env.PROJECT_NAME }}-${{ steps.tag_version.outputs.new_tag }}.pdf |