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

Improve local and CI flows #26

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
11 changes: 8 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
---
# /.clang-format -*-config-*-
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make it slightly harder to keep the .clang-format up to date because clang-format will want to rewrite it when you dump the config.
I believe it's right now at clang-format-17.

clang-format-19 --style=file:.clang-format    --dump-config

will produce the file that clang-format believes it read, adding the options that were defaulted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make it slightly harder to keep the .clang-format up to date because clang-format will want to rewrite it when you dump the config.

I'm OK to remove this file, but wouldn't be consistent for other linters? I think I would like to change it manually (using --dump-config into a temporary file). What do you think?

btw, I tried with clang 17/18/19, and I cannot get the current config. Would you like to update it with clang-format-19 in this PR? (The required changes will be applied in later commits or in a new PR).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the comment itself that gets lost. clang-format configs are generally one way upgradable but otherwise stable. That is, clang-format-N+1 will read an N file and default the elements that are added, so that when you run dump-config you get a file that only cf-N+1 understands but that produces the same output as the old config.

Caveats around syntax that clang-format didn't used to understand, of course.

We don't need to be eager about upgrading unless we decide we need the new knobs.

I've left myself a TODO to see if clang-format changes matter for the few files we have, and if so, we probably don't need to upgrade.

It's just that the comments are easy to get lost, and I wouldn't want anyone to read too much into that.


# Default configuration for clang-format.

Language: Cpp
Standard: Latest

AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
Expand Down Expand Up @@ -164,7 +170,7 @@ PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
# PointerAlignment: Left
PPIndentWidth: -1
QualifierAlignment: Custom
QualifierOrder:
Expand Down Expand Up @@ -223,7 +229,6 @@ SpacesInParensOptions:
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
Expand Down
4 changes: 4 additions & 0 deletions .cmake-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# /.cmake-format.yml -*-config-*-
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Default configuration for cmake-format.
72 changes: 0 additions & 72 deletions .github/workflows/ci.yml

This file was deleted.

117 changes: 117 additions & 0 deletions .github/workflows/ci_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: CI Lint
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {name: "Lint Cpp", os: ubuntu-24.04}
- {name: "Lint Shell", os: ubuntu-24.04}
- {name: "Lint Markdown", os: ubuntu-24.04}
- {name: "Lint YAML", os: ubuntu-24.04}
- {name: "Lint Cmake", os: ubuntu-24.04}
steps:
- uses: actions/checkout@v4
- name: Activate verbose shell
run: set -x
- name: Install Cpp linter
if: startsWith(matrix.config.name, 'Lint Cpp')
run: |
set -x
cat /etc/lsb-release
installed_clang_version=18
sudo apt-get remove clang-${installed_clang_version} \
lldb-${installed_clang_version} \
lld-${installed_clang_version} \
clangd-${installed_clang_version} \
clang-tidy-${installed_clang_version} \
clang-format-${installed_clang_version} \
clang-tools-${installed_clang_version} \
llvm-${installed_clang_version}-dev \
lld-${installed_clang_version} \
lldb-${installed_clang_version} \
llvm-${installed_clang_version}-tools \
libomp-${installed_clang_version}-dev \
libc++-${installed_clang_version}-dev \
libc++abi-${installed_clang_version}-dev \
libclang-common-${installed_clang_version}-dev \
libclang-${installed_clang_version}-dev \
libclang-cpp${installed_clang_version}-dev \
libunwind-${installed_clang_version}-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19 all
sudo apt-get install libc++-dev libc++1 libc++abi-dev libc++abi1
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-19 10
- name: Check Cpp linter
if: startsWith(matrix.config.name, 'Lint Cpp')
run: |
clang-format --version
- name: Run Cpp linter
if: startsWith(matrix.config.name, 'Lint Cpp')
run: |
scripts/lint.sh --verbose --cpp
- name: Install Shell linter
if: startsWith(matrix.config.name, 'Lint Shell')
run: |
sudo apt-get update &> /dev/null
sudo apt-get install shellcheck
- name: Check Shell linter
if: startsWith(matrix.config.name, 'Lint Shell')
run: |
shellcheck --version
- name: Run Shell linter
if: startsWith(matrix.config.name, 'Lint Shell')
run: |
scripts/lint.sh --verbose --shell
- name: Install Markdown linter
if: startsWith(matrix.config.name, 'Lint Markdown')
run: |
sudo apt-get update &> /dev/null
sudo apt-get install -y npm
sudo npm install -g markdownlint-cli
- name: Check Markdown linter
if: startsWith(matrix.config.name, 'Lint Markdown')
run: |
markdownlint --version
- name: Run Markdown linter
if: startsWith(matrix.config.name, 'Lint Markdown')
run: |
scripts/lint.sh --verbose --markdown
- name: Install Yaml linter
if: startsWith(matrix.config.name, 'Lint YAML')
run: |
sudo apt-get update &> /dev/null
sudo apt-get install -y yamllint
- name: Check Yaml linter
if: startsWith(matrix.config.name, 'Lint YAML')
run: |
yamllint --version
- name: Run Yaml linter
if: startsWith(matrix.config.name, 'Lint YAML')
run: |
scripts/lint.sh --verbose --yaml
- name: Install Cmake linter
if: startsWith(matrix.config.name, 'Lint Cmake')
run: |
sudo apt-get update &> /dev/null
sudo apt-get install -y cmake-format
- name: Check Cmake linter
if: startsWith(matrix.config.name, 'Lint Cmake')
run: |
cmake-format --version
- name: Run Cmake linter
if: startsWith(matrix.config.name, 'Lint Cmake')
run: |
scripts/lint.sh --verbose --cmake



