diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index ca37cef..7c960e5 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -1,6 +1,14 @@ name: Benchmark on: + push: + branches: [main] + paths: + - "include/**" + - "benchmarks/**" + - "CMakeLists.txt" + - "Taskfile.yml" + - ".github/workflows/bench.yml" workflow_dispatch: permissions: @@ -124,6 +132,9 @@ jobs: name: Publish benchmark results to GitHub Pages runs-on: ubuntu-latest needs: [linux, windows] + concurrency: + group: gh-pages-deploy + cancel-in-progress: false steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..9be5ef3 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,63 @@ +name: Docs + +on: + push: + branches: [main] + paths: + - "docs/**" + - "README.md" + - "mkdocs.yml" + - ".github/workflows/docs.yml" + workflow_dispatch: + +permissions: + contents: write + +concurrency: + group: docs-pages + cancel-in-progress: true + +jobs: + build-and-deploy: + name: Build and deploy MkDocs + runs-on: ubuntu-latest + concurrency: + group: gh-pages-deploy + cancel-in-progress: false + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Task + uses: go-task/setup-task@v1 + with: + version: 3.x + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Setup uv + uses: astral-sh/setup-uv@v4 + with: + enable-cache: true + cache-dependency-glob: | + pyproject.toml + uv.lock + + - name: Install Python dependencies + run: uv sync --frozen + + - name: Build site + run: task docs + + - name: Deploy to gh-pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: site + keep_files: true + commit_message: "chore(docs): publish run ${{ github.run_id }}" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 18dc417..ea50f85 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,88 +1,99 @@ name: Tests on: - push: - branches: [main] - pull_request: - branches: [main] - workflow_dispatch: + push: + branches: [main] + paths: + - "include/**" + - "tests/**" + - "CMakeLists.txt" + - "Taskfile.yml" + - ".github/workflows/tests.yml" + pull_request: + branches: [main] + paths: + - "include/**" + - "tests/**" + - "CMakeLists.txt" + - ".github/workflows/tests.yml" + workflow_dispatch: permissions: - contents: read + contents: read concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - linux: - name: Linux (${{ matrix.compiler }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - compiler: gcc - build_dir: build-gcc - cc: gcc - cxx: g++ - - compiler: clang - build_dir: build-clang - cc: clang - cxx: clang++ - steps: - - uses: actions/checkout@v4 - - run: | - sudo apt-get update -y - sudo apt-get install -y ninja-build ccache - - name: Install Task - uses: go-task/setup-task@v1 - with: - version: 3.x - - name: Cache build dir (${{ matrix.compiler }}) - uses: actions/cache@v4 - with: - path: ${{ matrix.build_dir }} - key: ${{ runner.os }}-${{ matrix.compiler }}-build-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt', '**/*.cmake') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.compiler }}-build- - - name: Run tests (${{ matrix.compiler }}) - env: - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} - run: task test:${{ matrix.compiler }} + linux: + name: Linux (${{ matrix.compiler }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - compiler: gcc + build_dir: build-gcc + cc: gcc + cxx: g++ + - compiler: clang + build_dir: build-clang + cc: clang + cxx: clang++ + steps: + - uses: actions/checkout@v4 + - run: | + sudo apt-get update -y + sudo apt-get install -y ninja-build ccache + - name: Install Task + uses: go-task/setup-task@v1 + with: + version: 3.x + - name: Cache build dir (${{ matrix.compiler }}) + uses: actions/cache@v4 + with: + path: ${{ matrix.build_dir }} + key: ${{ runner.os }}-${{ matrix.compiler }}-build-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt', '**/*.cmake') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.compiler }}-build- + - name: Run tests (${{ matrix.compiler }}) + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} + run: task test:${{ matrix.compiler }} - windows: - name: Windows (${{ matrix.compiler }}) - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - include: - - compiler: msvc - build_dir: build-msvc - - compiler: clang-cl - build_dir: build-clang-cl - steps: - - uses: actions/checkout@v4 + windows: + name: Windows (${{ matrix.compiler }}) + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - compiler: msvc + build_dir: build-msvc + - compiler: clang-cl + build_dir: build-clang-cl + steps: + - uses: actions/checkout@v4 - - name: Install LLVM + Ninja (clang-cl) - if: matrix.compiler == 'clang-cl' - shell: pwsh - run: | - choco install llvm ninja -y --no-progress + - name: Install LLVM + Ninja (clang-cl) + if: matrix.compiler == 'clang-cl' + shell: pwsh + run: | + choco install llvm ninja -y --no-progress - - uses: actions/cache@v4 - with: - path: ${{ matrix.build_dir }} - key: ${{ runner.os }}-${{ matrix.compiler }}-build-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt', '**/*.cmake') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.compiler }}-build- + - uses: actions/cache@v4 + with: + path: ${{ matrix.build_dir }} + key: ${{ runner.os }}-${{ matrix.compiler }}-build-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt', '**/*.cmake') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.compiler }}-build- - - name: Install Task - uses: go-task/setup-task@v1 - with: - version: 3.x + - name: Install Task + uses: go-task/setup-task@v1 + with: + version: 3.x - - name: Run tests (${{ matrix.compiler }}) - run: task test:${{ matrix.compiler }} + - name: Run tests (${{ matrix.compiler }}) + run: task test:${{ matrix.compiler }} diff --git a/.vscode/settings.json b/.vscode/settings.json index 3012db3..e61ef90 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,6 +3,7 @@ "editor.formatOnType": true, "editor.formatOnPaste": false, "editor.insertSpaces": true, + "editor.tabSize": 4, "[json]": { "editor.defaultFormatter": "vscode.json-language-features" }, @@ -10,7 +11,8 @@ "editor.defaultFormatter": "vscode.json-language-features" }, "[yaml]": { - "editor.defaultFormatter": "redhat.vscode-yaml" + "editor.defaultFormatter": "redhat.vscode-yaml", + "editor.tabSize": 2 }, "[cpp]": { "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd", @@ -18,7 +20,6 @@ "[python]": { "editor.defaultFormatter": "charliermarsh.ruff" }, - "editor.tabSize": 4, "terminal.integrated.defaultProfile.windows": "PowerShell", "terminal.integrated.env.windows": { "PSExecutionPolicyPreference": "RemoteSigned" diff --git a/Taskfile.yml b/Taskfile.yml index 701719e..f2200e4 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -146,6 +146,12 @@ tasks: - cp README.md docs/index.md - uv run mkdocs build + serve: + desc: Serve documentation locally + cmds: + - cp README.md docs/index.md + - uv run mkdocs serve + # ============================ # Aggregates # ============================ diff --git a/docs/googlead6cd4877a2cd852.html b/docs/googlead6cd4877a2cd852.html new file mode 100644 index 0000000..5d7ef6b --- /dev/null +++ b/docs/googlead6cd4877a2cd852.html @@ -0,0 +1 @@ +google-site-verification: googlead6cd4877a2cd852.html \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 31ad413..dd1a864 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,5 @@ site_name: libcpprime Documentation +site_url: https://rac75116.github.io/libcpprime/ theme: name: material logo: assets/favicon.png @@ -16,6 +17,7 @@ theme: accent: indigo repo_url: https://github.com/Rac75116/libcpprime repo_name: Rac75116/libcpprime +copyright: "Copyright © 2025 Rac75116" nav: - libcpprime: index.md - "GitHub Repository": https://github.com/Rac75116/libcpprime