Skip to content

Commit

Permalink
fix: Various fixes (#12)
Browse files Browse the repository at this point in the history
- Update `cmake_minimum_required`
- Fix windows tests
- Fix install for shared library. Static is still weird because it
requires installing dependencies
- Change `SonarCloud` for `Qodana`
- Changed coverage test to use `gcov`
- Removed the `set(CMAKE_BUILD_TYPE)`. Instead it should be set via
preset or manually, or let the system decide. Can interfere with `cmake
--install` and other processes
- Simplified packit configuration
- Added `renovate` as dependency tracker

Closes #11
  • Loading branch information
LecrisUT authored Sep 2, 2024
2 parents a4f73db + f363d58 commit ad3fe1f
Show file tree
Hide file tree
Showing 41 changed files with 375 additions and 359 deletions.
16 changes: 13 additions & 3 deletions .distro/plans/ctest.fmf
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
summary:
Test the bundled ctests
summary: Test the bundled ctests

prepare:
- how: install
package:
- cmake
- gcc-c++
- git
- cmake(Catch2)
- pkgconf

discover+:
how: fmf
path: test
path: .
test: /test/ctest
execute:
how: tmt
7 changes: 7 additions & 0 deletions .distro/plans/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
adjust+:
# Cannot use initiator: fedora-ci reliably yet
when: initiator is not defined or initiator != packit
discover+:
how: fmf
dist-git-source: true
dist-git-extract: json-type-*/
4 changes: 0 additions & 4 deletions .distro/plans/main.fmf.dist-git

This file was deleted.

9 changes: 9 additions & 0 deletions .distro/plans/rpminspect.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ plan:
url: https://github.com/packit/tmt-plans
ref: main
name: /plans/rpminspect
environment:
# upstream is excluded here because it triggers "Unexpected changed source archive content"
# This happens when the released version already contains the package version:
# https://github.com/packit/tmt-plans/issues/13
RPMINSPECT_EXCLUDE: metadata,upstream
adjust:
when: distro >= fedora-41
because: Recently rpminspect fails to get the distro-tag
enabled: false
15 changes: 10 additions & 5 deletions .distro/plans/rpmlint.fmf
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
plan:
import:
url: https://github.com/packit/tmt-plans
ref: main
name: /plans/rpmlint
prepare:
- how: shell
script: cp ./*.rpmlintrc $TMT_PLAN_DATA/
discover:
how: fmf
filter: "tag: rpmlint"
url: https://github.com/packit/tmt-plans
ref: main
execute:
how: tmt
File renamed without changes.
17 changes: 17 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"groupName": "CI and devDependencies",
"matchManagers": ["github-actions", "pre-commit", "pep621"]
}
],
"separateMajorMinor": false,
"extends": [
"config:recommended",
":dependencyDashboard",
"schedule:weekly",
":enablePreCommit",
":semanticCommitTypeAll(chore)"
]
}
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ jobs:
name: 👀 coverage
needs: [ tests ]
uses: ./.github/workflows/step_coverage.yaml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: github.event_name != 'schedule'

static-analysis:
needs: [ pre-commit ]
uses: ./.github/workflows/step_static-analysis.yaml
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
if: github.event_name != 'schedule'

pass:
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,14 @@ jobs:
with:
mask-experimental: true

# Normally this is unnecessary, but for sonarcloud, this tags the new version
static-analysis:
needs: [ pre-commit ]
uses: ./.github/workflows/step_static-analysis.yaml
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

docs:
name: 📘 docs
needs: [ pre-commit ]
uses: ./.github/workflows/step_docs.yaml

tests-pass:
name: ✅ Pass
needs: [ pre-commit, tests, static-analysis, docs ]
needs: [ pre-commit, tests, docs ]
runs-on: ubuntu-latest
steps:
- name: Check all CI jobs
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/step_coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: 👀 coverage

on:
workflow_call:
secrets:
CODECOV_TOKEN:
description: Codecov token of the main repository
required: false

permissions:
contents: read
Expand All @@ -16,14 +20,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: Run CMake configuration for ${{ matrix.toolchain }} toolchain
uses: lukka/run-cmake@v10.3
- uses: lukka/run-cmake@v10.3
with:
workflowPreset: coverage-${{ matrix.coverage }}
- name: Get lcov data
uses: danielealbano/lcov-action@v3
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
- uses: threeal/gcovr-action@xml-out
with:
files: coverage.info
xml-out: coverage.xml
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: ${{ matrix.coverage }}-tests
28 changes: 5 additions & 23 deletions .github/workflows/step_static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,17 @@ name: static-analysis
on:
workflow_call:
secrets:
SONAR_TOKEN:
QODANA_TOKEN:
required: true

jobs:
sonar-cloud:
name: SonarCloud
qodana:
name: Qodana
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: WyriHaximus/github-action-get-previous-tag@v1
id: git-tag
with:
prefix: v
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- uses: lukka/get-cmake@latest
- name: Run CMake configuration for ${{ matrix.toolchain }} toolchain
uses: lukka/run-cmake@v10.3
with:
workflowPreset: coverage-all
- name: Convert output to sonarqube
run: pipx run gcovr --sonarqube > coverage.xml
- name: Run sonar-scanner
- uses: JetBrains/qodana-action@v2024.1
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >
sonar-scanner
--define sonar.cfamily.compile-commands=$(echo cmake-build-*)/compile_commands.json
--define sonar.coverageReportPaths=coverage.xml
--define sonar.projectVersion=${{ steps.git-tag.outputs.tag }}
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
31 changes: 28 additions & 3 deletions .github/workflows/step_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ permissions:
contents: read

jobs:
tests:
name: 🛠️ ${{ matrix.toolchain }}
test-toolchains:
name: >
🛠️ ${{ matrix.toolchain }}
${{ matrix.experimental && '[🧪 Experimental]' || '' }}
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
container: ${{ !matrix.os && 'ghcr.io/lecrisut/dev-env:main' || '' }}
continue-on-error: ${{ matrix.experimental || false }}
Expand All @@ -24,7 +26,6 @@ jobs:
include:
- os: windows-latest
toolchain: windows
experimental: true
- os: macos-latest
toolchain: macos
steps:
Expand All @@ -44,3 +45,27 @@ jobs:
with:
workflowPreset: "${{ matrix.toolchain }}-ci"
continue-on-error: ${{ matrix.experimental && inputs.mask-experimental}}

cmake-version:
name: >
🔨 CMake ${{ matrix.cmake }}
${{ matrix.experimental && '[🧪 Experimental]' || '' }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
strategy:
fail-fast: false
matrix:
cmake: [ "3.25", "latest", "latestrc" ]
include:
- cmake: latestrc
experimental: true
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ matrix.cmake }}
- name: Run CMake workflow
uses: lukka/run-cmake@v10.3
with:
workflowPreset: gcc-ci
continue-on-error: ${{ matrix.experimental && inputs.mask-experimental}}
107 changes: 41 additions & 66 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -1,83 +1,58 @@
specfile_path: .distro/cmake-template.spec

# add or remove files that should be synced
files_to_sync:
- src: .distro/cmake-template.spec
dest: cmake-template.spec
- .packit.yaml
- src: .distro/cmake-template.rpmlintrc
dest: cmake-template.rpmlintrc
# tmt setup
- src: .distro/.fmf/
dest: .fmf/
- src: .distro/plans/
dest: plans/
- src: .distro/
dest: ./
delete: true
filters:
- "- main.fmf.dist-git"
- "- rpminspect.fmf"
- "- rpmlint.fmf"
- src: .distro/plans/main.fmf.dist-git
dest: plans/main.fmf
- "protect .git*"
- "protect sources"
- "protect changelog"
- "- plans/rpminspect.fmf"
- "- plans/rpmlint.fmf"
- .packit.yaml

specfile_path: .distro/cmake-template.spec
upstream_package_name: CMake-Template
downstream_package_name: cmake-template

update_release: false
upstream_tag_template: v{version}

targets: &targets
- fedora-all-x86_64
- fedora-all-aarch64
- epel-10-x86_64
- epel-10-aarch64
- epel-9-x86_64
- epel-9-aarch64

jobs:
- job: copr_build
- &copr_build
job: copr_build
trigger: pull_request
owner: lecris
project: cmake-template
targets:
- fedora-38-x86_64
- fedora-38-aarch64
- fedora-development-x86_64
- fedora-development-aarch64
- job: tests
- &tests
job: tests
trigger: pull_request
targets:
- fedora-38-x86_64
- fedora-38-aarch64
- fedora-development-x86_64
- fedora-development-aarch64
fmf_path: .distro
- job: copr_build
- <<: *copr_build
trigger: commit
branch: main
owner: lecris
project: nightly
targets:
- fedora-38-x86_64
- fedora-38-aarch64
- fedora-development-x86_64
- fedora-development-aarch64
additional_repos:
- copr://@scikit-build/release
- job: tests
- <<: *tests
trigger: commit
branch: main
targets:
- fedora-38-x86_64
- fedora-38-aarch64
- fedora-development-x86_64
- fedora-development-aarch64
fmf_path: .distro
## Uncomment when released downstream
# - job: propose_downstream
# trigger: release
# dist_git_branches:
# - fedora-rawhide
# - epel-9
# - job: koji_build
# trigger: commit
# dist_git_branches:
# - fedora-all
# - epel-9
# - job: bodhi_update
# trigger: commit
# dist_git_branches:
# - fedora-branched
# - epel-9
- <<: *copr_build
trigger: release
owner: lecris
project: release
- <<: *tests
trigger: release
- job: propose_downstream
trigger: release
dist_git_branches:
- fedora-rawhide
- job: koji_build
trigger: commit
dist_git_branches:
- fedora-all
- job: bodhi_update
trigger: commit
dist_git_branches:
- fedora-branched
Loading

0 comments on commit ad3fe1f

Please sign in to comment.