Check failure on line 116 in .github/workflows/ci_lint.yml

View workflow job for this annotation

GitHub Actions / Lint YAML

116:1 [empty-lines] too many blank lines (3 > 2)

Check failure on line 117 in .github/workflows/ci_lint.yml

View workflow job for this annotation

GitHub Actions / Lint YAML

117:11 [new-line-at-end-of-file] no new line character at the end of file

Check failure on line 117 in .github/workflows/ci_lint.yml

View workflow job for this annotation

GitHub Actions / Lint YAML

117:1 [trailing-spaces] trailing spaces
81 changes: 81 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {name: "Ubuntu Clang 19|C++20", os: ubuntu-24.04, toolchain: clang-19, std: 20, cmake_config: RelWithDebInfo, clang_version: 19, installed_clang_version: 18}
- {name: "Ubuntu Clang 19|C++23", os: ubuntu-24.04, toolchain: clang-19, std: 23, cmake_config: RelWithDebInfo, clang_version: 19, installed_clang_version: 18}
- {name: "Ubuntu Clang 19|C++26", os: ubuntu-24.04, toolchain: clang-19, std: 26, cmake_config: RelWithDebInfo, clang_version: 19, installed_clang_version: 18}


- {name: "Ubuntu Clang 18|C++20", os: ubuntu-24.04, toolchain: clang-18, std: 20, cmake_config: Asan, clang_version: 18, installed_clang_version: 18}
- {name: "Ubuntu Clang 18|C++23", os: ubuntu-24.04, toolchain: clang-18, std: 23, cmake_config: Asan, clang_version: 18, installed_clang_version: 18}
- {name: "Ubuntu Clang 18|C++26", os: ubuntu-24.04, toolchain: clang-18, std: 26, cmake_config: Asan, clang_version: 18, installed_clang_version: 18}

- {name: "Ubuntu Clang 17|C++20", os: ubuntu-24.04, toolchain: clang-17, std: 20, cmake_config: Asan, clang_version: 17, installed_clang_version: 18}
- {name: "Ubuntu Clang 17|C++23", os: ubuntu-24.04, toolchain: clang-17, std: 23, cmake_config: Asan, clang_version: 17, installed_clang_version: 18}
- {name: "Ubuntu Clang 17|C++26", os: ubuntu-24.04, toolchain: clang-17, std: 26, cmake_config: Asan, clang_version: 17, installed_clang_version: 18}


- {name: "Ubuntu GCC 14|C++20", os: ubuntu-24.04, toolchain: gcc-14, std: 20, cmake_config: Asan, clang_version: -1, installed_clang_version: -1}
- {name: "Ubuntu GCC 14|C++23", os: ubuntu-24.04, toolchain: gcc-14, std: 23, cmake_config: Asan, clang_version: -1, installed_clang_version: -1}
- {name: "Ubuntu GCC 14|C++26", os: ubuntu-24.04, toolchain: gcc-14, std: 26, cmake_config: Asan, clang_version: -1, installed_clang_version: -1}

