Skip to content

Commit

Permalink
Add ccache Github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
inknos committed Sep 13, 2023
1 parent 6d7cb37 commit d44aacc
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ccache-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: DNF 5 Build
on:
pull_request:
workflow_dispatch:

jobs:
build-with-ccache:
name: Build with CCache
runs-on: ubuntu-latest
container:
image: fedora:rawhide

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

# this step needs to be incorporated in our container that we use for testing
- name: Install dependencies
run: |
dnf install -y ccache && dnf builddep -y ./dnf5.spec
- name: Prepare CCache timestamp
id: ccache_cache_timestamp
run:
echo "timestamp=$(date +%Y-%m-%d-%H:%M:%S)-UTC" >> "$GITHUB_OUTPUT"

- name: Cache CCache files
uses: actions/cache@v3
with:
path: ~/.cache/ccache
key: ${{ github.event.repository.name }}-ccache-pr-${{ github.event.number }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ github.event.repository.name }}-ccache-pr-${{ github.event.number }}-
${{ github.event.repository.name }}-ccache-pr-
${{ github.event.repository.name }}-
- name: Create CCache symlinks to prioritize it over GCC
run: |
ln -s /usr/bin/ccache /usr/local/bin/gcc
ln -s /usr/bin/ccache /usr/local/bin/g++
ln -s /usr/bin/ccache /usr/local/bin/cc
ln -s /usr/bin/ccache /usr/local/bin/c++
- name: Zero CCache statistics
run: ccache -z

- name: Configure DNF5 with CMake
run: cmake -S . -B build

- name: Build DNF5
run: cmake --build build

- name: Display CCache statistics
run: ccache -s

0 comments on commit d44aacc

Please sign in to comment.