From da499544f7601da88940dc6f779fa54cf47549a7 Mon Sep 17 00:00:00 2001 From: Kentaro Hayashi Date: Wed, 30 Oct 2024 12:42:29 +0900 Subject: [PATCH] ci: cache package to reduce build time Signed-off-by: Kentaro Hayashi --- .github/workflows/apt.yml | 10 ++++++++++ .github/workflows/windows.yml | 7 +++++++ .github/workflows/yum.yml | 7 +++++++ 3 files changed, 24 insertions(+) diff --git a/.github/workflows/apt.yml b/.github/workflows/apt.yml index 69bb895ce..29ad29f7a 100644 --- a/.github/workflows/apt.yml +++ b/.github/workflows/apt.yml @@ -43,7 +43,17 @@ jobs: sudo apt -V install ruby ruby-bundler ruby-serverspec sudo gem install bundler:2.2.9 --no-document sudo gem uninstall fileutils + - name: cache deb + uses: actions/cache@v4 + id: cache-deb + with: + path: | + fluent-package/apt/repositories + fluent-apt-source/apt/repositories + fluent-lts-apt-source/apt/repositories + key: ${{ runner.os }}-cache-${{ matrix.rake-job }}-${{ hashFiles('**/config.rb', '**/Rakefile', '**/Gemfile*', 'fluent-package/templates/**', 'fluent-package/debian/**', 'fluent-package/apt/**/Dockerfile') }} - name: Build deb with Docker + if: ${{ ! steps.cache-deb.outputs.cache-hit }} run: | rake apt:build APT_TARGETS=${{ matrix.rake-job }} - name: Upload fluent-package deb diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 742846ca1..6d8045909 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -18,7 +18,14 @@ jobs: with: ruby-version: 3.1 - uses: actions/checkout@master + - name: cache msi + uses: actions/cache@v4 + id: cache-msi + with: + path: fluent-package/msi/repositories + key: ${{ runner.os }}-cache-windows-${{ hashFiles('**/config.rb', '**/Rakefile', '**/Gemfile*', '!**/*.ps1') }} - name: Build + if: ${{ ! steps.cache-msi.outputs.cache-hit }} run: | gem install serverspec gem install bundler:2.2.9 --no-document diff --git a/.github/workflows/yum.yml b/.github/workflows/yum.yml index a625f2596..b26b71550 100644 --- a/.github/workflows/yum.yml +++ b/.github/workflows/yum.yml @@ -43,7 +43,14 @@ jobs: sudo apt -V install ruby ruby-bundler ruby-serverspec sudo gem install bundler:2.2.9 --no-document sudo gem uninstall fileutils + - name: cache rpm + uses: actions/cache@v4 + id: cache-rpm + with: + path: fluent-package/yum/repositories + key: ${{ runner.os }}-cache-${{ matrix.rake-job }}-${{ hashFiles('**/config.rb', '**/Rakefile', '**/Gemfile*', '**/*.spec.in') }} - name: Build rpm with Docker + if: ${{ ! steps.cache-rpm.outputs.cache-hit }} run: | rake yum:build YUM_TARGETS=${{ matrix.rake-job }} - name: Upload fluent-package rpm