- {name: "Ubuntu GCC 13|C++20", os: ubuntu-24.04, toolchain: gcc-13, std: 20, cmake_config: Asan, clang_version: -1, installed_clang_version: -1}
- {name: "Ubuntu GCC 13|C++23", os: ubuntu-24.04, toolchain: gcc-13, std: 23, cmake_config: Asan, clang_version: -1, installed_clang_version: -1}

steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Activate verbose shell
run: set -x
- name: Install LLVM+Clang
if: startsWith(matrix.config.name, 'Ubuntu Clang')
run: |
set -x
cat /etc/lsb-release
sudo apt-get remove clang-${{matrix.config.installed_clang_version}} \
lldb-${{matrix.config.installed_clang_version}} \
lld-${{matrix.config.installed_clang_version}} \
clangd-${{matrix.config.installed_clang_version}} \
clang-tidy-${{matrix.config.installed_clang_version}} \
clang-format-${{matrix.config.installed_clang_version}} \
clang-tools-${{matrix.config.installed_clang_version}} \
llvm-${{matrix.config.installed_clang_version}}-dev \
lld-${{matrix.config.installed_clang_version}} \
lldb-${{matrix.config.installed_clang_version}} \
llvm-${{matrix.config.installed_clang_version}}-tools \
libomp-${{matrix.config.installed_clang_version}}-dev \
libc++-${{matrix.config.installed_clang_version}}-dev \
libc++abi-${{matrix.config.installed_clang_version}}-dev \
libclang-common-${{matrix.config.installed_clang_version}}-dev \
libclang-${{matrix.config.installed_clang_version}}-dev \
libclang-cpp${{matrix.config.installed_clang_version}}-dev \
libunwind-${{matrix.config.installed_clang_version}}-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{matrix.config.clang_version}} all
sudo apt-get install libc++-dev libc++1 libc++abi-dev libc++abi1
- name: Install GCC
if: startsWith(matrix.config.name, 'Ubuntu GCC')
run: |
set -x
cat /etc/lsb-release
sudo apt update
sudo apt-get install ${{matrix.config.toolchain}}
- name: Run tests
run: |
set -x
pwd
scripts/run-tests.sh --verbose --fresh --config ${{matrix.config.cmake_config}} --preset ${{matrix.config.toolchain}} --std ${{matrix.config.std}}
8 changes: 8 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
// /.markdownlint.json -*-config-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

// Default configuration for markdownlint.
// Check https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md

{
// MD013: Line length
"MD013": false,
// MD024: Multiple headers with the same content
"MD024": false
}
9 changes: 7 additions & 2 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# shellcheck
# allow for non-alphanumeric filenames
# /.shellcheckrcc -*-config-*-
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Default configuration for shellcheck


# allow for non-alphanumeric filenames (https://www.shellcheck.net/wiki/SC2038)
disable=SC2038
36 changes: 36 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# /.yamllint -*-config-*-
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Default configuration for yamllint.

yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

rules:
anchors: enable
braces: enable
brackets: enable
colons: enable
commas: enable
comments:
level: warning
comments-indentation:
level: warning
document-end: disable
document-start: disable
empty-lines: enable
empty-values: disable
float-values: disable
hyphens: enable
indentation: enable
key-duplicates: enable
key-ordering: disable
line-length: disable
new-line-at-end-of-file: enable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable
truthy: disable
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ cmake_minimum_required(VERSION 3.10)
project(
beman_optional26
VERSION 0.0.0
LANGUAGES CXX)
LANGUAGES CXX
)

enable_testing()

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
SPDX-License-Identifier: 2.0 license with LLVM exceptions
-->

![CI Tests](https://github.com/beman-project/Optional26/actions/workflows/ci.yml/badge.svg)
![CI Tests](https://github.com/beman-project/Optional26/actions/workflows/ci_tests.yml/badge.svg)
![CI Lint](https://github.com/beman-project/Optional26/actions/workflows/ci_lint.yml/badge.svg)

This repository implements `std::optional` extensions targeting C++26. The `Beman.Optional26` library aims to evaluate the stability, the usability, and the performance of these proposed changes before they are officially adopted by WG21 into the C++ Working Draft. Additionally, it allows developers to use these new features before they are implemented in major standard library compilers.

Expand Down
Loading
Loading