From 35984c76794cf466ea4401a1ccefd3823443901a Mon Sep 17 00:00:00 2001 From: Matt Czech Date: Fri, 1 Sep 2023 14:33:54 -0500 Subject: [PATCH] BIT-58: Add Github Actions workflow for caching dependencies --- .github/workflows/cache-dependencies.yml | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/cache-dependencies.yml diff --git a/.github/workflows/cache-dependencies.yml b/.github/workflows/cache-dependencies.yml new file mode 100644 index 000000000..035c6f66c --- /dev/null +++ b/.github/workflows/cache-dependencies.yml @@ -0,0 +1,54 @@ +--- +name: Cache Dependencies + +on: + push: + branches: + - main + +env: + DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer + MINT_LINK_PATH: .mint/bin + MINT_PATH: .mint/lib + +jobs: + cache-dependencies: + name: Cache Dependencies + runs-on: macos-13 + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Setup Ruby + uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 + with: + bundler-cache: true + ruby-version: 3.2.2 + + - name: Cache Mint Packages + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: .mint + key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }} + restore-keys: | + ${{ runner.os }}-mint- + + - name: Cache SPM Packages + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: build/DerivedData/SourcePackages + key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm- + + - name: Setup + run: | + brew install mint xcbeautify + ./Scripts/bootstrap.sh + + - name: Update Xcode Dependencies + run: | + set -o pipefail && \ + xcodebuild -resolvePackageDependencies \ + -project Bitwarden.xcodeproj \ + -clonedSourcePackagesDirPath build/DerivedData/SourcePackages