Skip to content

Commit 9348269

Browse files
authored
Merge pull request #23 from IBM/jo5ta/dev
Speed up CI builds with ccache
2 parents 25587f6 + fa530e5 commit 9348269

File tree

3 files changed

+45
-31
lines changed

3 files changed

+45
-31
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ jobs:
5454
- name: Checkout code
5555
uses: actions/checkout@v4
5656

57+
- name: Setup ccache
58+
run: mkdir -p ~/.ccache
59+
60+
- name: Restore ccache
61+
uses: actions/cache@v4
62+
with:
63+
path: ~/.ccache
64+
key: ccache-${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}-${{ github.sha }}
65+
restore-keys: |
66+
ccache-${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}-
67+
ccache-${{ runner.os }}-build-
68+
5769
- name: Load CI-Container
5870
uses: ./.github/actions/load-container
5971
with:
@@ -62,6 +74,9 @@ jobs:
6274
- name: Build
6375
run: ./scripts/container.sh ./scripts/ci-cd/step_build.sh
6476

77+
- name: Show ccache stats
78+
run: ./scripts/container.sh ccache --show-stats || true
79+
6580
- name: Test
6681
run: ./scripts/container.sh ./scripts/ci-cd/step_test.sh
6782

@@ -78,6 +93,19 @@ jobs:
7893
- name: Checkout code
7994
uses: actions/checkout@v4
8095

96+
- name: Setup ccache
97+
run: mkdir -p ~/.ccache
98+
99+
- name: Restore ccache
100+
uses: actions/cache@v4
101+
with:
102+
path: ~/.ccache
103+
key: ccache-${{ runner.os }}-package-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}-${{ github.sha }}
104+
restore-keys: |
105+
ccache-${{ runner.os }}-package-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}-
106+
ccache-${{ runner.os }}-package-
107+
ccache-${{ runner.os }}-build-
108+
81109
- name: Load CI-Container
82110
uses: ./.github/actions/load-container
83111
with:
@@ -86,35 +114,17 @@ jobs:
86114
- name: Package
87115
run: ./scripts/container.sh ./scripts/ci-cd/step_package.sh
88116

117+
- name: Show ccache stats
118+
run: ./scripts/container.sh ccache --show-stats || true
119+
89120
- name: Package Validate
90121
run: ./scripts/container.sh ./scripts/ci-cd/step_package_validate.sh --skip-srpm-rebuild
91122

92-
- name: Upload SRPM artifact
93-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
94-
uses: actions/upload-artifact@v4
95-
with:
96-
name: srpm
97-
path: build/packages/*.src.rpm
98-
retention-days: 1
99-
100-
# ============================================
101-
# Release (only on push to main)
102-
# ============================================
103-
release:
104-
runs-on: ubuntu-latest
105-
needs: package
106-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
107-
steps:
108-
- name: Checkout code
109-
uses: actions/checkout@v4
110-
111-
- name: Download SRPM artifact
112-
uses: actions/download-artifact@v4
113-
with:
114-
name: srpm
115-
path: packages
116-
123+
# ==========================================
124+
# Create GitHub Release (only on push to main)
125+
# ==========================================
117126
- name: Get version and generate release info
127+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
118128
id: release_info
119129
env:
120130
COMMIT_SHA: ${{ github.sha }}
@@ -127,11 +137,11 @@ jobs:
127137
echo "tag=v${VERSION}+${SHORT_SHA}" >> $GITHUB_OUTPUT
128138
129139
# Generate checksums
130-
cd packages
140+
cd build/packages
131141
sha256sum *.src.rpm > SHA256SUMS
132142
133143
# Build release body with checksums embedded
134-
cd ..
144+
cd ../..
135145
cat > release_body.md << EOF
136146
Release of Common Low Level Tracing Kit
137147
@@ -145,16 +155,17 @@ jobs:
145155
146156
## Checksums (SHA256)
147157
\`\`\`
148-
$(cat packages/SHA256SUMS)
158+
$(cat build/packages/SHA256SUMS)
149159
\`\`\`
150160
EOF
151161
152162
- name: Create Release
163+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
153164
uses: softprops/action-gh-release@v2
154165
with:
155166
tag_name: ${{ steps.release_info.outputs.tag }}
156167
name: ${{ steps.release_info.outputs.version }}
157168
body_path: release_body.md
158169
files: |
159-
packages/*.src.rpm
160-
packages/SHA256SUMS
170+
build/packages/*.src.rpm
171+
build/packages/SHA256SUMS

VERSION.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
1.2.58
1+
1.2.59
22

33
# Change log
4+
## 1.2.59
5+
- ci: use ccache with GitHub cache to speed up builds
46
## 1.2.58
57
- cli: show features, git hash, license, and URL in --version output
68
- ci: auto-publish SRPM to GitHub releases when PRs are merged

scripts/container.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RUN dnf -y install \
1818
make \
1919
gcc \
2020
g++ \
21+
ccache \
2122
clang-tools-extra \
2223
valgrind \
2324
lcov \

0 commit comments

Comments
 (0)