diff --git a/.github/workflows/ccache-build.yaml b/.github/workflows/ccache-build.yaml new file mode 100644 index 000000000..ccffcddf7 --- /dev/null +++ b/.github/workflows/ccache-build.yaml @@ -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