Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add consistency checker #63

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,65 @@ jobs:
with:
commit_message: 'ci: auto fixes from pre-commit'

consistency:
if: ${{ !cancelled() && ! failure() }}
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Install copier for template rendering using pipx
run: pipx install copier

- name: Generate the project with the default value
run: |
find . -maxdepth 1 ! -name '.' \
! -name 'template' \
! -name 'includes' \
! -name '.git' \
! -name 'copier.yml' \
! -name 'CHANGELOG.md' \
-exec rm -r {} +
copier copy -r HEAD -f . .
rm .copier-answers.yml

- name: Test for consistency
run: |
echo "List inconsistent files:"
git status --porcelain
git diff --exit-code || ( \
echo "# :warning: Inconsistent files found" >> $GITHUB_STEP_SUMMARY && \
echo "The following files are inconsistent with the template:" >> $GITHUB_STEP_SUMMARY && \
git status --porcelain | while read file; do echo "- $file"; done >> $GITHUB_STEP_SUMMARY && \
echo "" >> $GITHUB_STEP_SUMMARY && \
echo "Please run 'copier copy -r HEAD -f . .' to fix them." >>$GITHUB_STEP_SUMMARY && \
exit 1 \
)

pass:
if: always()
needs: [pre-commit, consistency]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

release:
name: release
runs-on: ubuntu-latest
permissions:
contents: write
needs: [pre-commit]
needs: [pass]

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2023 Serious Scaffold
Copyright (c) 2022-2024 Serious Scaffold

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------

project = "SS Cpp"
copyright = "2022-2023 Serious Scaffold"
copyright = "2022-2024 Serious Scaffold"
author = "msclock"

# -- General configuration ---------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# CMake workflow

CMake common workflow command.

```bash
# Configure
cmake -S . -B build
# Build
cmake --build build --config Debug
# Testing
cd build && ctest -C Debug -T test --output-on-failure
# Memcheck
cd build && ctest -C Debug -T memcheck
# Install
cmake --build build --config Debug --target install

# with presets https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html
cmake -S . --list-presets # list all configure presets
cmake -S . --preset=<preset> # configure using desired configure preset
cmake --build --list-presets # list all build presets
cmake --build --preset=<preset> # build the desired build preset
ctest --list-presets # list all test presets
ctest --preset=<preset> # test the desired test preset
```
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,65 @@ jobs:
with:
commit_message: 'ci: auto fixes from pre-commit'

consistency:
if: ${{ !cancelled() && ! failure() }}
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Install copier for template rendering using pipx
run: pipx install copier

- name: Generate the project with the default value
run: |
find . -maxdepth 1 ! -name '.' \
! -name 'template' \
! -name 'includes' \
! -name '.git' \
! -name 'copier.yml' \
! -name 'CHANGELOG.md' \
-exec rm -r {} +
copier copy -r HEAD -f . .
rm .copier-answers.yml

- name: Test for consistency
run: |
echo "List inconsistent files:"
git status --porcelain
git diff --exit-code || ( \
echo "# :warning: Inconsistent files found" >> $GITHUB_STEP_SUMMARY && \
echo "The following files are inconsistent with the template:" >> $GITHUB_STEP_SUMMARY && \
git status --porcelain | while read file; do echo "- $file"; done >> $GITHUB_STEP_SUMMARY && \
echo "" >> $GITHUB_STEP_SUMMARY && \
echo "Please run 'copier copy -r HEAD -f . .' to fix them." >>$GITHUB_STEP_SUMMARY && \
exit 1 \
)

pass:
if: always()
needs: [pre-commit, consistency]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

release:
name: release
runs-on: ubuntu-latest
permissions:
contents: write
needs: [pre-commit]
needs: [pass]

steps:
- name: Checkout
Expand Down
Loading