diff --git a/.clang-format b/.clang-format index 6baed5c..61fbcf4 100644 --- a/.clang-format +++ b/.clang-format @@ -1,6 +1,5 @@ --- IndentWidth: 4 -Language: Cpp Standard: Latest UseCRLF: false UseTab: Never diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index d6acd93..2ca54c5 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -4,11 +4,11 @@ on: workflow_dispatch: permissions: - contents: read + contents: write concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: benchmark-pages + cancel-in-progress: false jobs: linux: @@ -119,3 +119,67 @@ jobs: benchmarks/bench_IsPrime.jpg benchmarks/bench_IsPrimeNoTable.jpg benchmarks/bench_summary.jpg + + publish-pages: + name: Publish benchmark results to GitHub Pages + runs-on: ubuntu-latest + needs: [linux, windows] + steps: + - name: Download benchmark artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + pattern: benchmark-* + + - name: Prepare Pages content + shell: bash + run: | + set -euo pipefail + RUN_ID="${GITHUB_RUN_ID}" + OUT_DIR="site/benchmarks/runs/${RUN_ID}" + + mkdir -p "${OUT_DIR}" + + # Keep artifact directories separated to avoid collisions. + for d in artifacts/*; do + if [ -d "$d" ]; then + name="$(basename "$d")" + mkdir -p "${OUT_DIR}/${name}" + cp -R "$d"/* "${OUT_DIR}/${name}"/ || true + fi + done + + # No Jekyll processing (serve files as-is) + touch site/.nojekyll + + # Write pointer to the latest run. + python3 - <<'PY' + import json, os + repo = os.environ.get('GITHUB_REPOSITORY', '') + run_id = int(os.environ.get('GITHUB_RUN_ID', '0')) + run_url = f"https://github.com/{repo}/actions/runs/{run_id}" if repo and run_id else None + artifacts_dir = 'artifacts' + artifacts = [] + if os.path.isdir(artifacts_dir): + for name in sorted(os.listdir(artifacts_dir)): + full = os.path.join(artifacts_dir, name) + if os.path.isdir(full) and name.startswith('benchmark-'): + artifacts.append(name) + data = { + 'runId': run_id, + 'runUrl': run_url, + 'artifacts': artifacts, + } + os.makedirs('site/benchmarks', exist_ok=True) + with open('site/benchmarks/latest.json', 'w', encoding='utf-8') as f: + json.dump(data, f, ensure_ascii=False, indent=2) + PY + + - 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(bench): publish run ${{ github.run_id }}" diff --git a/README.md b/README.md index 431c0b8..9dc6948 100644 --- a/README.md +++ b/README.md @@ -100,11 +100,6 @@ The benchmark is run on GitHub Actions' Linux with gcc with -O3 optimization ena You can find more detailed benchmark results by clicking [here](https://github.com/Rac75116/libcpprime/actions/workflows/bench.yml?query=branch%3Amain+is%3Acompleted). - -![bench_IsPrime](bench_results/bench_IsPrime.jpg) -![bench_IsPrimeNoTable](bench_results/bench_IsPrimeNoTable.jpg) -![bench_summary](bench_results/bench_summary.jpg) - # Releases - 2025/12/21 ver 1.3.0 diff --git a/bench_results/bench_IsPrime.jpg b/bench_results/bench_IsPrime.jpg deleted file mode 100644 index aedc262..0000000 Binary files a/bench_results/bench_IsPrime.jpg and /dev/null differ diff --git a/bench_results/bench_IsPrimeNoTable.jpg b/bench_results/bench_IsPrimeNoTable.jpg deleted file mode 100644 index 922c1ac..0000000 Binary files a/bench_results/bench_IsPrimeNoTable.jpg and /dev/null differ diff --git a/bench_results/bench_summary.jpg b/bench_results/bench_summary.jpg deleted file mode 100644 index 8526a28..0000000 Binary files a/bench_results/bench_summary.jpg and /dev/null differ